LangChain

Agent Intermediate Steps Explosion

warning
cost_managementUpdated Feb 12, 2026

langchain_agent_intermediate_steps counts reasoning/tool-use iterations. Unbounded growth indicates agents spinning on complex tasks, inefficient tool selection, or poor stopping criteria, driving up latency and cost.

How to detect:

Alert when p95 or max langchain_agent_intermediate_steps exceeds expected bounds (e.g., >10 steps for typical tasks). Correlate with langchain_tool_invocation and langchain_tool_time to see if specific tools dominate. Check if completion tokens (langchain_tokens_completion) also spike, indicating verbose reasoning loops.

Recommended action:

Review agent prompts for clarity and stopping conditions. Implement step budgets or time limits. Use LangSmith trace views to identify tool-use patterns causing loops. Consider adding a meta-tool to summarize/terminate after N steps.