tryagent
Python SDK for creating and managing TryAgent escalations from agents, workflows, and reviewer tooling.
Full documentation: https://tryagentai.mintlify.app/quickstart
Install
python3 -m pip install tryagent
From a checkout, install it locally with
python3 -m pip install -e packages/python-sdk.
Create a client
import os
from tryagent import TryAgent
tryagent = TryAgent(api_key=os.environ["TRYAGENT_API_KEY"])
Override base_url for local development or tests:
tryagent = TryAgent(
api_key=os.environ["TRYAGENT_API_KEY"],
base_url="http://localhost:4000",
)
Send an escalation
Request payloads use the TryAgent API's camelCase fields, even from Python.
import os
from tryagent import TryAgent
tryagent = TryAgent(api_key=os.environ["TRYAGENT_API_KEY"])
escalation = tryagent.escalate(
"orders.auth_doc",
{
"agentId": "order-agent",
"runId": "run_4821",
"subject": {
"type": "order",
"id": "ord_4821",
"label": "Order #4821",
},
"question": "The authorization document is missing a signature date. Continue?",
"evidence": [
"Candidate name is present.",
"Employer is present.",
"Signature date is blank.",
],
"choices": [
{"id": "manual_review", "label": "Send to manual review"},
{"id": "continue", "label": "Continue anyway"},
],
"resume": {
"mode": "webhook",
"url": "https://api.example.com/tryagent/resume",
"secret": os.environ["TRYAGENT_WEBHOOK_SECRET"],
},
},
)
print(escalation["id"], escalation["status"])
Resume a workflow
Always pass the raw request body to tryagent.webhooks.construct_event. Parsing
and re-serializing JSON changes the signed bytes.
import os
from tryagent import TryAgent, WebhookSignatureError
tryagent = TryAgent(api_key=os.environ["TRYAGENT_API_KEY"])
def handle_resume(raw_body: bytes, signature: str | None) -> tuple[dict[str, bool], int]:
try:
event = tryagent.webhooks.construct_event(
payload=raw_body,
signature=signature,
secret=os.environ["TRYAGENT_WEBHOOK_SECRET"],
)
except WebhookSignatureError:
return {"ok": False}, 401
resume_workflow(
event["runId"],
{
"escalationId": event["escalationId"],
"choice": event.get("choice"),
"answeredBy": event.get("answeredBy"),
"answeredAt": event.get("answeredAt"),
},
)
return {"ok": True}, 200
Manage escalations
open_escalations = tryagent.escalations.list(status="open")
escalation = tryagent.escalations.get("esc_123")
tryagent.escalations.acknowledge("esc_123")
tryagent.escalations.decide(
"esc_123",
{
"choice": "continue",
"reason": "Signature verified out of band.",
"response": {"approvedLimit": 5000, "riskLevel": "low"},
},
)
tryagent.escalations.cancel("esc_456", {"reason": "Order withdrawn."})
Handle API errors
Non-2xx API responses and network failures raise ApiError. Network failures
use status == 0; API responses use the HTTP status code. body contains the
parsed response body when available, and request_id is read from the
x-request-id response header when present.
from tryagent import ApiError
try:
tryagent.escalate("orders.auth_doc", input)
except ApiError as error:
print(error.status, error.request_id, error.body)
raise
Metadata
Release files for tryagent 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tryagent-0.0.2.tar.gz | 15.0 kB | With provenance | Details for tryagent-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tryagent-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for tryagent-0.0.2-py3-none-any.whl |
Total release size: 27.0 kB
Release files / tryagent-0.0.2.tar.gz
| Download URL | tryagent-0.0.2.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c781c90d8be544b3a6a0e8fa8c87c589ba0210a6a55f98d0c0aabbf8c8fbbf28
|
|
BLAKE2b-256 checksum How to use checksums |
730ad6e0753418809f6c17acea00e66ae6989efd4162ac0c22774b6f27d89f26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency logRelease files / tryagent-0.0.2-py3-none-any.whl
| Download URL | tryagent-0.0.2-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fdf9aa126a47bf82426a7ee51b8477d93e768f1d5dcde984a917628a99b6429
|
|
BLAKE2b-256 checksum How to use checksums |
b6b9e1bdf9cf236a123c6c6a869b645825924472cdcdd3a63940444f5f3bdf13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency logSecurity for tryagent 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for tryagent-0.0.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.