Skip to main content
Build one frozen turn plan from an Agent and prompt — any runtime (native, plugin, CLI) executes the same context.
The user sends a prompt; the runtime builds one shared PreparedTurnContext for the turn.

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:
Forwarding an optional tools: Optional[list] = None from a wrapper is safe — None and “not passed” are treated identically.

Configuration Options

STREAM and ASYNC_STREAM raise ValueError if delivery.has_streaming() is false.

Best Practices

Fields are frozen — mutate via hooks, not assignment.
Do not cache plans across turns in multi-agent setups.
It is a module-level singleton — no need to instantiate your own builder.
Enable DeliveryChannels(enable_streaming=True, ...) before choosing stream modes.
tools=None (or omitting the kwarg) uses agent.tools. Pass an explicit empty list to run a turn with no tools.

Runtime Selection

Model-scoped runtime configuration

Streaming

Stream agent output token-by-token