Connect your application

Integrate managed Service agents into your backend using workspace API keys, official SDKs, or the HTTP API with idempotency keys and human approval resume.

Connect your backend to a tested Service agent using the Service URL, Agent ID, and a workspace API key (runner or higher; use a service account for production apps and keep keys server-side).

Set up credentials

Open the agent's menu in Console and click Connect to app. Set A13N_SERVICE_URL to the deployment base URL and A13N_AGENT to the agent ID. Create or select a workspace API key and supply it to your backend as A13N_API_KEY.

For live voice, use the Realtime API (Alpha). Your backend exchanges its workspace API key for a single-use ticket and passes the ticket to the client.

Start with an SDK

Save the example as call_agent.py and run uv run --python 3.13 --with 'a13n==0.9.0' call_agent.py. For TypeScript, Go, and Rust, see the SDK quick starts.

call_agent.py
import asyncio
import os
from a13n import Client

async def main():
    async with Client() as client:
        run = await client.agents(os.environ["A13N_AGENT"]).run("Name two colors.")
        print(run.output if run.status == "completed" else run.status)

asyncio.run(main())

Save run.thread_id to find the conversation under Sessions in Console. Pass thread=run.thread_id to a later agent.run(...) call to continue the same conversation.

Handle a waiting result

When run.status == "waiting", inspect run.pending_approvals and run.pending_calls in Python. Collect the user's decisions or the client-tool results. Pass a complete map of answers keyed by tool_call_id to await client.runs(run.id).resume(answers), then call await successor.result() on the returned handle.

For direct HTTP calls, send the approvals and calls maps to the resume endpoint with a fresh Idempotency-Key.

Direct HTTP integration

With the environment variables above set, use curl, jq, and uuidgen to submit a message. Reuse the exact Idempotency-Key and body when retrying a lost response.

Terminal
MESSAGE_KEY=$(uuidgen)

curl --fail-with-body -sS -X POST "${A13N_SERVICE_URL%/}/api/v1/threads" \
  -H "Authorization: Bearer $A13N_API_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $MESSAGE_KEY" \
  -d "{\"agent_id\":\"$A13N_AGENT\",\"input\":{\"content\":[{\"type\":\"text\",\"text\":\"Name two colors.\"}]}}" \
  > submitted.json

THREAD_ID=$(jq -r '.thread.id' submitted.json)
SESSION_ID=$(jq -r '.thread.session_id' submitted.json)
ENTRY_ID=$(jq -r '.entry.id' submitted.json)

Poll the inbox entry until its status is consumed. If it reaches failed or withdrawn, stop polling and inspect the entry.

Terminal
curl --fail-with-body -sS "${A13N_SERVICE_URL%/}/api/v1/threads/$THREAD_ID/inbox/$ENTRY_ID" \
  -H "Authorization: Bearer $A13N_API_KEY" | jq '{status, assigned_run_id}'

After the entry is consumed, set RUN_ID to its assigned_run_id. Poll the run while its status is accepted or running:

Terminal
curl --fail-with-body -sS "${A13N_SERVICE_URL%/}/api/v1/runs/$RUN_ID" \
  -H "Authorization: Bearer $A13N_API_KEY" | jq '{status, output, pending, failure}'

Send follow-ups to POST /api/v1/threads/$THREAD_ID/inbox with a new Idempotency-Key. To receive live progress events, subscribe to session SSE streams ($SESSION_ID) or webhooks.

Use built-in Connector events to receive Composio account events and start Agent conversations directly.

On this page