AI Runs Framework
Sprint: SPRINT_20260109_011_003_BE_ai_runs_framework Status: Active Last Updated: 2026-01-10
The AI Runs Framework provides an auditable container for AI-assisted investigations, capturing the complete lifecycle from initial query through tool calls, artifact generation, and approvals.
Overview
“Chat is not auditable, repeatable, actionable with guardrails, or collaborative.”
The Run concept transforms ephemeral chat into:
- Auditable: Every interaction logged with timestamps and content digests
- Repeatable: Deterministic replay possible for verification
- Actionable: Artifacts produced (evidence packs, VEX statements, decisions)
- Collaborative: Handoffs, approvals, shared context across team members
Run Lifecycle
Runs progress through defined states with explicit transitions:
Created -> Active -> PendingApproval -> Completed
\-> Cancelled
\-> Failed
States
| State | Description | Allowed Transitions |
|---|---|---|
Created | Run initialized, no activity yet | Active, Cancelled |
Active | Conversation in progress | PendingApproval, Completed, Cancelled, Failed |
PendingApproval | Action requires user approval | Active, Completed, Cancelled |
Completed | Run finished and content digest recorded; attestation remains an explicit signed step | (terminal) |
Cancelled | Run cancelled by user | (terminal) |
Failed | Run failed due to error | (terminal) |
Lifecycle Diagram
+----------+ +---------+ +------------+ +----------+
| Created | -> | Active | -> | Pending | -> | Complete |
| | | | | Approval | | |
+----------+ +---------+ +------------+ +----------+
| | | |
v v v v
+--------------------------------------------------+
| Run Timeline |
| +-------+ +------+ +---------+ +--------+ +---+ |
| |Created| | User | |Assistant| | Action | |...| |
| | Event | | Turn | | Turn | |Proposed| | | |
| +-------+ +------+ +---------+ +--------+ +---+ |
+--------------------------------------------------+
|
v
+--------------------------------------------------+
| Artifacts Produced |
| +---------+ +--------+ +------+ +-----+ |
| | Evidence| |Decision| |Action| | VEX | |
| | Pack | | Record | |Result| |Stmt | |
| +---------+ +--------+ +------+ +-----+ |
+--------------------------------------------------+
|
v
+--------------------------------------------------+
| Run Attestation (DSSE) |
| - Content digest of all turns |
| - Evidence references |
| - Artifact digests |
| - Signed by platform key |
+--------------------------------------------------+
Current API Reference
PCD-456 source review at ad9edbcef5 (2026-10-08). The host composes RunEndpoints and then clones its endpoint metadata under /api/advisoryai/v1/advisory-ai/runs. This is the run family, not the separate /api/advisoryai/v1/runs/... task-result family.
View policy accepts advisory-ai:view, advisory-ai:operate or advisory-ai:admin; write operations additionally require operate/admin. Tenant and actor are resolved from envelope claims, not request-body/header identity options. The current resolver still has default/anonymous fallbacks; this review does not certify missing-claim isolation. Runtime store/provider and deployment acceptance remain separate.
| Operation under the run root | Current request/response semantics |
|---|---|
POST / | CreateRunRequestDto: required title, optional objective/context/metadata. Context fields are focusedCveId/focusedComponent/sbomDigest/imageReference/tags/enrichment marker. Returns 201 RunDto; it does not create a run from a conversationId payload. |
GET /{runId} | RunDto or 404. Includes identity/title/status/timestamps, event/artifact counts, digest, attestation flag and context/approval/metadata; it does not embed complete timeline/artifact arrays. |
GET /{runId}/timeline?skip=0&take=50 | Array of RunEventDto. Pagination is skip/take, not cursor/limit and not an events/cursor wrapper. |
POST /{runId}/complete | Optional CompleteRunRequestDto.summary; returns RunDto, 400 on invalid transition. Completion records a digest, not a signature. |
POST /{runId}/cancel | Optional CancelRunRequestDto.reason; returns RunDto, 400 on invalid transition. It does not return the former bespoke cancelledAt/reason shape. |
GET /?initiatedBy=...&status=Active&take=20&skip=0 | Optional initiatedBy/cveId/component/status and skip/take; RunQueryResultDto contains runs/totalCount/hasMore. userId/findingId/since/until/cursor/limit are not this query contract. |
The current create response’s Location uses /api/v1/runs/{id}; that header is a source-owner residual, not an alias introduced by this guide. Use the explicitly mapped group above after reviewing its current owner contract.
Unavailable reads and replay
No GET artifact-list or POST run-replay operation is composed. POST /{runId}/artifacts attaches an artifact; it is not a list operation. The library’s stored metadata and run digest do not establish a replay endpoint or deterministic-comparison response.
Attestation boundary
POST /{runId}/attest is the separate signing-dependent operation. RunService.AttestAsync requires IRunAttestationSigner or IAiAttestationEnvelopeSigner, rejecting missing, empty, unsigned or placeholder signatures. The current attestation verification operation is global to the AI family, with a runId request body; see below.
Reverify Program.cs, Endpoints/RunEndpoints.cs, Endpoints/AttestationEndpoints.cs, run DTOs/service and the consolidation mapper under src/AdvisoryAI/. No action, signing key enrollment, runtime query or deployment is performed by this review.
Evidence pack create requests retain truthful evidence digests: valid caller hashes or hashes computed from present normalized snapshot data; empty data with no digest is rejected. This separate owner contract is unchanged.
Timeline Event Types
The timeline captures all significant events during a Run.
| Event Type | Actor | Description |
|---|---|---|
RunCreated | system | Run initialized |
UserTurn | user:{userId} | User message added |
AssistantTurn | assistant | AI response generated |
ToolCall | assistant | AI invoked a tool (search, lookup, etc.) |
ActionProposed | assistant | AI proposed an action |
ApprovalRequested | system | Action requires user approval |
ApprovalGranted | user:{userId} | User approved action |
ApprovalDenied | user:{userId} | User denied action |
ActionExecuted | system | Action was executed |
ActionFailed | system | Action execution failed |
ArtifactCreated | system | Artifact attached to Run |
RunCompleted | system | Run completed and content digest recorded |
RunCancelled | user:{userId} | Run cancelled |
RunFailed | system | Run failed due to error |
Event Details
Each event type may include additional details:
AssistantTurn:
{
"contentDigest": "sha256:...",
"groundingScore": 0.92,
"tokenCount": 847
}
ActionProposed:
{
"actionType": "approve",
"label": "Accept Risk",
"parameters": {
"cveId": "CVE-2024-1234",
"rationale": "Not exploitable in our environment"
}
}
ArtifactCreated:
{
"artifactId": "art-001",
"artifactType": "EvidencePack",
"contentDigest": "sha256:..."
}
Artifact Types
Runs can produce various artifact types:
| Type | Description | Use Case |
|---|---|---|
EvidencePack | Bundle of evidence supporting a decision | Risk acceptance, VEX justification |
DecisionRecord | Formal record of a security decision | Audit trail, compliance |
VexStatement | VEX statement draft or final | Vulnerability disclosure |
ActionResult | Result of an executed action | Remediation tracking |
Explanation | AI-generated explanation | User understanding |
Report | Generated report document | Stakeholder communication |
Artifact Structure
{
"artifactId": "art-001",
"type": "EvidencePack",
"name": "CVE-2024-1234 Evidence Pack",
"contentDigest": "sha256:def456...",
"uri": "evidence://packs/art-001",
"createdAt": "2026-01-10T14:35:00Z",
"metadata": {
"cveId": "CVE-2024-1234",
"component": "pkg:npm/lodash@4.17.21",
"scanId": "scan-789",
"format": "evidence-pack/v1"
}
}
Replay Verification
The replay procedure in this section is design history. No run-replay endpoint is composed, and the following comparison fields are not a current response contract. The proposed goals are:
- Compliance audits: Proving AI outputs are reproducible
- Debugging: Understanding how AI reached conclusions
- Trust: Demonstrating consistent behavior
Replay Requirements
For successful replay:
- Temperature = 0: No randomness in token selection
- Fixed seed: Same seed across replays
- Model match: Same model weights (verified by digest)
- Prompt match: Identical prompts (verified by hash)
- Context match: Same input context
Replay Results
| Result | Meaning |
|---|---|
deterministic: true | Replay produced identical output |
deterministic: false | Output differs (see differences array) |
Common Divergence Causes
| Cause | Detection | Resolution |
|---|---|---|
| Different model | Model version mismatch | Use pinned model version |
| Non-zero temperature | Parameter check | Set temperature to 0 |
| Different seed | Seed mismatch | Use consistent seed |
| Prompt template change | Template version mismatch | Pin template version |
| Context ordering | Context hash mismatch | Sort context deterministically |
Run Attestation
Completed Runs produce DSSE-signed attestations containing:
Signing is mandatory for this path. If no signer is configured, RunService.AttestAsync fails and leaves the run unattested; operators must wire a real signing implementation before using run-level attestations in production-like hosts.
{
"_type": "https://stellaops.org/attestation/ai-run/v1",
"runId": "run-abc123",
"tenantId": "tenant-xyz",
"userId": "user@example.com",
"conversationId": "conv-abc123",
"startedAt": "2026-01-10T14:30:00Z",
"completedAt": "2026-01-10T14:40:00Z",
"model": {
"modelId": "gpt-4-turbo",
"modelVersion": "2024-04-09",
"provider": "azure-openai"
},
"promptTemplate": {
"templateId": "security-investigate",
"version": "1.2.0",
"digest": "sha256:..."
},
"context": {
"findingId": "f-456",
"cveId": "CVE-2024-1234",
"policyId": "policy-001",
"evidenceUris": [
"sbom://scan-789/lodash",
"reach://api-gateway:lodash.get"
]
},
"turns": [
{
"turnId": "turn-001",
"role": "User",
"contentDigest": "sha256:...",
"timestamp": "2026-01-10T14:30:05Z"
},
{
"turnId": "turn-002",
"role": "Assistant",
"contentDigest": "sha256:...",
"timestamp": "2026-01-10T14:30:08Z",
"claims": [
{
"text": "CVE-2024-1234 is reachable through...",
"groundingScore": 0.92,
"groundedBy": ["reach://api-gateway:lodash.get"],
"verified": true
}
]
}
],
"overallGroundingScore": 0.89,
"artifacts": [
{
"artifactId": "art-001",
"type": "EvidencePack",
"contentDigest": "sha256:..."
}
]
}
Attestation Verification
POST /api/advisoryai/v1/advisory-ai/attestations/verify uses VerifyAttestationRequest with runId, not a runId path segment. Operate/admin authorization and the stored record’s claim tenant are checked. The result is AttestationVerificationResponse with isValid/digestValid/signatureValid and record/key/error/time metadata. Invalid, absent or foreign records return 400; no configured key or live verification is inferred from publication.
UI Guide
Run Timeline View
The Run Timeline component provides a visual representation of all events:
+------------------------------------------------------------------+
| Run: run-abc123 [Active] |
| Started: Jan 10, 2026 14:30 |
+------------------------------------------------------------------+
| |
| o Run Created 14:30:00 |
| | Run initialized from conversation conv-abc123 |
| | |
| o User Turn 14:30:05 |
| | user@example.com |
| | "Is CVE-2024-1234 exploitable in our environment?" |
| | |
| o Assistant Turn 14:30:08 |
| | assistant |
| | "Based on the reachability analysis [reach:api-gateway:...]" |
| | Grounding: 92% |
| | |
| o Action Proposed 14:30:09 |
| | [Accept Risk] [Create VEX] [Escalate] |
| | |
| o Artifact Created 14:35:00 |
| Evidence Pack: CVE-2024-1234 |
| |
+------------------------------------------------------------------+
| Artifacts (1) |
| +----------------------------+ |
| | Evidence Pack | |
| | CVE-2024-1234 Evidence Pack| |
| | sha256:def456... | |
| +----------------------------+ |
+------------------------------------------------------------------+
Key UI Components
| Component | Purpose |
|---|---|
RunTimelineComponent | Displays event timeline |
RunStatusBadge | Shows current Run status with color coding |
EventIcon | Icon for each event type |
ArtifactCard | Displays artifact with download link |
AttestationBadge | Shows attestation status and verification |
RunListComponent | Paginated list of Runs |
Status Colors
| Status | Color | Meaning |
|---|---|---|
| Created | Gray | Initialized, no activity |
| Active | Blue | In progress |
| PendingApproval | Yellow | Waiting for user action |
| Completed | Green | Successfully finished |
| Cancelled | Orange | User cancelled |
| Failed | Red | Error occurred |
Configuration
AdvisoryAI:
Runs:
Enabled: true
AutoCreate: true # Auto-create Run from first conversation turn
RetentionDays: 90 # How long to keep completed Runs
AttestOnComplete: false # Attestation requires an explicit signer-backed call
ReplayEnabled: true # Allow replay verification
Timeline:
MaxEventsPerRun: 1000 # Maximum timeline events per Run
ContentDigestAlgorithm: sha256
Artifacts:
MaxPerRun: 50 # Maximum artifacts per Run
MaxSizeBytes: 10485760 # 10 MB max artifact size
Error Handling
| Status Code | Error | Description |
|---|---|---|
| 400 | InvalidRequest | Malformed request body |
| 401 | Unauthorized | Missing or invalid token |
| 403 | Forbidden | Insufficient permissions for tenant/run |
| 404 | RunNotFound | Run does not exist |
| 409 | InvalidStateTransition | Cannot transition Run to requested state |
| 429 | RateLimited | Too many requests |
| 500 | InternalError | Server error |
See Also
Last updated: 10-Jan-2026
