Agent and prompt — any runtime (native, plugin, CLI) executes the same context.
Quick Start
How It Works
| Stage | What happens |
|---|---|
| Build | Resolves model, tools, transcript, delivery, correlation |
| Freeze | Context is immutable after construction |
| Execute | Any TurnRuntimeProtocol runs the same plan |
PreparedTurnContext, default_context_builder, RuntimeMode, DeliveryChannels.
Configuration Options
| Field | Type | Notes |
|---|---|---|
runtime_mode | RuntimeMode | SYNC, ASYNC, STREAM, ASYNC_STREAM |
delivery | DeliveryChannels | Required for streaming modes |
correlation | SessionCorrelation | session_id, turn_id, agent_id, run_id |
STREAM and ASYNC_STREAM raise ValueError if delivery.has_streaming() is false.
Best Practices
Treat context as read-only
Treat context as read-only
Fields are frozen — mutate via hooks, not assignment.
Build one context per turn
Build one context per turn
Do not cache plans across turns in multi-agent setups.
Reuse default_context_builder
Reuse default_context_builder
It is a module-level singleton — no need to instantiate your own builder.
Match runtime_mode to delivery
Match runtime_mode to delivery
Enable
DeliveryChannels(enable_streaming=True, ...) before choosing stream modes.Related
Runtime Selection
Model-scoped runtime configuration
Streaming
Stream agent output token-by-token

