Previously used before_model which returned {"messages": patches}, causing
LangGraph's add_messages reducer to append patches at the end of the message
list. This resulted in invalid ordering (ToolMessage after a HumanMessage)
that LLMs reject with tool call ID mismatch errors.
Switch to wrap_model_call/awrap_model_call to insert synthetic ToolMessages
immediately after each dangling AIMessage before the request reaches the LLM,
without persisting the patches to state.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| agents | ||
| community | ||
| config | ||
| gateway | ||
| mcp | ||
| models | ||
| reflection | ||
| sandbox | ||
| skills | ||
| subagents | ||
| tools | ||
| utils | ||
| __init__.py | ||