Quickstart¶
This page walks through the minimum-viable flow: create an agent, start a session, and stream its output. All you need is a running Agent on Demand deployment and an API token.
Python examples use the official aod-sdk package (pip install aod-sdk). Client() reads AOD_API_URL and AOD_API_TOKEN from the environment when no explicit arguments are passed.
Prerequisites¶
Choose a deployment:
- Hosted API (
https://aod.ravi.id): sign up — your token is shown once on the welcome screen. Create more at/ui/api-keys. - Local dev: run
make dev(server onhttp://localhost:8777), then register athttp://localhost:8777/ui/registerto get a token. - Self-hosted: set
BASEto your deployment URL and follow the same sign-up flow.
Step 1 — Create an agent¶
An agent is a reusable template. The minimum required fields are name, model, and runtime.
Response (201 Created):
{
"id": "<agent-uuid>",
"type": "agent",
"name": "hello",
"model": "anthropic/claude-sonnet-4-6",
"runtime": "claude",
"system": null,
"description": null,
"environment_id": null,
"skills": [],
"mcp_servers": [],
"metadata": {},
"version": 1,
"created_at": "2026-04-17T14:00:00.000000+00:00",
"updated_at": "2026-04-17T14:00:00.000000+00:00",
"archived_at": null
}
Save the id — you'll need it to create a session.
Step 2 — Create a session¶
A session runs the agent with a prompt inside a Sprite. Execution is asynchronous; the response comes back immediately with status: "pending".
Response (202 Accepted):
{
"id": "<session-uuid>",
"status": "pending",
"stream_url": "/sessions/<session-uuid>/stream",
"environment_id": null,
"resources": [],
"current_turn": 1
}
Step 3 — Stream output¶
Connect to the SSE stream to receive agent output in real time.
The -N flag disables curl's output buffering.
You'll see a sequence of data: lines:
The stream closes after the terminal event (exit, error, or terminated). Reconnecting replays all output from the beginning — useful if your connection drops.
Full scripted example¶
BASE=http://localhost:8777
TOKEN=aod_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AUTH="Authorization: Bearer $TOKEN"
JSON="Content-Type: application/json"
# Create agent
AGENT_ID=$(curl -s -X POST "$BASE/agents" -H "$AUTH" -H "$JSON" \
-d '{"name":"demo","model":"anthropic/claude-sonnet-4-6","runtime":"claude"}' \
| jq -r .id)
# Create session
SESS_ID=$(curl -s -X POST "$BASE/sessions" -H "$AUTH" -H "$JSON" \
-d "{\"agent_id\":\"$AGENT_ID\",\"prompt\":\"Say hello.\",\"timeout\":120}" \
| jq -r .id)
# Stream output
curl -N -H "$AUTH" "$BASE/sessions/$SESS_ID/stream"
# Clean up
curl -s -X POST -H "$AUTH" "$BASE/agents/$AGENT_ID/archive"
from aod import Client
with Client() as client:
agent = client.agents.create(
name="demo", model="anthropic/claude-sonnet-4-6", runtime="claude"
)
ack = client.sessions.create(
agent_id=agent.id, prompt="Say hello.", timeout=120
)
with client.sessions.stream(ack.id) as events:
for event in events:
if event.type == "output":
print(event.extra["data"], end="")
elif event.type == "exit":
break
client.agents.archive(agent.id)
What's next¶
- Core Concepts — understand agents, environments, sessions, and versioning.
- API Reference — browse all endpoints interactively.
- Python SDK — full surface, typed errors, async client, SSE helpers.
- Streaming — full SSE event reference and reconnect guidance.