Oshun Platform · Architecture

Agentic run execution fields

A focused page within the Oshun Platform Architecture documentation. The full map and every sibling page live in the Architecture hub.

4sections3 minread1table

On this page

Current POST /v1/agentic/runs/execute persistence boundary. The route runs every plan through the governed boundary (runGovernedToolPlan): each reached tool call is grant-resolved through the capability broker, recorded as a pending attempt before dispatch, and then replaced by its authoritative outcome telemetry — ok, partial, error, or denied — carrying redacted arguments, the result or error, the resolved grant, tool-produced evidence, effects, and measured usage. Measured cost is charged to the run's ledger before the next admission, so a later tool is never admitted against a balance an earlier call already spent. Pause, cancel, and kill block later dispatch; kill and budget terminations are appended to the durable lifecycle store alongside the terminated envelope and the denied attempt. The reading rule for every consumer of this store: a persisted run is the authoritative record of what executed — every reached tool call is grant-resolved, recorded, charged, and persisted, and a field that has nothing to carry (a tool that produced no evidence) is an honest empty list, never a fabricated one.

Runtime sources#

  • apps/oshun/bff/src/agentic/runs-route.ts
  • apps/oshun/bff/src/agentic/run-lifecycle-store.ts
  • libs/oshun/agentic-studio/src/runs/governed-orchestrator.ts
  • libs/oshun/agentic-studio/src/runs/dispatcher.ts
  • libs/oshun/agentic-studio/src/runs/executor.ts

Exercised by#

  • apps/oshun/bff/src/agentic/runs-route.test.ts

Field contract#

Field Current producer Current behavior
status governed boundary, runs-route finalizer, or run control Refreshed at every tool boundary; pause/cancel/kill block later dispatch and a fully executed plan becomes completed.
completedAtUnixSeconds runs-route finalizer or terminal run control Populated for a completed or otherwise terminal run.
updatedAtUnixSeconds runs-route finalizer or terminal run control Populated when this route finalizes or terminates the envelope.
toolCalls runGovernedToolPlan A pending attempt is persisted before dispatch, then replaced by ok, partial, error, or denied telemetry with redacted arguments, result/error, grant, evidence, effects, and measured usage.
capabilityAuditTrail PortfolioCapabilityBroker through runGovernedToolPlan The complete immutable hash chain is retained with the run, including grant request/policy creation plus every use, result, denial, revocation, and attempted bypass reached by this execution.
evidenceTrail server-owned tool result observer through runGovernedToolPlan Real tool-produced evidence is appended to the call and the run trail; tools that produce no evidence retain an honest empty list.
costLedger runGovernedToolPlan measured-usage accounting Success, partial, error, retry, and denied policy charges update total, per-stage, per-tool, and category counters before the next admission; mutable budget meters consume the same measured category usage.
termination auditEvent admitToolCall/kill Kill/budget termination events are appended to the durable lifecycle store while the terminated envelope and denied attempt are persisted.

Claim boundary#

  • The legacy runGuardedToolPlan/dispatchGuardedToolCall primitive remains a lower-level seam and still does not manufacture telemetry; the executed route uses runGovernedToolPlan.
  • The lifecycle store preserves boundary-produced fields and control audit events; it does not fabricate tool evidence or usage.
  • toolCalls is write-ahead, not reconstructed: the pending attempt is persisted before dispatch and only then upgraded to its ok, partial, error, or denied outcome.
  • The capability audit trail is an immutable hash chain retained with the run — grant request and policy creation plus every use, result, denial, revocation, and attempted bypass this execution reached.

Contract: scripts/audit/machine-adjacent-doc-contract.json. Regenerate with pnpm generate:audit:machine-adjacent-docs.