How-tos
Ship your first guarded call in minutes.
Practical, copy-paste guides for wiring TryAgent into real agents — from a one-line guard() to resuming the exact run a human paused. In TypeScript or Python.
Quickstart
Four steps from install to a resumable, human-reviewed decision.
- 01
Install the SDK
Add the TryAgent client to the service that runs your agent.
Terminal1pnpm add @tryagent/sdk - 02
Authenticate
Create a scoped API key in your workspace and pass it to the client.
lib/tryagent.ts1import { TryAgent } from "@tryagent/sdk";2 3const tryagent = new TryAgent({4 apiKey: process.env.TRYAGENT_API_KEY,5}); - 03
Escalate a decision
When your agent hits a call it should not make alone, send the question, evidence, and the choices a reviewer can pick.
escalate.ts1const escalation = await tryagent.escalate("refunds.high_value", {2 agentId: "billing-copilot",3 runId: thread.id,4 question: "Refund $480 to customer #4821?",5 evidence: [6 "Order #4821 was delivered 6 days late",7 "Customer is a 3-year subscriber",8 ],9 choices: ["approve", "edit", "reject"],10 resume: {11 mode: "webhook",12 url: process.env.RESUME_URL,13 secret: process.env.TRYAGENT_WEBHOOK_SECRET,14 },15});16 17// returns now — your orchestrator pauses the run - 04
Verify and resume the run
TryAgent posts a signed callback when a human decides. Verify the x-tryagent-signature HMAC, then resume the exact run.
app/api/resume/route.ts1import { TryAgent, WebhookSignatureError } from "@tryagent/sdk";2 3const tryagent = new TryAgent({ apiKey: process.env.TRYAGENT_API_KEY });4 5// POST /tryagent/resume — signed webhook6export async function POST(req: Request) {7 const body = await req.text(); // raw body; re-serializing breaks the signature8 const signature = req.headers.get("x-tryagent-signature");9 10 let event;11 try {12 event = await tryagent.webhooks.constructEvent({13 payload: body,14 signature,15 secret: process.env.TRYAGENT_WEBHOOK_SECRET!,16 });17 } catch (err) {18 if (err instanceof WebhookSignatureError) {19 return Response.json({ error: "Invalid signature" }, { status: 401 });20 }21 throw err;22 }23 24 await agent.resume(event.runId, { choice: event.choice });25 return Response.json({ ok: true });26}
Guides
Step-by-step walkthroughs for the patterns teams reach for most.
Escalate from a LangGraph node
Pause a graph at a decision boundary and resume it from the signed callback.
Read guideCreate an escalation policy
Route by agent, subject, risk, or amount — and version every change.
Read guideDeliver escalations to Slack
Connect a workspace and route policies to the right channels and people.
Read guideVerify signed resume webhooks
Check the x-tryagent-signature HMAC before you replay a decision.
Read guideCall TryAgent from Python
Escalate, manage, and resume decisions from Python agents and workers.
Read guideHow policies and routing work
The model behind reviewers, SLAs, timeouts, and versioned policy.
Read guideGet your first escalation live.
Start free with 100 escalations a month — no credit card. Every feature is included on every plan.