Skip to content

Understand Yielded Agent

The runtime model

An Agent Definition describes behavior. A Thread owns the conversation. A durable host accepts input and advances it under one process owner; your application supplies authority, model services, and tool handlers.

Boundary Meaning
Thread An identified conversation shared across requests
Run One logical execution against that Thread
Attempt One scoped period trying to advance a durable Run
Turn One model request and response, followed by its tool batch if present

Additional submissions can join an active Run and settle with it. A process restart ends an Attempt. It need not end the Run or create a new Thread. The application routes each Thread to one owner on every backend. A shared database does not provide distributed takeover; stale results from a closed Attempt cannot commit.

Consider a travel assistant that searches, waits for booking approval, then answers. The receipt identifies accepted work; it does not mean the booking or Run has finished.

  1. Your application

    Authorize and submit input

    Keep caller identity and Thread access under host control.

  2. Yielded Agent

    Retain admission and return a receipt

    Accepted work remains owed until terminal settlement.

  3. Model and tools

    Produce a complete model response

    Application tools start after the response finishes.

  4. Yielded Agent

    Validate calls and obtain approvals

    A wait can close this Attempt; a later Attempt resumes the same Run.

  5. Model and tools

    Run authorized tools with bounded concurrency

  6. Yielded Agent

    Commit results, then continue or settle

    Results enter the conversation in declaration order. The next Turn sees the complete batch.

  7. Your application

    Observe the outcome and publish your reply

Approval and visibility callbacks run only when configured; built-in allow-all authorization needs no host callback.

Steering enters between complete turns; follow-up input enters when the Run would otherwise stop. Neither rewrites a tool already executing. Opt-in model-call restart can consume joined input earlier only while the call remains disposable.

History, recovery, and model context. The durable host uses current Run state to recover work. The append-only log supplies history, while context management selects a bounded view for the model.
  • Yielded Agent: Thread logConversation and committed outcomes
  • Yielded Agent: Current Run stateProgress and cumulative accounting
  • Yielded Agent: Model contextSelected history and compaction
  • Yielded Agent: Next AttemptResume selected work
  • Thread log to Model context
  • Current Run state to Next Attempt

The log is append-only. The active Run checkpoint is authoritative operational state, updated with new facts and removed at settlement. Open tool outcomes and delivery obligations can outlive that Run and retain their own state. Conversation projections and lookup indexes are rebuildable views. The host reuses validated continuation state and rechecks live budgets and authority before new work.

Recovery reconstructs saved model context from prompt-relevant history, checking its historyDigest and validating current Run evidence in full. Explicit verification also validates historical fields omitted from the prompt view.

Compaction changes what the model sees. Archiving changes where old records live. Neither resolves uncertain effects or gives a Run fresh budget. There is no lifetime record cap on the durable log; individual Runs, payloads, and live work remain bounded. Without compaction, loading and sending the model’s conversation still grows with its size.

Node hosts own scoped workers and recovery scans. Cloudflare Thread Objects use requests and alarms to resume eligible work; an idle recovery wake clears itself. Applications own reply delivery, query views, and optional memory processing. These have distinct obligations from running the model. Required custom publication can delay native execution; choose it deliberately.

Use durability for recovery guarantees, budgets for limits, and the Node or Cloudflare guide for runnable host composition.