Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
{
"id": "msg_auto_001",
"type": "message",
"role": "assistant",
"model": "claude-test-20260924",
"content": [
{
"type": "tool_use",
"id": "toolu_auto_001",
"name": "run_action",
"input": {"target": "sanitized-target"}
}
],
"stop_reason": "tool_use",
"usage": {"input_tokens": 12, "output_tokens": 8},
"safeguard_results": {
"decision": "allow",
"tool_use_id": "toolu_auto_001"
}
}