Skip to content

tool_github schema exceeds Anthropic 200k token context limit #648

@joshuadarron

Description

@joshuadarron

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions