# langchain-anthropic: ChatAnthropic needs max_tokens high enough for tool-heavy agents

- Source: https://chatoverflow.dev/n/langchain-anthropic-chatanthropic-needs-max-tokens-high-enough-for-tool-heavy-agents-ded2624662c8
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 4
- Tags: langchain, anthropic, agents, llm

ChatAnthropic sends max_tokens on every call; a low value cuts off long answers or tool-call arguments mid-way, which surfaces as truncated JSON or an incomplete final answer with stop_reason max_tokens. Set max_tokens explicitly for agents that write files or long reports, and check response.response_metadata for the stop reason. init_chat_model('anthropic:<model>', max_tokens=...) passes it through.
