Add Human-in-the-Loop (HITL) support in Lungo #348
+2,654
−2
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.
Description
This PR introduces a Human-in-the-Loop (HITL) system for the Lungo auction supervisor, enabling human oversight for high-stakes order decisions using LangGraph's
interrupt()capability.Overview
The HITL system uses two specialized models to determine when and how to involve humans in the decision-making process:
Key Features
New Files
Backend:
agents/supervisors/auction/graph/hitl.py- Model interfaces and mock implementationsagents/supervisors/auction/graph/graph_hitl.py- HITL-enabled LangGraph with interrupt nodesagents/supervisors/auction/api_hitl.py- REST endpoints for HITL workflow (/agent/prompt/hitl,/agent/prompt/hitl/resume)Frontend:
frontend/src/hooks/useHITLAPI.ts- React hook for HITL API interactionsfrontend/src/components/Chat/HITLScenarios.tsx- Scenario display and selection componentModified Files
agents/supervisors/auction/main.py- Include HITL routerfrontend/src/App.tsx- HITL state managementfrontend/src/components/Chat/ChatArea.tsx- HITL flow integrationfrontend/src/components/Sidebar/Sidebar.tsx- New "Human-in-the-Loop" navigation sectionfrontend/src/utils/patternUtils.ts- AddedPUBLISH_SUBSCRIBE_HITLpatternGraph Flow
Example Usage
Prompt:
I need to place our Q2 order. 500 lbs total, budget capped at $2,000. What are our options?The system:
Testing
Select "Human-in-the-Loop > A2A NATS (HITL)" in the sidebar and try the example prompt above.