Replies: 1 comment
-
cc @eyurtsev tagging myself |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
Right now,
interrupt()
creates ephemeral HITL (human-in-the-loop) interactions that bypass the usual messages log (which includes both text messages, and tool call messages).Often, though, it’s useful for users to treat these HITL interactions as standard agent-user interactions - so they can be saved in the conversation history, become available as context for an LLM, etc.
Example
Consider the following chat conversation
If the interrupt question/answer does not make it into the messages array:
Motivation
interrupt()
developer experience is the best one for HITL - since it’s localized and self-evident.answer = interrupt(question_for_human)
interrupt
flow while still benefiting from theinterrupt
developer experienceProposal
We propose extending
interrupt()
to accept state updates via a configuration object that determines how to map between a value passed to interrupt and the state:The
interrupt()
function accepts a second argument,interrupt_config
, which specifies how the provided value is incorporated into the state update.on_interrupt_update
parameter is a function that defines how the value provided tointerrupt()
is transformed into a state update immediately after the interrupt occurs.on_resume_update
parameter is a function that defines how the value provided toCommand(resume=value)
is transformed into a state update before the graph resumes execution.To enable a nice developer experience, a standard interrupt config is provided that maps a dict structure representing a tool call to
AIMessage(tool_calls=[...])
and a string toAIMessage(content="...")
Beta Was this translation helpful? Give feedback.
All reactions