Lead Review
How a Lead Agent gates a worker's complete_task handoff, what REST and hosted MCP return, and how approved output is delivered.
Lead Review
Lead Review withholds a worker turn after that turn calls complete_task, and it blocks further external messages while a review is already open. Assigning a lead does not hide ordinary replies. A turn that never calls complete_task returns the assistant text.
Public list and get payloads do not include leadAgentId or leadReviewConfig. There is no public REST, SDK, or hosted MCP read for a work item.
Configuration
A worker stores leadAgentId and leadReviewConfig:
| Field | Values |
|---|---|
completionPolicy | completeAutomatically or requestHumanApproval. Default requestHumanApproval. |
maxRevisionRounds | Integer from 1 to 5. Default 3. |
Saving this in Action Agent Studio requires agent:update. The worker cannot be its own lead. An inactive or deleted lead is rejected at save time. A worker whose organization preset already has a lead cannot set its own.
Resolution is preset-first. An organization preset with a lead is the reviewer, and the worker columns are ignored. A platform preset does not carry an organization lead, so the worker columns apply. See Presets.
completionPolicy is stored on the work item and shown on the review detail. The verdict commit path does not branch on it. Human review happens when the item reaches awaitingHuman, or when an approved delivery is ambiguous.
When a turn is gated
One active work item exists per worker session.
- The first external message is stored, truncated to 50,000 characters, as the task context.
- Further messages while the item is
inProgressare appended. - An
inProgressitem idle for 7 days moves toabandoned. - Any other non-terminal status rejects the new message with
LEAD_REVIEW_PENDING.
Terminal statuses are completed, rejected, failed, cancelled, and abandoned. approved is not terminal. It becomes completed after a successful internal delivery.
complete_task is available only while the trusted turn context matches an inProgress work item. The model supplies summary only: non-empty, at most 2,000 characters. A pending completion signal withholds the assistant text and stores that message as leadGated. Visible transcript reads skip leadGated rows. If the signal read fails, the text is withheld. If there is no signal, the reply is returned and then screened by the organization output policy when that stage has rules.
After the turn, a complete signal moves the item to reviewQueued and queues a Lead review. The submission snapshot is at most 100,000 characters. Incomplete provenance moves the item to awaitingHuman.
REST
Permission to send is agent:trigger. Review permission is not required to send.
Non-streaming POST /v1/chat/completions:
| Case | Response |
|---|---|
No lead, or a lead-enabled turn with no complete_task signal | 200 chat.completion with the assistant text |
Gated complete_task | 409, OpenAI envelope, type: "lead_review_pending", code: "LEAD_REVIEW_PENDING", message This turn is pending Lead review. Retry after the review completes. workItemId and revision are present and null. |
Work item already not inProgress | The same 409 code and message. workItemId and revision are omitted. |
Streaming (stream: true):
- A busy intake fails before the stream and uses the same
409. - A gated turn is OpenAI SSE: an opening assistant role chunk with empty content, no text deltas, then
finish_reason: "stop"anddata: [DONE]. The stream carries noworkItemId. - A mid-stream runtime error is one
data: {"error": ...}frame and no[DONE].
The OpenAI chat route does not emit a review-status event. That event belongs to a separate public SSE format.
Do not poll a work item from the public API. No public route returns one. Retrying while the item is not inProgress is another 409.
Hosted MCP
send_action_agent_message uses the same non-streaming wait path.
A gated turn is a successful tool result:
{
"success": true,
"result": {
"leadReviewPending": true,
"text": "",
"revision": null,
"workItemId": null
}
}A busy intake is a tool error. The public text is The operation could not be completed. Try again. It does not include LEAD_REVIEW_PENDING.
Channel triggers use the same wait path. A gated or busy turn does not post an immediate channel reply. A turn with no completion signal is posted as usual.
Review, delivery, and ActionFlows
agent:review is granted to Owner, Admin, and Member. It gates the Lead Reviews queue, the review detail, approve, reject, return, cancel, delivery recovery, and the dashboard operator tools. Those operator tools are not on the public hosted MCP server.
The actionable queue is status awaitingHuman, or status approved with a gating delivery in deliveryUnknown. Agent Activity links those rows to the review detail. It does not render the approved text. reviewQueued and reviewing are outside that filter.
The Lead model sees a server-built envelope and three tools: submit_lead_review, inspect_lead_messages, and inspect_lead_artifacts. It does not receive HTTP, MCP, Knowledge, database tools, or a nested lead. Verdicts are approved, changesRequested, and escalated. Up to 4 lead executions run per attempt. The review lease is 20 minutes.
Human decisions require status awaitingHuman:
| Action | Required text |
|---|---|
| Approve | None |
| Reject | A reason, at most 2,000 characters |
| Return to the worker | Feedback, at most 10,000 characters. This adds one extra revision allowance. |
Approved output:
apiand Action Agent Studio reveal the stored assistant message in the transcript. The original HTTP call does not receive a second body. On success the work item moves fromapprovedtocompleted.- Slack, Discord, Teams, and email post the approved snapshot, or the summary when the snapshot is empty, through the active trigger binding. A silent binding does not post.
scheduledis marked sent without a channel message.- A recorded ActionFlow continuation is not delivered by this outbox.
An Action Agent node whose worker has a resolved lead does not return immediately. It registers a continuation, dispatches the prompt, then pauses the Flow. The stored node output is { data: {}, success: true }. Run history status is waitingForHitl. No HITL request is created. The run event is Flow run is waiting for Lead review.
Resume starts a new Flow run from the pause snapshot and continues after the agent node. The approved summary stays on the continuation row. It is not copied into the node output. See Cloud Action Agents.