Skip to main content

Python

Use the Python SDK from agents, workflow workers, and reviewer tools that need to create or manage TryAgent escalations.

Install

The Python SDK is available in this repository and is not published to PyPI yet. From a checkout, install it locally:
After the first PyPI release, install it with:

Create a client

Client options are Pythonic snake_case:
Provide exactly one of api_key, token, or get_token.

Send an escalation

Payload fields are the TryAgent API fields, so keep them camelCase inside the request body.
Use tryagent.escalations.create({...}) when you already have a complete input object that includes policy.

Manage escalations

Verify resume callbacks

When a reviewer decides, TryAgent sends a signed callback to your resume.url. Pass the raw body bytes or string to construct_event; do not parse JSON before verification.
You can also use the standalone helpers:

ApiError

The SDK raises ApiError for non-2xx API responses and network failures.
error.status is 0 for network failures. For API responses, error.body contains the parsed response when available and error.request_id comes from the response headers when present.