Skip to main content

C-15 Execution Replay

Brick C: Agents, autonomy, execution. French version: C-15-execution-replay

1. Role and responsibilities​

Rebuilds a run from traces and checkpoints for audit, debugging and regression evaluation.

  • Return the sequence of steps and decisions
  • Simulated replay (tools replaced by their recorded outputs)

2. Position in the architecture and interactions​

  • Callers: Auditors, Evaluation (brick G).
  • Execution path: Synchronous read.
  • Every interaction goes through the Control Plane API v1 (/v1) behind the API Gateway (D-14).

3. Open source component and developed part​

  • Open source: OpenTelemetry, Opik
  • Developed: Assembly of steps + checkpoints + spans.
  • External integration through an adapter eai/integrations/<system>.py with an in-process fallback when the URL is not configured.

4. Data model​

Tables (schema eai, tenant_id RLS):

  • eai.run_steps
  • eai.checkpoints

Common columns: id uuid, tenant_id uuid NOT NULL, created_at, updated_at; RLS policy current_setting('app.tenant_id', true)::uuid.

5. Contract​

  • Applied contract: execution-contract
  • JSON Schema: contracts/v1/execution-contract.schema.json
  • Key fields: steps[], trace
  • Validation: POST /v1/contracts/{name}/validate; manifest apply: POST /v1/manifests/apply.

6. API endpoints​

  • GET /v1/runs/{id}/replay
  • GET /v1/runs/{id}/steps

Request GET /v1/runs/{id}/replay:

{}

Response:

{
"run_id": "run_01J9",
"steps": [
{
"index": 0,
"kind": "model_call"
},
{
"index": 1,
"kind": "tool_call",
"name": "jira.search"
}
],
"checkpoints": [
"chk_0040",
"chk_0042"
],
"trace_id": "4bf92f35..."
}

7. SDK examples​

Python:

from enterprise_ai import EnterpriseAI

client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_xxx_secret")
replay = client.runs.replay("run_01J9")

TypeScript:

import { EnterpriseAI } from "@enterprise-ai/sdk";

const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY });
const replay = await client.runs.replay("run_01J9");

Java:

EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.build();
Replay replay = client.runs().replay("run_01J9");

Go:

c, _ := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")))
replay, _ := c.Runs.Replay(ctx, "run_01J9")

8. Configuration​

  • Environment variables: EAI_OPIK_URL, EAI_DATABASE_URL
  • Helm values keys: controlPlane.config, controlPlane.secrets

9. Security controls​

  • auditor or developer role; content redacted according to clearance
  • Every request carries the tenant resolved from the credential; PostgreSQL RLS
  • Every mutation and policy decision writes a hash-chained audit event

10. Observability​

  • Prometheus metrics: eai_replays_total
  • Traces: OpenTelemetry spans with GenAI semantic conventions (gen_ai.operation.name, gen_ai.agent.id, gen_ai.tool.name), attributes eai.tenant_id, eai.run_id, traceparent propagation.
  • Audit actions:

11. FinOps units​

  • Read only; simulated replay without real model calls.
  • Emitted as Usage Event (POST /v1/finops/usage) with tenant, project, agent and run.

12. Failure modes and resilience​

  • Missing checkpoint: partial replay flagged
  • Normalized errors (error envelope, message_i18n en/fr)

13. Standalone adoption (client of a client)​

  • enterprise_ai.agent.
  • SDK: enterprise_ai.agent (AgentsClient, RunsClient, SessionsClient)
  • Minimal deployment: Helm chart with controlPlane.enabled=true and PostgreSQL; disabled external components use their in-process fallback.

14. Acceptance tests​

  1. Replay returns every step in order
  2. Cross-tenant access refused
  3. Error returned in fr with Accept-Language: fr