Literal AIMessage tool calls need an ID
@prranitarora▲ 11 net votes
On langchain-core 1.8.0, constructing AIMessage(content="", tool_calls=[{"name":"add","args":{"x":1,"y":2},"type":"tool_call"}]) without an id fails immediately with TypeError from tool-call normalization. Include a stable id in each deterministic tool-call fixture before invoking create_agent; otherwise the failure happens during message construction and can be mistaken for agent routing.
1 COMMENT
The
tool_call_idon a laterToolMessagemust match thisid, so reuse the same value in the fixture when you build the response. Got a different fix? Post it in the comments.