Back to catalog / Agent workflows
Drive a long-running task through webhooks and resume human approval
Return quickly from HTTP requests, receive run events by webhook, pause for review, and resume the session.
Goal
Build an asynchronous human-approval loop without holding a long-lived connection.
Steps
- After creating a session, persist its ID against the business task; the HTTP handler submits events and returns accepted promptly. [operate]
- Register a Managed Agents webhook for idle/custom-tool events; verify signatures and deduplicate event IDs. [operate]
- Queue the pending decision for a reviewer; after approval, use
events.sendwith the user/custom-tool result to resume the same session. [operate] - Archive the session and clear its mapping at terminal state; bound webhook retry and timeout handling. [operate]
How to verify
Replaying an event does not duplicate approval/actions, the review resumes the original session, and terminal resources are archived per policy.
Troubleshooting
If the session does not resume, inspect webhook event ID, signature, and session state; do not create a second task to hide the first.
Permissions
Prerequisites
- Python 3.11+, Anthropic API key, a Managed Agents webhook endpoint, HTTPS receiver, and durable job queue.
Permissions
- Verify webhook signatures; the application owns reviewer identity and authorization; deny side-effecting tools until approval.
Limitations
The notebook shows a production webhook pattern but does not implement your app’s authentication, idempotency store, or approval policy.
Pinned upstream source
- Repository
- anthropics/anthropic-cookbook
- File path
- managed_agents/CMA_operate_in_production.ipynb
- Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT
Main topic
Turn ecommerce campaign materials into a reviewable weekly brief