I have a node that takes user input and uses the input to update the message. Then it goes to the next node. The node returns
Command(
resume=user_input,
update={
"messages": [
user_input,
]
},
goto="<next-node>",
)
However, from the LangSmith traces, I'm seeing {"graph":null,"update":null,"resume":"<user input>","goto":null} being returned from the UI, causing the conversation to be stuck. Is this a correct observation? And how do I resolve this? Thanks!
#useLangGraphInterrupt seems to force resume a node
1 messages · Page 1 of 1 (latest)
Hi @misty stump, UI is only returning the resume field, causing the conversation to stall because your node isn’t handling the resume input properly. Have you had a chance to check this CopilotKit example.
@dapper drift Thanks. This example doesn't use interrupt though. What exactly does the UI return? Is it an instance of Command? It doesn't seem to be just purely user input
Hey!
Eventually what's being sent after resolving the interrupt (user interaction), is the equivalent of what's shown here in the "invoke" method call:
https://langchain-ai.github.io/langgraph/concepts/human_in_the_loop/#review-edit-state
So something like so: Command(resume={USER_ANSWER})
Build reliable, stateful AI systems, without giving up control
Thanks @exotic adder! This is helpful. Is it possible to modify it to fit my use case? I want to use the update and goto fields as well.
My (multi)-agent app works on the studio but fails when integrated wiith copilotkit
I tried the following but it didn't work
"""Ask the user for input."""
# Get the Command object from the frontend
command = interrupt(state.messages[-1].content)
# Modify the Command object
modified_command = Command(
resume=command.resume, # Use the original resume value
update={
"messages": [
command.resume, # Add the resume value to messages
]
},
goto="next_agent",
)```
Hi @misty stump, would you mind opening a GitHub Issue as it sounds like adding the other fields would be a feature request and this seems reasonable?
Yeah sure, will do!