langgraph_agent_toolkit.agents.components.middlewares.sanitize_history module
Middleware that removes incomplete tool calls before model calls.
- class langgraph_agent_toolkit.agents.components.middlewares.sanitize_history.SanitizeHistoryMiddleware[source][source]
Bases:
AgentMiddlewareRepair tool-call and tool-result pairs before each model call.
Remove tool calls without results. Remove tool results without matching calls. The middleware changes only the messages sent to the model.