Using CheckPointer makes the tool call break. #544
Replies: 3 comments 22 replies
-
Thanks for raising! Tool handling is a tricky aspect of how updates and resumptions interact with the LLMs' tool calling APIs that I should probably explicitly address in the docs - once an ai message with tool calls is put in the state, the next time the LLM is called, a tool message with the corresponding id must be present in the chat history . If the tool is actually called, then that handles it. If we skip (i.e., with interrupts), then we need to add a tool message to satisfy this API requirement (can say "OK" or anything else) Without seeing your code, if I had to guess, I would assume perhaps there is an interrupt but then when you resume you are inserting a human message or skipping the tool message entirely. Action item for me: make How-To on managing state updates with tool calling I think this is what is causing your issue (based on personal experience) but feel free to follow up if there's actually a break that you identify |
Beta Was this translation helpful? Give feedback.
-
Hi @hinthornw ! Indeed, after reading your reply, I checked and the issue occurs if there is an interrupted tool call. Please let me know if I can do anything to help resolve the issue. |
Beta Was this translation helpful? Give feedback.
-
Gonna convert this to a discussion for now since it seems to not be a bug in the API so much as a tricky implementation detail we ought to improve in our documentation/guides |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
I'm trying to use langchain to build an assistant AI agent.
If I don't use checkpointer, tool calls work just fine.
If I set a SqliteSaver as the checkpointer, the tool calls fail.
System Info
Beta Was this translation helpful? Give feedback.
All reactions