ToolCallLimitState Class — langchain Architecture
Architecture documentation for the ToolCallLimitState class in tool_call_limit.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0c03aa0c_b7f2_82d5_07ef_07353ec548f1["ToolCallLimitState"] 4eaf9f24_fce9_0af1_80e1_f2e4f9935aeb["tool_call_limit.py"] 0c03aa0c_b7f2_82d5_07ef_07353ec548f1 -->|defined in| 4eaf9f24_fce9_0af1_80e1_f2e4f9935aeb
Relationship Graph
Source Code
libs/langchain_v1/langchain/agents/middleware/tool_call_limit.py lines 35–49
class ToolCallLimitState(AgentState[ResponseT]):
"""State schema for `ToolCallLimitMiddleware`.
Extends `AgentState` with tool call tracking fields.
The count fields are dictionaries mapping tool names to execution counts. This
allows multiple middleware instances to track different tools independently. The
special key `'__all__'` is used for tracking all tool calls globally.
Type Parameters:
ResponseT: The type of the structured response. Defaults to `Any`.
"""
thread_tool_call_count: NotRequired[Annotated[dict[str, int], PrivateStateAttr]]
run_tool_call_count: NotRequired[Annotated[dict[str, int], UntrackedValue, PrivateStateAttr]]
Source
Frequently Asked Questions
What is the ToolCallLimitState class?
ToolCallLimitState is a class in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/tool_call_limit.py.
Where is ToolCallLimitState defined?
ToolCallLimitState is defined in libs/langchain_v1/langchain/agents/middleware/tool_call_limit.py at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free