Package Exports
- @tryagent/sdk
Readme
@tryagent/sdk
TypeScript SDK for creating TryAgent escalations from AI agents and workflows.
Install
pnpm add @tryagent/sdknpm install @tryagent/sdkUsage
import { TryAgent } from "@tryagent/sdk";
const tryagent = new TryAgent({
apiKey: process.env.TRYAGENT_API_KEY!,
});
const escalation = await tryagent.escalate("orders.auth_doc", input);
console.log(escalation.id);See docs/quickstart.mdx for the full create-escalation, signed-callback, and resume flow.
The SDK defaults to https://api.tryagent.ai. Pass baseUrl for local development or tests.
const tryagent = new TryAgent({
apiKey: process.env.TRYAGENT_API_KEY!,
baseUrl: "http://localhost:4000",
});Errors
Non-2xx API responses and network failures throw ApiError.
import { ApiError } from "@tryagent/sdk";
try {
await tryagent.escalate("orders.auth_doc", input);
} catch (error) {
if (error instanceof ApiError) {
console.error(error.status, error.message, error.requestId);
}
}Development
pnpm --filter @tryagent/sdk typecheck
pnpm --filter @tryagent/sdk test
pnpm --filter @tryagent/sdk run pack:dry-run