Docs navigation

Model provenance

Agent identity is permanent; model execution is replaceable. Every model call an agent makes — provider, exact model, hosting, cost, latency, and any fallback routing — is recorded as a model execution and appended to the agent's tamper-evident timeline. The agent keeps its trust score and audit history no matter which model runs underneath.

Record a model execution

Call recordModelExecution on a run handle (or the client) each time a model executes. Provider and model are free-form strings — unknown future providers ingest safely with no SDK update.

record-execution.ts
await run.recordModelExecution({
  provider: "anthropic",        // free string — any provider, present or future
  modelName: "claude-x",
  modelVersion: "2026-05",
  hostingType: "external_api",  // external_api | self_hosted | private_cloud | air_gapped
  hostingRegion: "us-west",
  inputTokens: 1200,
  outputTokens: 420,
  estimatedCostUsd: 0.31,
  latencyMs: 5400,
});

Fallbacks and routing decisions

ProofLedger doesn't route your model traffic — it observes and verifies routing decisions. Record what was requested, what was selected, and why; the fallback lands in the timeline as a model_fallback event.

record-fallback.ts
await run.recordModelExecution({
  provider: "glm",
  modelName: "glm-5",
  fallbackUsed: true,
  fallbackReason: "primary model timeout",
  routerDecision: {
    requested: "anthropic/claude-x",
    selected: "glm/glm-5",
    reason: "best approved model under cost threshold",
    constraints: { allowed_regions: ["us-west"], max_cost: 0.5 },
  },
  status: "success",
});

Model lifecycle events

Event typeMeaning
model_selectedA model was chosen for execution
model_fallbackFallback routing selected an alternative model
model_switchedThe agent switched models mid-task
model_failedThe model call failed
model_timeoutThe model call timed out
model_policy_blockedA model-level policy blocked the execution
model_region_blockedA region restriction blocked the execution

Note

Model events flow through the same hash-chained ingest pipeline as decisions and tool calls, so model switching is tamper-evident and visible in the runtime timeline. Model-level policies (hosting region, self-hosted requirements, cost thresholds) evaluate against the executing model, not the agent's default.

Sovereignty metadata and evidence levels

Enterprises need to know where an AI execution happened. Hosting and jurisdiction claims carry per-claim evidence levels — ProofLedger records evidence; it never asserts regulatory compliance.

evidence-levels.ts
await run.recordModelExecution({
  provider: "internal",
  modelName: "llama-derived-ft",
  selfHosted: true,
  openWeight: true,
  fineTuned: true,
  hostingRegion: "eu-central",
  // Per-claim confidence: observed | declared | verified
  evidence: { hostingRegion: "declared", selfHosted: "declared" },
});