Human-in-the-Loop Review
Shannon’s Human-in-the-Loop (HITL) review system lets you review and refine an AI-generated research plan before the workflow begins executing. This is particularly valuable for deep research tasks where you want to steer the research direction, add constraints, or ensure the agent focuses on what matters most.What You’ll Learn
- How the HITL review cycle works (plan generation, feedback, approval)
- Enabling HITL review on task submission
- Interacting with the review API (get state, send feedback, approve)
- Optimistic concurrency control with version tracking
- SSE events emitted during the review cycle
- Python SDK usage for HITL review
- Configuration options and timeouts
Prerequisites
- Shannon stack running (Docker Compose)
- Gateway reachable at
http://localhost:8080 - Auth defaults:
- Docker Compose: authentication is disabled by default (
GATEWAY_SKIP_AUTH=1). - Local builds: authentication is enabled by default. Set
GATEWAY_SKIP_AUTH=1to disable auth, or include an API key header-H "X-API-Key: $API_KEY".
- Docker Compose: authentication is disabled by default (
How HITL Review Works
The HITL review cycle inserts a human checkpoint between task submission and research execution:Submit task with review enabled
Submit a research task with
require_review: true (or review_plan: "manual") in the context.AI generates initial research plan
The LLM service generates a research plan based on the query. The workflow pauses and waits for human input.
Review and provide feedback
You review the proposed plan via the review API. Send feedback to refine the plan iteratively (up to 10 rounds).
Approve the plan
Once satisfied, approve the plan. The workflow resumes and executes the confirmed research direction.
Architecture
Enabling HITL Review
Addrequire_review: true to the task context when submitting a research task:
HITL review requires
force_research: true because the review cycle is part of the ResearchWorkflow. Without it, the orchestrator may route the task to a different workflow that does not support review.review_plan: "manual" is also accepted and behaves identically. The desktop app uses require_review: true when the user disables auto-approve for deep research.
Retrieving Review State
After submission, poll for the review plan to become ready. The workflow generates an initial plan via the LLM and stores it in Redis.Response
ETag header containing the current version number, used for optimistic concurrency control.
| Field | Type | Description |
|---|---|---|
status | string | "reviewing" or "approved" |
round | int | Current conversation round (starts at 1) |
version | int | Monotonic version for concurrency control |
current_plan | string | The latest actionable plan (set when LLM intent is "ready") |
rounds | array | Full conversation history (role, message, timestamp) |
query | string | Original task query |
Sending Feedback
Refine the plan by sending feedback. The gateway forwards your message to the LLM, which generates an updated plan incorporating your input.Feedback Response
intent field indicates the LLM’s assessment:
"feedback"— the LLM is asking clarifying questions (no actionable plan yet)"ready"— the LLM has proposed an actionable research direction
ETag header.
Concurrency Control
TheIf-Match header (curl) or version parameter (SDK) enables optimistic concurrency. If another request modified the state since you last read it, the server returns 409 Conflict:
Round Limits
A maximum of 10 feedback rounds is enforced. At the final round, the LLM is instructed to produce a definitive plan. Beyond this limit, further feedback is rejected and you must approve:Approving the Plan
Once the plan looks good, approve it to resume the workflow:Approval Response
- The gateway sends a Temporal Signal to the waiting workflow
- The confirmed plan and review conversation are injected into the task context
- The ResearchWorkflow proceeds with the approved research direction
- SSE emits
RESEARCH_PLAN_APPROVED
SSE Events
The HITL review cycle emits dedicated SSE events that you can consume via the streaming endpoint:| Event Type | Description | Payload |
|---|---|---|
RESEARCH_PLAN_READY | Initial plan generated, waiting for review | round, intent |
REVIEW_USER_FEEDBACK | User feedback submitted | round, version |
RESEARCH_PLAN_UPDATED | Plan updated after feedback | round, version, intent |
RESEARCH_PLAN_APPROVED | Plan approved, research starting | — |
Configuration
Review Timeout
The workflow waits up to 15 minutes (default) for the review to complete. If no approval is received within this window, the workflow times out:review_timeout context parameter (in seconds):
Approval Workflow (separate feature)
Shannon also has a separate approval workflow for non-research tasks. This is configured infeatures.yaml and triggers based on complexity thresholds or dangerous tool usage:
POST /api/v1/approvals/decision) and is independent of the HITL research review. See the Approve Task API reference for details.
Python SDK Reference
The Shannon Python SDK provides dedicated methods for the HITL review cycle:Async SDK
Best Practices
Use version tracking
Always pass the
If-Match header (or version parameter in the SDK) to prevent race conditions. This is especially important when multiple users or tabs may interact with the same review.Set appropriate timeouts
The default 15-minute timeout works for most interactive use cases. For asynchronous review workflows (e.g., email-based approval), increase
review_timeout accordingly.Wait for intent: ready
Before approving, ensure the LLM has produced a plan with intent
"ready". Feedback rounds with intent "feedback" indicate the LLM needs more information.Combine with research strategies
HITL review works with all research strategy presets (
quick, standard, deep, academic). The approved plan guides the subsequent research execution.Troubleshooting
Review session not found (404)
Review session not found (404)
The review state is stored in Redis with a TTL of 20 minutes (review timeout + 5-minute buffer). If the review session expires, you will receive a 404 error. Re-submit the task to start a new review.
Conflict error (409) on feedback
Conflict error (409) on feedback
This means another request modified the review state since you last read it, or another feedback request is currently in progress. Re-fetch the current state with
GET /review, then retry with the latest version.Approval rejected: no research plan
Approval rejected: no research plan
The LLM has only asked clarifying questions (intent:
"feedback") and has not yet produced an actionable plan. Send at least one feedback message so the LLM generates a concrete research direction.Workflow timed out during review
Workflow timed out during review
The review took longer than the configured timeout (default: 15 minutes). Increase
review_timeout in the task context, or approve more quickly.