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:


Run Lifecycle

Runs progress through defined states with explicit transitions:

Created -> Active -> PendingApproval -> Completed
                  \-> Cancelled
                  \-> Failed

States

StateDescriptionAllowed Transitions
CreatedRun initialized, no activity yetActive, Cancelled
ActiveConversation in progressPendingApproval, Completed, Cancelled, Failed
PendingApprovalAction requires user approvalActive, Completed, Cancelled
CompletedRun finished and content digest recorded; attestation remains an explicit signed step(terminal)
CancelledRun cancelled by user(terminal)
FailedRun 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                        |
+--------------------------------------------------+

API Reference

Create Run

Creates a new Run from an existing conversation.

POST /api/v1/advisory-ai/runs
Content-Type: application/json
Authorization: Bearer <token>
X-StellaOps-TenantId: <tenant-id>

{
  "conversationId": "conv-abc123",
  "context": {
    "findingId": "f-456",
    "cveId": "CVE-2024-1234",
    "component": "pkg:npm/lodash@4.17.21",
    "scanId": "scan-789",
    "sbomId": "sbom-xyz"
  }
}

Response (201 Created):

{
  "runId": "run-abc123",
  "tenantId": "tenant-xyz",
  "userId": "user@example.com",
  "conversationId": "conv-abc123",
  "status": "Created",
  "createdAt": "2026-01-10T14:30:00Z",
  "context": {
    "findingId": "f-456",
    "cveId": "CVE-2024-1234",
    "component": "pkg:npm/lodash@4.17.21",
    "scanId": "scan-789",
    "sbomId": "sbom-xyz"
  },
  "timeline": [],
  "artifacts": []
}

Get Run

Retrieves a Run with its complete timeline and artifacts.

GET /api/v1/advisory-ai/runs/{runId}
Authorization: Bearer <token>
X-StellaOps-TenantId: <tenant-id>

Response (200 OK):

{
  "runId": "run-abc123",
  "tenantId": "tenant-xyz",
  "userId": "user@example.com",
  "conversationId": "conv-abc123",
  "status": "Active",
  "createdAt": "2026-01-10T14:30:00Z",
  "completedAt": null,
  "context": { ... },
  "timeline": [
    {
      "eventId": "evt-001",
      "eventType": "RunCreated",
      "timestamp": "2026-01-10T14:30:00Z",
      "actor": "system",
      "summary": "Run created from conversation conv-abc123"
    },
    {
      "eventId": "evt-002",
      "eventType": "UserTurn",
      "timestamp": "2026-01-10T14:30:05Z",
      "actor": "user:user@example.com",
      "summary": "Is CVE-2024-1234 exploitable in our environment?",
      "relatedTurnId": "turn-001"
    },
    {
      "eventId": "evt-003",
      "eventType": "AssistantTurn",
      "timestamp": "2026-01-10T14:30:08Z",
      "actor": "assistant",
      "summary": "Based on the reachability analysis...",
      "details": {
        "contentDigest": "sha256:abc123...",
        "groundingScore": 0.92
      },
      "relatedTurnId": "turn-002"
    }
  ],
  "artifacts": [],
  "attestationDigest": null
}

Get Timeline

Returns paginated timeline events for a Run.

GET /api/v1/advisory-ai/runs/{runId}/timeline?limit=50&cursor=evt-050
Authorization: Bearer <token>
X-StellaOps-TenantId: <tenant-id>

Response (200 OK):

{
  "runId": "run-abc123",
  "events": [ ... ],
  "cursor": "evt-100",
  "hasMore": true
}

Get Artifacts

Lists all artifacts attached to a Run.

GET /api/v1/advisory-ai/runs/{runId}/artifacts
Authorization: Bearer <token>
X-StellaOps-TenantId: <tenant-id>

Response (200 OK):

{
  "runId": "run-abc123",
  "artifacts": [
    {
      "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"
      }
    }
  ]
}

Complete Run

Marks a Run as complete and records the deterministic run content digest. Attestation is a separate fail-closed step: RunService.AttestAsync requires a configured IRunAttestationSigner or registered IAiAttestationEnvelopeSigner, and it rejects missing, empty, unsigned, or placeholder signatures instead of persisting a mock attestation.

POST /api/v1/advisory-ai/runs/{runId}/complete
Authorization: Bearer <token>
X-StellaOps-TenantId: <tenant-id>

Response (200 OK):

{
  "runId": "run-abc123",
  "status": "Completed",
  "completedAt": "2026-01-10T14:40:00Z",
  "contentDigest": "sha256:xyz789...",
  "isAttested": false
}

Cancel Run

Cancels an active Run.

POST /api/v1/advisory-ai/runs/{runId}/cancel
Content-Type: application/json
Authorization: Bearer <token>
X-StellaOps-TenantId: <tenant-id>

{
  "reason": "Investigation no longer needed - issue resolved"
}

Response (200 OK):

{
  "runId": "run-abc123",
  "status": "Cancelled",
  "cancelledAt": "2026-01-10T14:35:00Z",
  "reason": "Investigation no longer needed - issue resolved"
}

Replay Run

Replays a Run for verification and determinism checking.

POST /api/v1/advisory-ai/runs/{runId}/replay
Authorization: Bearer <token>
X-StellaOps-TenantId: <tenant-id>

Response (200 OK):

{
  "runId": "run-abc123",
  "deterministic": true,
  "originalDigest": "sha256:abc123...",
  "replayDigest": "sha256:abc123...",
  "differences": []
}

Response (Non-deterministic):

{
  "runId": "run-abc123",
  "deterministic": false,
  "originalDigest": "sha256:abc123...",
  "replayDigest": "sha256:def456...",
  "differences": [
    "Turn 2: original=sha256:111..., replay=sha256:222..."
  ]
}

List Runs

Lists Runs with filtering and pagination.

GET /api/v1/advisory-ai/runs?userId=user@example.com&status=Active&limit=20
Authorization: Bearer <token>
X-StellaOps-TenantId: <tenant-id>

Query Parameters:

ParameterTypeDescription
userIdstringFilter by user
findingIdstringFilter by finding
statusstringFilter by status (Created, Active, PendingApproval, Completed, Cancelled, Failed)
sincedatetimeRuns created after this time
untildatetimeRuns created before this time
limitintegerPage size (default: 50, max: 100)
cursorstringPagination cursor

Response (200 OK):

{
  "runs": [ ... ],
  "cursor": "run-xyz",
  "hasMore": true
}

Evidence pack API create requests must attach truthful evidence item digests. A caller-provided digest must be a valid sha256:<64 hex> value; sha256:unknown is rejected. If a digest is omitted, the service computes a digest from normalized snapshot data only when snapshot data is present. Empty snapshot data without a caller digest is a bad request.


Timeline Event Types

The timeline captures all significant events during a Run.

Event TypeActorDescription
RunCreatedsystemRun initialized
UserTurnuser:{userId}User message added
AssistantTurnassistantAI response generated
ToolCallassistantAI invoked a tool (search, lookup, etc.)
ActionProposedassistantAI proposed an action
ApprovalRequestedsystemAction requires user approval
ApprovalGranteduser:{userId}User approved action
ApprovalDenieduser:{userId}User denied action
ActionExecutedsystemAction was executed
ActionFailedsystemAction execution failed
ArtifactCreatedsystemArtifact attached to Run
RunCompletedsystemRun completed and content digest recorded
RunCancelleduser:{userId}Run cancelled
RunFailedsystemRun 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:

TypeDescriptionUse Case
EvidencePackBundle of evidence supporting a decisionRisk acceptance, VEX justification
DecisionRecordFormal record of a security decisionAudit trail, compliance
VexStatementVEX statement draft or finalVulnerability disclosure
ActionResultResult of an executed actionRemediation tracking
ExplanationAI-generated explanationUser understanding
ReportGenerated report documentStakeholder 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

Runs can be replayed to verify determinism. This is crucial for:

Replay Requirements

For successful replay:

  1. Temperature = 0: No randomness in token selection
  2. Fixed seed: Same seed across replays
  3. Model match: Same model weights (verified by digest)
  4. Prompt match: Identical prompts (verified by hash)
  5. Context match: Same input context

Replay Results

ResultMeaning
deterministic: trueReplay produced identical output
deterministic: falseOutput differs (see differences array)

Common Divergence Causes

CauseDetectionResolution
Different modelModel version mismatchUse pinned model version
Non-zero temperatureParameter checkSet temperature to 0
Different seedSeed mismatchUse consistent seed
Prompt template changeTemplate version mismatchPin template version
Context orderingContext hash mismatchSort 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/v1/advisory-ai/runs/{runId}/attestation/verify
Authorization: Bearer <token>
X-StellaOps-TenantId: <tenant-id>

Response:

{
  "valid": true,
  "runId": "run-abc123",
  "attestationDigest": "sha256:...",
  "signatureValid": true,
  "contentValid": true,
  "verifiedAt": "2026-01-10T15:00:00Z"
}

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

ComponentPurpose
RunTimelineComponentDisplays event timeline
RunStatusBadgeShows current Run status with color coding
EventIconIcon for each event type
ArtifactCardDisplays artifact with download link
AttestationBadgeShows attestation status and verification
RunListComponentPaginated list of Runs

Status Colors

StatusColorMeaning
CreatedGrayInitialized, no activity
ActiveBlueIn progress
PendingApprovalYellowWaiting for user action
CompletedGreenSuccessfully finished
CancelledOrangeUser cancelled
FailedRedError 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 CodeErrorDescription
400InvalidRequestMalformed request body
401UnauthorizedMissing or invalid token
403ForbiddenInsufficient permissions for tenant/run
404RunNotFoundRun does not exist
409InvalidStateTransitionCannot transition Run to requested state
429RateLimitedToo many requests
500InternalErrorServer error

See Also


Last updated: 10-Jan-2026