AgentRuntimeService — DDL appendix¶
Generated from the architecture model
This page is rendered from model/**/*.yaml by tools/docs_model during mkdocs build. Edit the YAML, not this page; hand-written design lives on the linked service, platform and plane pages.
Dialect shown: SQL Server (nvarchar, uniqueidentifier, datetimeoffset). Migrations are authored as FluentMigrator classes in the service's DatabaseModel.Migrations project; the TenantId column and the NHibernate tenant filter follow canonical ADR-0100 in SharedDb mode.
dbo.ExecutionAttempts¶
Owner: ExecutionAttempt · Retention: 1 year by default (project retention, D31)
CREATE TABLE [dbo].[ExecutionAttempts] (
[AttemptId] uniqueidentifier NOT NULL,
[RunId] uniqueidentifier NOT NULL,
[StepId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[ProjectId] nvarchar(64) NOT NULL,
[EnvironmentId] nvarchar(64) NULL,
[LeaseId] uniqueidentifier NOT NULL,
[FencingToken] bigint NOT NULL,
[SnapshotId] uniqueidentifier NOT NULL,
[ReleaseId] nvarchar(256) NOT NULL,
[AgentId] nvarchar(128) NOT NULL,
[ModelProfileId] nvarchar(128) NOT NULL,
[State] int NOT NULL,
[Phase] int NOT NULL,
[CorrectionCount] int NOT NULL DEFAULT (0),
[MaxCorrections] int NOT NULL,
[LastCheckpointId] uniqueidentifier NULL,
[ContextSnapshotRef] nvarchar(512) NULL,
[OutcomeHash] nvarchar(128) NULL,
[CancellationObservedAt] datetimeoffset NULL,
[StartedAt] datetimeoffset NOT NULL,
[EndedAt] datetimeoffset NULL,
[Version] rowversion NOT NULL,
CONSTRAINT [PK_ExecutionAttempts] PRIMARY KEY ([AttemptId])
);
CREATE UNIQUE INDEX [UX_Attempts_Lease] ON [dbo].[ExecutionAttempts] ([LeaseId]);
CREATE INDEX [IX_Attempts_Run_Step] ON [dbo].[ExecutionAttempts] ([RunId], [StepId]);
CREATE INDEX [IX_Attempts_Tenant_State] ON [dbo].[ExecutionAttempts] ([TenantId], [State]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
AttemptId |
uniqueidentifier |
no | PK | |
RunId |
uniqueidentifier |
no | ||
StepId |
uniqueidentifier |
no | ||
TenantId |
nvarchar(64) |
no | ||
ProjectId |
nvarchar(64) |
no | ||
EnvironmentId |
nvarchar(64) |
yes | ||
LeaseId |
uniqueidentifier |
no | ||
FencingToken |
bigint |
no | ||
SnapshotId |
uniqueidentifier |
no | ||
ReleaseId |
nvarchar(256) |
no | ||
AgentId |
nvarchar(128) |
no | ||
ModelProfileId |
nvarchar(128) |
no | ||
State |
int |
no | ||
Phase |
int |
no | ||
CorrectionCount |
int |
no | ||
MaxCorrections |
int |
no | ||
LastCheckpointId |
uniqueidentifier |
yes | ||
ContextSnapshotRef |
nvarchar(512) |
yes | ||
OutcomeHash |
nvarchar(128) |
yes | ||
CancellationObservedAt |
datetimeoffset |
yes | ||
StartedAt |
datetimeoffset |
no | ||
EndedAt |
datetimeoffset |
yes | ||
Version |
rowversion |
no |
dbo.Checkpoints¶
Owner: Checkpoint
CREATE TABLE [dbo].[Checkpoints] (
[CheckpointId] uniqueidentifier NOT NULL,
[AttemptId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[Sequence] int NOT NULL,
[Phase] int NOT NULL,
[AdapterStateRef] nvarchar(512) NOT NULL,
[AdapterVersion] nvarchar(32) NOT NULL,
[ContextSnapshotRef] nvarchar(512) NULL,
[Hash] nvarchar(128) NOT NULL,
[CreatedAt] datetimeoffset NOT NULL,
CONSTRAINT [PK_Checkpoints] PRIMARY KEY ([CheckpointId])
);
ALTER TABLE [dbo].[Checkpoints] ADD CONSTRAINT [FK_Checkpoints_ExecutionAttempts_AttemptId] FOREIGN KEY ([AttemptId]) REFERENCES [dbo].[ExecutionAttempts] ([AttemptId]);
CREATE UNIQUE INDEX [UX_Checkpoints_Attempt_Sequence] ON [dbo].[Checkpoints] ([AttemptId], [Sequence]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
CheckpointId |
uniqueidentifier |
no | PK | |
AttemptId |
uniqueidentifier |
no | FK → ExecutionAttempts.AttemptId | |
TenantId |
nvarchar(64) |
no | ||
Sequence |
int |
no | ||
Phase |
int |
no | ||
AdapterStateRef |
nvarchar(512) |
no | ||
AdapterVersion |
nvarchar(32) |
no | ||
ContextSnapshotRef |
nvarchar(512) |
yes | ||
Hash |
nvarchar(128) |
no | ||
CreatedAt |
datetimeoffset |
no |
dbo.CallRecords¶
Owner: CallRecord
CREATE TABLE [dbo].[CallRecords] (
[CallId] uniqueidentifier NOT NULL,
[AttemptId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[Sequence] int NOT NULL,
[Kind] int NOT NULL,
[Target] nvarchar(256) NOT NULL,
[RequestHash] nvarchar(128) NOT NULL,
[PolicyDecisionId] uniqueidentifier NULL,
[ReceiptRef] nvarchar(512) NULL,
[Status] nvarchar(16) NOT NULL,
[StartedAt] datetimeoffset NOT NULL,
[EndedAt] datetimeoffset NULL,
CONSTRAINT [PK_CallRecords] PRIMARY KEY ([CallId])
);
ALTER TABLE [dbo].[CallRecords] ADD CONSTRAINT [FK_CallRecords_ExecutionAttempts_AttemptId] FOREIGN KEY ([AttemptId]) REFERENCES [dbo].[ExecutionAttempts] ([AttemptId]);
CREATE UNIQUE INDEX [UX_Calls_Attempt_Sequence] ON [dbo].[CallRecords] ([AttemptId], [Sequence]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
CallId |
uniqueidentifier |
no | PK | |
AttemptId |
uniqueidentifier |
no | FK → ExecutionAttempts.AttemptId | |
TenantId |
nvarchar(64) |
no | ||
Sequence |
int |
no | ||
Kind |
int |
no | ||
Target |
nvarchar(256) |
no | ||
RequestHash |
nvarchar(128) |
no | ||
PolicyDecisionId |
uniqueidentifier |
yes | ||
ReceiptRef |
nvarchar(512) |
yes | ||
Status |
nvarchar(16) |
no | ||
StartedAt |
datetimeoffset |
no | ||
EndedAt |
datetimeoffset |
yes |
dbo.DecisionRequests¶
Owner: DecisionRequest
CREATE TABLE [dbo].[DecisionRequests] (
[DecisionId] uniqueidentifier NOT NULL,
[AttemptId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[Kind] int NOT NULL,
[ApprovalId] uniqueidentifier NULL,
[ProposalHash] nvarchar(128) NULL,
[OptionsJson] nvarchar(max) NULL,
[Recommendation] nvarchar(2000) NULL,
[Status] nvarchar(16) NOT NULL,
[RequestedAt] datetimeoffset NOT NULL,
[AnsweredAt] datetimeoffset NULL,
CONSTRAINT [PK_DecisionRequests] PRIMARY KEY ([DecisionId])
);
ALTER TABLE [dbo].[DecisionRequests] ADD CONSTRAINT [FK_DecisionRequests_ExecutionAttempts_AttemptId] FOREIGN KEY ([AttemptId]) REFERENCES [dbo].[ExecutionAttempts] ([AttemptId]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
DecisionId |
uniqueidentifier |
no | PK | |
AttemptId |
uniqueidentifier |
no | FK → ExecutionAttempts.AttemptId | |
TenantId |
nvarchar(64) |
no | ||
Kind |
int |
no | ||
ApprovalId |
uniqueidentifier |
yes | ||
ProposalHash |
nvarchar(128) |
yes | ||
OptionsJson |
nvarchar(max) |
yes | ||
Recommendation |
nvarchar(2000) |
yes | ||
Status |
nvarchar(16) |
no | ||
RequestedAt |
datetimeoffset |
no | ||
AnsweredAt |
datetimeoffset |
yes |
dbo.SubAgentDelegations¶
Owner: SubAgentDelegation
CREATE TABLE [dbo].[SubAgentDelegations] (
[DelegationId] uniqueidentifier NOT NULL,
[AttemptId] uniqueidentifier NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[ChildRunId] uniqueidentifier NOT NULL,
[ChildAgentId] nvarchar(128) NOT NULL,
[Purpose] nvarchar(1024) NOT NULL,
[Depth] int NOT NULL,
[Status] nvarchar(16) NOT NULL,
CONSTRAINT [PK_SubAgentDelegations] PRIMARY KEY ([DelegationId])
);
ALTER TABLE [dbo].[SubAgentDelegations] ADD CONSTRAINT [FK_SubAgentDelegations_ExecutionAttempts_AttemptId] FOREIGN KEY ([AttemptId]) REFERENCES [dbo].[ExecutionAttempts] ([AttemptId]);
CREATE UNIQUE INDEX [UX_Delegations_ChildRun] ON [dbo].[SubAgentDelegations] ([ChildRunId]);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
DelegationId |
uniqueidentifier |
no | PK | |
AttemptId |
uniqueidentifier |
no | FK → ExecutionAttempts.AttemptId | |
TenantId |
nvarchar(64) |
no | ||
ChildRunId |
uniqueidentifier |
no | ||
ChildAgentId |
nvarchar(128) |
no | ||
Purpose |
nvarchar(1024) |
no | ||
Depth |
int |
no | ||
Status |
nvarchar(16) |
no |
dbo.LoadedReleases¶
Owner: LoadedRelease
CREATE TABLE [dbo].[LoadedReleases] (
[ReleaseId] nvarchar(256) NOT NULL,
[AdapterVersion] nvarchar(32) NOT NULL,
[TenantId] nvarchar(64) NOT NULL,
[ManifestHash] nvarchar(128) NOT NULL,
[ContentRefsJson] nvarchar(max) NOT NULL,
[State] int NOT NULL,
[VerifiedAt] datetimeoffset NOT NULL,
[InFlightPolicy] nvarchar(16) NULL,
CONSTRAINT [PK_LoadedReleases] PRIMARY KEY ([ReleaseId], [AdapterVersion])
);
| Column | Type | Null | Key | Description |
|---|---|---|---|---|
ReleaseId |
nvarchar(256) |
no | PK | |
AdapterVersion |
nvarchar(32) |
no | PK | |
TenantId |
nvarchar(64) |
no | ||
ManifestHash |
nvarchar(128) |
no | ||
ContentRefsJson |
nvarchar(max) |
no | ||
State |
int |
no | ||
VerifiedAt |
datetimeoffset |
no | ||
InFlightPolicy |
nvarchar(16) |
yes |