/sessions/<id> in agentuse serve: it shows the run log, and when the session is suspended on an approval gate it also offers approve / reject / comment right there. /approvals remains as a filtered list of sessions currently waiting for review, and each row links to the session page. Slack is optional: it can notify reviewers and link them into the session page, but Slack is not where approval state lives.
How It Works
- Add
approval: trueto the agent frontmatter. - Run
agentuse serve. - The agent works normally until it reaches the approval point.
- AgentUse suspends the session on a pending approval gate.
- Reviewers open the session page (
/sessions/<id>), either from/approvalsor from a tokenized link. - A reviewer approves, rejects, or comments.
- AgentUse resumes the suspended session with the reviewer result.
- After the session finishes, reviewers can send follow-up instructions from the same session page to continue the session with its existing context.
Approval gates are only supported on the top-level agent, not on delegated sub-agents. Suspend/resume operates on a single top-level session, so an approval gate inside a delegated sub-agent could never suspend the run. If a sub-agent sets
approval in its frontmatter, AgentUse fails the run at load time with a clear error. Put the gate on the top-level (or type: manager) agent instead.Create an Agent with Approval
Use the smallest possible config:Define the Approval Boundary
Approval gates are agent-driven: the agent calls the internalawait_human tool when it reaches the point where review is needed. AgentUse injects the approval mechanism, but your agent instructions can still define the policy boundary for your workflow.
Write the boundary in business terms. Describe what the agent may prepare without approval, and what it must not finalize until approval is granted.
For a social publishing agent:
- Usually safe before approval: local temp files, drafts, previews, dry runs, summaries, draft PRs
- Usually approval-required: publishing, sending email, scheduling posts, deploying, merging, deleting, charging, or changing production/external state
- If unsure, ask for approval before the action
Start the Server
Start the AgentUse daemon:/sessions/<id>.
If reviewers open links from another machine, start serve with a reachable public URL:
--public-url when reviewers need a URL other than the local server address.
Optional Slack Channel
Slack can alert reviewers when an approval is waiting. Approval state still lives in the AgentUse session page. The Slack channel message stays concise, and supporting approval details are posted in the message thread when the agent provides them. Those thread details can include summary, draft, artifact, context, and risk.Reviewer Flow
The session page shows the best available review details from the agent:prompt: the reviewer-facing decision promptsummary: what changed and what is being approveddraft: inline draft contentdraft_url: URL to a draft artifactartifact_url: URL to the primary review artifact, such as a PR, preview, document, or generated artifactcontext: relevant background, constraints, or work completed so farrisk: known risks, unresolved questions, or reviewer attention areas- Session logs before and after the decision
Approve: resumes the agent withstatus: "approve"Reject: resumes the agent withstatus: "reject"Comment: resumes the agent withstatus: "comment"and the reviewer comment
Configuration Fields
Approval config is intentionally small:approval:trueor an object to enable the approval gateapproval.timeout: optional suspension timeout, such as30m,24h, or7d
channels: optional external collaboration channels, such aschannels: [slack]channels.slack.events: events for Slack. Approval gates useapproval; terminal run events are documented in Channels.channels.slack.channel_id: Slack channel id. If omitted, AgentUse usesSLACK_APPROVAL_CHANNEL.channels.slack.enabled: optional switch for temporarily disabling Slack
Auth and the session token
Authentication follows the deployment invariant:- Local bind (
127.0.0.1/localhost): no API key, no token. View and approve are fully open. - Exposed host:
serverefuses to start withoutAGENTUSE_API_KEY(use--no-authto bypass, dangerous). The API key (Authorization: Bearer) authorizes everything.
Bearer header is not clickable from a Slack message or an email, each session also has a session token: a stateless, per-session value that stands in for the API key on that one session’s page.
await_human mints this token when it builds the reviewer link, so Slack/email links are clickable without an API-key login.
While a run is suspended, anyone with its session link can approve it. A completed run has no pending gate, so a shared completed-log link cannot approve anything. The view + approve conflation only matters during the approval window.
Experimental session / approval API
The API is experimental and mirrors the web session page contract. Use it to build custom review UIs or integrations. JSON endpoints live under the/api/* prefix and are always API-key gated on an exposed host. The HTML session page and its action subroutes carry their own capability auth (session token / API key / local), so a tokenized link works without a Bearer header.
List sessions as JSON (filter by agent, trigger, or time window with days):
?token=) or a Bearer
header; the current pending gate is resolved server-side, so you do not pass a
gate token:
Legacy approval routes.
GET /approvals/:id now redirects to /sessions/:id, and the older /approvals JSON list plus the /api/approvals/:id/{status,decision,continue} action endpoints remain available for backward compatibility. Those legacy action endpoints still take a gate resumeToken in the body. In-flight Slack links from before the upgrade keep working: the session page also accepts a valid gate resumeToken as a credential until those approvals expire. Prefer the /sessions routes and the session token for new integrations.Local Testing
For development or manual testing, you can resume a suspended session from the CLI:/approvals UI for normal review, Slack for reviewer alerts, the Approval API for custom review surfaces, and agentuse sessions resume for local testing.