Overview
The HITL (Human-in-the-Loop) review API provides endpoints for reviewing, refining, and approving AI-generated research plans before execution begins. These endpoints interact with the review state stored in Redis and coordinate with the Temporal workflow via gRPC signals. For a tutorial on using the HITL review system, see Human-in-the-Loop Review.Authentication
Required: Yes Include API key in header:Get Review State
Description
Returns the current review conversation state for a workflow. Use this to retrieve the initial research plan and track the review cycle.Path Parameters
Headers
Response
200 OK
Response Fields:
401 Unauthorized
403 Forbidden
404 Not Found
Example
Submit Feedback
Description
Sends feedback to refine the research plan. The gateway forwards the feedback to the LLM service, which generates an updated plan incorporating the user’s input. The conversation round and version are incremented. A distributed Redis lock prevents concurrent feedback requests from racing during the LLM call.Path Parameters
Headers
Body Parameters
Request Body
Response
200 OK
Response Fields:
400 Bad Request
404 Not Found
409 Conflict
Version mismatch:502 Bad Gateway
LLM service unavailable:Example
Approve Plan
Description
Approves the current research plan, unblocking the workflow to proceed with execution. The gateway sends a Temporal Signal to the waiting workflow, injecting the confirmed plan and review conversation into the task context.Path Parameters
Headers
Body Parameters
Request Body
Response
200 OK
400 Bad Request
No plan available to approve:409 Conflict
Version mismatch:502 Bad Gateway
Example
Behavior Notes
- Redis TTL: Review state is stored in Redis with a TTL equal to the review timeout plus a 5-minute buffer (default: 20 minutes). After expiry, the review session is no longer accessible.
- Maximum rounds: 10 feedback rounds are permitted. At the final round, the LLM is instructed to produce a definitive plan. Beyond this limit, only approval is accepted.
- Ownership: Only the user who submitted the task can access its review state (enforced via
owner_user_idstored in Redis). - Concurrency: Both feedback and approval acquire a distributed Redis lock. If a feedback request is in progress (holding the lock), approval will fail fast with 409.
- SSE events: The review cycle emits
RESEARCH_PLAN_READY,REVIEW_USER_FEEDBACK,RESEARCH_PLAN_UPDATED, andRESEARCH_PLAN_APPROVEDevents to the Redis event stream. These appear in the SSE stream and are persisted for session history. - Token tracking: LLM token usage during review (feedback rounds) is recorded via
RecordTokenUsagegRPC for accurate cost accounting.