Skip to content

feat(orchestration): implement human-in-the-loop interrupts and resume workflow (#296) - #332

Open
Uzmaa7 wants to merge 4 commits into
codeforstartups:developmentfrom
Uzmaa7:feat/hitl-interrupts
Open

Uzmaa7 wants to merge 4 commits into
codeforstartups:developmentfrom
Uzmaa7:feat/hitl-interrupts

Conversation

@Uzmaa7

@Uzmaa7 Uzmaa7 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Description

Implements human-in-the-loop (HITL) interrupt and resume capabilities for agent orchestration. It allows pausing an agent run awaiting external human input/approval and resuming execution with the human decision.

Related issue

Fixes #296

Changes

  • Introduced interrupt() primitive to pause execution and record step state.
  • Implemented resume() and aresume() APIs on agents to inject human input and continue execution.
  • Added support for state serialization to survive restarts via checkpointer context.
  • Added comprehensive unit and integration tests covering HITL interrupt triggers, payloads, and execution resumption.

Testing

  • Tests pass locally (pytest tests/test_hitl_interrupts.py — 3 passed, full suite pytest — 820 passed)
  • Ruff checks pass
  • Documentation updated, if applicable

Checklist

  • My changes are focused and relevant to this pull request.
  • I have added or updated tests where appropriate.
  • I have reviewed my changes for unrelated modifications.
  • I have updated documentation where necessary.

@Uzmaa7

Uzmaa7 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@codeforstartups All CI checks (tests across Python 3.9, 3.11, 3.12, and typecheck) are passing cleanly. The PR is ready for review!

@codeforstartups

Copy link
Copy Markdown
Owner

Thanks @Uzmaa7 — the HITL interrupt design itself is excellent and exactly what #296 needs: the interrupt() helper + NodeInterrupt, run/arun returning termination_reason="interrupted" with an interrupt_payload, and resume/aresume to inject the human decision and continue — with sync + async tests. I'd love to merge that.

I can't merge this PR as it stands, though, because the diff is 94 files / +1559 / −956 and reaches far beyond the feature — it rewrites tools/build_docs.py (+526), the entire test suite, benchmarks/, examples/, the integrations/, and every chat/ file. Two problems with that:

  1. It would revert recently-merged work. This branch is based on test: cover non-filterable text mirror provisioning #327, so it predates everything that landed today — feat(agents): add tool registry and built-in connectors #328 (tool registry + a big agents/react.py refactor into helpers), feat(chat): implement true real-time async streaming (astream) for OpenAI and Anthropic #329 (true async astream + tests), feat(dynalogs): structured logs per-run / per-node with secret redaction (#300) #333 (structured logging), feat(dynaflow): built-in node library and graph execution pipeline (#283) #337 (node library), docs: add ecosystem overview page to docs site (#312) #325/test: cover non-filterable text mirror provisioning #327 (docs). Its versions of react.py, test_chat_models.py, build_docs.py, etc. would overwrite those. (GitHub now marks the PR CONFLICTING for the same reason.)
  2. Scope/reviewability. A HITL feature touching build_docs.py, benchmarks and examples can't be reviewed as one unit.

Could you rescope it to just the interrupt feature? Rebase onto latest development and keep only:

  • src/dynavec/exceptions.py — NodeInterrupt
  • src/dynavec/agents/base.py — interrupt()
  • src/dynavec/agents/react.py — the interrupt-catch + resume/aresume, re-applied on the new helper-based loop from feat(agents): add tool registry and built-in connectors #328 (_execute_loop / _process_tool_calls / _finalize_result now exist — your _execute_loop idea actually lines up well with that structure)
  • tests/test_hitl_interrupts.py
  • the README HITL section, if you want

Please drop the changes to build_docs.py, benchmarks/, examples/, integrations/, embeddings/, quantization.py, and the unrelated test files (likely an editor/formatter sweep that pulled in older versions). A focused ~4–5 file PR will sail through review + CI and I'll merge it quickly. Happy to help if the rebase onto the refactored loop is fiddly. 🙏

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Human-in-the-loop / interrupts

2 participants