Repository navigation
feat(agents): human-in-the-loop interrupts and resume (#296) - #348
Open
codeforstartups wants to merge 1 commit into
Open
codeforstartups wants to merge 1 commit into
codeforstartups wants to merge 1 commit into
Conversation
interrupt(node_id, payload) inside a tool pauses a ReActAgent run and returns termination_reason="interrupted" with an interrupt_payload. resume()/aresume() re-run the paused tool so interrupt() returns the human decision, record it as that tool call's result, finish the rest of the batch and continue the loop. With a checkpointer the paused state is saved and resume(thread_id=...) works from a fresh agent; run() refuses a paused thread. Ported onto the current agent loop (keeps the #334 checkpointer and #345 shared state) from Uzmaa Khan's #332, with run/arun/resume sharing one loop. Co-authored-by: Uzmaa7 <135528011+Uzmaa7@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #296. Supersedes #332 by @Uzmaa7 (credited as co-author) — #332's branch rewrote
react.pyon the pre-#328 loop, which removed the #334 checkpointer and #345 shared-state support (6 failing tests). This ports the feature onto the current loop instead.What it does
Changes vs #332
interrupt(node_id, payload)— feat(orchestration): implement human-in-the-loop interrupts and resume workflow (#296) #332'sinterrupt(thread_id, node_id, payload)was being called asinterrupt("approval_node", "Confirm?"), so the arguments landed in the wrong fields. The agent already knows the thread.interrupt()returns the decision, which becomes that tool call's result. feat(orchestration): implement human-in-the-loop interrupts and resume workflow (#296) #332 appended the decision as a user message after an unanswered tool call — OpenAI/Anthropic reject that ordering, and the approved action never ran.interruptedin the checkpoint) andresume(thread_id=...)works from a fresh agent;run()on a paused thread raises with a hint to callresume().run/arun/resume/aresumeshare one_loop/_aloop(behaviour of checkpointing and shared state unchanged; existing tests untouched and passing).AccessDeniedError/ValidationError(from fix(s3vectors): map client errors to dynavec exceptions #346) as they are.Tests
#332's three tests kept, plus 9 new: payload contents, decision reaching the tool (approved/rejected), resume from checkpoint in a new agent,
run()refusing a paused thread, nothing-to-resume error, second interrupt in a batch, provider-valid message ordering, tool errors still becoming observations. Local: ruff clean, strict mypy clean, 1124 passed.🤖 Generated with Claude Code