This is an example of what the status update looks like for the agent:
--- STATUS UPDATE ---
Token Usage: 45,235/100,000 (45%)
Cost So Far: $0.23
Active Sub-Agents: 2
- sa_12345: Analyzing project structure and dependencies
- sa_67890: Implementing unit tests for compactHistory tool
Active Shell Processes: 3
- sh_abcde: npm test -- --watch packages/agent/src/tools/utility
- sh_fghij: npm run watch
- sh_klmno: git status
Active Browser Sessions: 1
- bs_12345: https://www.typescriptlang.org/docs/handbook/utility-types.html
Your token usage is high (45%). It is recommended to use the 'compactHistory' tool now to reduce context size.
--- END STATUS ---
Status updates are sent to the agent (every 5 interactions and whenever token usage exceeds 50%) to provide awareness of:
- Token Usage: Current usage and percentage of maximum context window
- Cost: Estimated cost of the session so far
- Active Sub-Agents: Running background agents and their tasks
- Active Shell Processes: Running shell commands
- Active Browser Sessions: Open browser sessions and their URLs
When token usage gets high (>70%), the agent is reminded to use the compactHistory
tool to reduce context size by summarizing older messages.
The agent can use the compactHistory tool like this:
{
name: "compactHistory",
preserveRecentMessages: 10,
customPrompt: "Optional custom summarization prompt"
}
This will summarize all but the 10 most recent messages into a single summary message, significantly reducing token usage while preserving important context.