Skip to main content
One operation runs an agent: POST /sessions/{id} (see the API reference), albus sessions run in the CLI, sessions.run_session in Python, sessions.runSession in TypeScript. Everything on this page is that one call. Each call is an invocation: one prompt, one agent run, one assistant reply.

Session identity is yours to choose

You supply the session id. Albus creates the session on the first run and resumes it on every later one, so a session is created and continued by the same call.
Ids match ^[0-9a-zA-Z._:-]+$, 2–100 characters — use something meaningful from your own system (support-1234, pr-987, nightly:2026-08-11) so you can find the session again without storing a mapping. The response’s session.invocation_count tells you how many runs the session has had, and session.state is RUNNING, DONE, FAILED, or CANCELED.
A run loads up to the session’s most recent 1000 messages as history. Beyond that, older turns fall out. There is no memory beyond a session — see alpha limitations.

Waiting for the reply

A run is asynchronous underneath, with two ways to collect the result. Wait (long-poll). The request blocks until the assistant’s reply exists and returns it in messages. This is the CLI default, and wait=true in the API.
--wait-timeout (wait_timeout) bounds the wait server-side. If it elapses first the request fails with 504 and a JSON body — the run is still going, and retrying the same idempotency key re-attaches to it. Omit the timeout and the request waits as long as your client stays connected. Don’t wait. Return as soon as the invocation is accepted, then poll.
sessions get pages messages with --after/--limit; each message carries a monotonic cursor, so pass the last cursor you saw as after to fetch what is new.

Idempotency

Supply an idempotency key and the run becomes retry-safe: a network failure, a 504, or a lost response costs nothing.
The effective key always comes back — in the Idempotency-Key response header, and in the CLI’s JSON output as idempotency_key — so you can reference or retry the invocation even when you did not supply one.

Agent configuration

The agent object defines behavior; agent_name names it. Every distinct configuration under one name becomes a revision, so you can tell which version of your agent produced a run. See agents and revisions.
In the CLI, the common fields have flags (--model, --system-prompt, --tool, --max-steps, --provider, --credential). Anything else — MCP servers, a provider URL override — goes in a JSON file:
--agent-file is the whole agent configuration and cannot be combined with --model, --provider, --credential, --system-prompt, --tool, or --max-steps. Put the model in the file instead.

Failure modes

Every one of these is a JSON body, not a bare status. Note the difference between the two retries: reusing a key re-attaches to that invocation, so reusing the key of a failed run returns its failure again. Use the same key to recover a lost response (504, dropped connection), and a new key to actually run again. Albus does not retry a failed run for you — see alpha limitations.

Clean up