Skip to main content

Streaming run timeout

Cap how long await run / run_agent waits after start:
final = await client.run_agent(
    agent_id="YOUR_AGENT_UUID",
    string_inputs={"1": "Hello"},
    environment="playground",
    response_timeout=600.0,
)
Use a generous limit for long-running graphs, or the default from the SDK (see Environment).

Idempotent duplicate tool responses

If tool results are submitted twice for the same call_id, the API may respond with HTTP 409 and a stable error code. Treat that as safe to ignore when you know the first submission succeeded.
from asapi import AsapiHTTPError, ERROR_CODE_TOOL_RESPONSES_ALREADY_SUBMITTED

try:
    await client.send_tool_responses(agent_id, task_id, responses)
except AsapiHTTPError as e:
    if e.status_code == 409 and e.error_code == ERROR_CODE_TOOL_RESPONSES_ALREADY_SUBMITTED:
        pass  # already accepted
    else:
        raise