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:
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_id
notes
- 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:
POST /hitl/{review_id}/decision:
- Updates review with:
status="approved"
approved_variant_id
notes
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
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:
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:
Proposed implementation
Extend HITLNode (if not already)
Ensure
HITLNode.run(customer, safe_variants)saves the following structure in the store:Uses key pattern:
Create new router:
backend/app/routers/hitl.pyGET
/hitl/{review_id}store.get(f"hitl:{review_id}"){ customer, variants, status, ... }POST
/hitl/{review_id}/decisionRequest body (Pydantic model):
Backend logic:
hitl:{review_id}status = "approved"approved_variant_idnotesRegister router in
app/main.pyAdd:
Acceptance Criteria
GET
/hitl/{review_id}returns:customervariantsstatusPOST
/hitl/{review_id}/decision:status="approved"approved_variant_idnotesAdditional Criteria
/docs)