Older documentation. Start with the current guides.

Execution Contract

Execution contract

This is the Stage 1 contract matrix tracked by #5044. It describes v6 as it exists; it does not promise exactly-once effects or pre-approve a v7 API. An invocation succeeding means its local boundary completed, not that an external business effect is proven.

Boundary matrix

BoundaryExecution and state ownerRetry ownerCompletion and cancellationPersistence and recoveryKnown gap / decision
Direct service RPCClient and service handlerCaller/client wrappersRPC response or error; the request context carries cancellationNone in the core RPC contractEffects require an application idempotency key or reconciliation. No v7 break is required.
Direct agent AskAgent harnessAgent/model provider according to their configured limitsA response completes the run; errors are classified; context cancellation cancels active workOpt-in checkpoint records run, tool results, and stage; Resume is explicitProviders may still own tool iteration. Moving all iteration to the harness is a v7 break.
Streaming agent requestAgent harness and stream producerSame as direct agent executionTerminal event/error closes the stream; context or disconnected consumer cancels active deliveryCheckpoint and ResumeStreamAsk use the same run identity when configuredA single provider event contract is a v7 target.
Durable agent approval/inputAgent harnessThe resumed run; approval itself is not retriedWaiting is a distinct paused error; denial and cancellation are not successThe pause and exact tool call are saved before returning; resume requires the run and approval/input identityKeep and strengthen in v6. Hosts must use persistent storage for restart recovery.
Prompt-driven flowFlow plus model providerProvider/model behaviorExecute returns reply or error; context cancellation is an errorNo ordered-step checkpoint boundaryRoute adaptive tool use through the agent harness in v7; retain plain model transformations.
Ordered flow stepsFlow runnerFlow/step retry policyEach step is done or failed; cancellation is currently represented as failure metadataA shared run record saves completed steps; explicit Resume reuses themAdd a distinct cancelled/exhausted outcome compatibly where possible.
Agent-dispatch flow stepFlow owns step order; child agent owns adaptive workFlow retries dispatch; agent owns its internal retriesRPC success completes the parent step; child run ID records lineageParent and child checkpoint independentlyPrevent nested retries from multiplying effects; initially a v6 documentation/configuration fix.
Flow loopFlow step owns the whole loopLoop body and enclosing step policiesReaching LoopMax currently returns the latest state as successOnly the enclosing step is checkpointed, so restart can repeat iterationsPersist progress and report exhaustion distinctly. Record-shape/outcome changes may require v7.
Broker-triggered flowBroker callback invokes the flowBroker-specific redelivery plus flow retryThe handler currently acknowledges by returning nil even when execution failsFlow checkpoint can preserve ordered work, but acknowledgment is not tied to durable acceptanceDefine acknowledgment after durable acceptance and deduplicate triggers; likely v7 for a portable broker contract.

Identity and outcome vocabulary

Persisted status strings in v6 remain running, waiting, done, and failed for compatibility. Cancellation and exhaustion can first be exposed through error-kind metadata; a stored schema change requires versioning and migration.

Decision record

  1. Flows own predefined order; agents own adaptive tool selection. Plain service steps and model transformations remain available.
  2. The boundary that schedules a retry owns its budget. A parent must not assume a child call is effect-free; retries need an idempotency key or an explicitly safe operation.
  3. Save before acknowledging durable acceptance. Broker delivery must not be acknowledged merely because execution was attempted.
  4. Checkpoints prove recorded progress, not exactly-once effects. Ambiguous external work is reconciled by the capability owner.
  5. Service-only applications remain first-class. Shared outcome types must not introduce model or agent dependencies into RPC, registry, or broker APIs.

Compatibility decisions

Suitable for v6

Reserved for v7 unless proved otherwise

The next gate is an executable fixture that restarts at each boundary, preserves waiting state and lineage, injects duplicate/concurrent resume, models an ambiguous effect, exhausts a budget, and proves an idempotent final operation is not duplicated.