Agent and prompt — any runtime (native, plugin, CLI) executes the same context.
Quick Start
1
Simple Usage
Inspect what the agent will send on the next turn:
2
With Configuration
Run the same context through a custom harness:
How It Works
Key imports:
PreparedTurnContext, default_context_builder, RuntimeMode, DeliveryChannels.
Tool Resolution
build_context(agent, prompt, tools=…) resolves tools from the kwarg first, then the agent:
Configuration Options
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.Disable tools with an empty list, not None
Disable tools with an empty list, not None
tools=None (or omitting the kwarg) uses agent.tools. Pass an explicit empty list to run a turn with no tools.Related
Runtime Selection
Model-scoped runtime configuration
Streaming
Stream agent output token-by-token

