-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Title: Add HITL API router to expose review data and accept human decisions
Description
We currently create HITL review jobs in HITLNode (e.g., review_id, customer, safe variants, status). However, there is no dedicated API surface for the UI to:
- Fetch details for a given review (customer + variants + status)
- Submit a human reviewer decision (which variant is approved, optional notes)
This issue is to implement a simple HITL router in the backend so the front end can integrate with the human-in-the-loop flow.
Scope
Use the existing store (e.g., MemoryStore) where HITLNode saves reviews under keys like hitl:{review_id}.
Expose endpoints to:
- Get HITL review payload by review_id
- Submit human decision for review_id (approved variant, notes)
Proposed implementation
Extend HITLNode (if not already)
Ensure HITLNode.run(customer, safe_variants) saves the following structure in the store:
{
"customer": {...},
"variants": [...],
"status": "pending_human_approval"
}
Uses key pattern:
hitl:{review_id}
Create new router: backend/app/routers/hitl.py
GET /hitl/{review_id}
- Loads
store.get(f"hitl:{review_id}") - Returns
{ customer, variants, status, ... } - Returns 404 if review is not found
POST /hitl/{review_id}/decision
Request body (Pydantic model):
{
"approved_variant_id": "A",
"notes": "optional free text"
}
Backend logic:
- Load
hitl:{review_id} - Update:
status = "approved"approved_variant_idnotes
- Save updated object back to store
Register router in app/main.py
Add:
from .routers.hitl import router as hitl_router
app.include_router(hitl_router)Acceptance Criteria
GET /hitl/{review_id} returns:
customervariantsstatus
POST /hitl/{review_id}/decision:
- Updates review with:
status="approved"approved_variant_idnotes
Additional Criteria
- Both endpoints visible and testable in Swagger (
/docs) - End-to-end flow works:
Trigger orchestration
→ HITLNode creates review
→ review is fetchable via GET /hitl/{review_id}
→ decision is submitted via POST /hitl/{review_id}/decision
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Todo