Skip to main content
Per-tool budgets cap how much of each tool’s output enters agent context — noisy tools get tighter limits, critical tools stay protected. The user caps noisy tool output; per-tool budgets truncate oversized results before they fill the context window.

How It Works

Quick Start

1

Enable context on the agent

2

Set per-tool budgets

3

Truncate output manually

How It Works

Each tool call checks get_tool_budget(tool_name) — falling back to default_tool_output_max when no per-tool rule exists. Protected tools skip pruning during context optimisation.

Configuration

Via ManagerConfig

Via environment

Methods

Truncated outputs are persisted to disk so the agent can retrieve them — see Tool Output Store.

CLI Usage

Best Practices

Web search and file reads return large payloads — cap them at 2,000–5,000 tokens so they do not crowd out conversation history.
Code tools often need full stack traces or build logs — 10,000+ tokens prevents losing error context mid-debug.
protected=True keeps a tool’s output from being pruned during context optimisation, even when the window is tight.
Run /context in chat or call get_stats() on the context manager to see which tools consume the most tokens.

Context Manager

Unified facade for budgeting, compaction, and monitoring.

Tool Output Store

Retrieve full outputs after truncation.