Rendering
Budget
Render-time character budgets — the only place the platform cuts content.
Usage
Budget(
turn_chars=700,
tool_chars=1500,
)Every cut appends an ellipsis marker carrying the omitted-character count, so a reader always knows how much is missing.
Attributes
turn_chars: int-
Budget for each prose chunk of a rendered turn.
tool_chars: int- Budget for each content piece of a rendered tool call.
render_tool_call()
Render a typed tool call, clipping each content piece to the tool budget.
Usage
render_tool_call(call, *, budget)The single tool-input renderer: Edit renders the path plus - old / + new lines, MultiEdit renders every span under an edit i/n marker, Write renders the path plus content, Bash renders the command, and everything else renders the tool name with its full compact-JSON input.
Example
>>> render_tool_call(parse_tool_call("Bash", {"command": "ls"}), budget=Budget())‘ls’
render_turn()
Render one turn: the prompt, assistant prose, and every tool call, in order.
Usage
render_turn(turn, *, budget)Prose chunks clip to budget.turn_chars; each tool call renders via render_tool_call() under budget.tool_chars.
render_session()
Render every turn of a session under budget, separated by blank lines.
Usage
render_session(activity, *, budget)