Problem
Connecting tool_github to an agent causes the prompt to exceed Anthropic's 200,000 token context limit before the agent receives its first message.
Error:
Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error',
'message': 'prompt is too long: 206767 tokens > 200000 maximum'}}
Reproduction
Pipeline: agent_langchain (or agent_rocketride) + llm_anthropic (claude-sonnet-4-5) + tool_github + tool_http_request
Agent instructions are minimal (~14 short strings). The user question is a small JSON object. The token overflow comes entirely from the tool_github schema injection.
A second run without tool_github (same agent, same instructions, same LLM) measured 233k tokens — suggesting the schema may also be cached/accumulated across pipeline sessions.
Workaround
Remove tool_github and use tool_http_request with a URL whitelist (^https://api\.github\.com/.*) instead. Agent instructions specify each GitHub API call explicitly.
Suggestions
- Lazy-load tool schemas — only inject when the agent requests a specific operation
- Offer a slim/scoped mode for
tool_github that exposes a subset of endpoints
- Document the approximate token cost of each tool component so users can budget context
Problem
Connecting
tool_githubto an agent causes the prompt to exceed Anthropic's 200,000 token context limit before the agent receives its first message.Error:
Reproduction
Pipeline:
agent_langchain(oragent_rocketride) +llm_anthropic(claude-sonnet-4-5) +tool_github+tool_http_requestAgent instructions are minimal (~14 short strings). The user question is a small JSON object. The token overflow comes entirely from the
tool_githubschema injection.A second run without
tool_github(same agent, same instructions, same LLM) measured 233k tokens — suggesting the schema may also be cached/accumulated across pipeline sessions.Workaround
Remove
tool_githuband usetool_http_requestwith a URL whitelist (^https://api\.github\.com/.*) instead. Agent instructions specify each GitHub API call explicitly.Suggestions
tool_githubthat exposes a subset of endpoints