aomi.agent surface, or the versioned REST resource at /v1/agent for any other language. Both are documented on this page.
The SDK runs this loop for you — agent.run() starts the turn, hydrates ordered event pages, and follows the event stream until a terminal state. Provisional streamed text does not advance the durable cursor. A raw HTTP caller drives the same loop directly with the endpoints in the Agent REST API reference.
The TypeScript snippets assume an aomi instance created with the Client SDK quickstart or OAuth device flow.
Run a turn
AgentRun is Promise-like. You can await it directly or call result().
Observe a run
Attach listeners immediately after creating the run:Continue a conversation
Pass the samesessionId to each turn:
Communicate wallet context with UserState
Each turn can carry aUserState — the contractual snapshot of the caller’s wallet context that the harness builds and signs against:
wallet: on the Aomi constructor, the SDK derives this from the adapter automatically, so most integrations never build it by hand. Pass it explicitly when your application tracks the connection itself.
The contract is strict and schema-validated on the backend — a userState with unknown fields is rejected:
Use UserState for wallet context only. Read wallet requests from typed Actions and, on environments supporting durable execution, Commit views. A current transaction review can arrive in
EventPage.commits and the session snapshot rather than as an action event. See durable transaction reviews before integrating transaction execution.
Account abstraction and sponsorship are deliberately not part of
UserState. They are backend authority, resolved per execution — the client never sends or stores them.Choose Auto or Direct routing
Omittarget to use Auto routing. Select one deployed App explicitly for Direct routing:
target to the wire mode and App selector fields. An App’s canonical Application ID is distinct from a Pipeline catalog slug, session ID, or OAuth identity. Use an ID returned by your environment’s App catalog.
Interrupt work
Manage sessions
Session management is available through the wire-close client on the sameAomi instance:
sessions.all() only when the complete list is small enough to load into memory.
Renaming, archiving, and deleting sessions require the scopes configured for the signed-in account; staging guest access can be read-only.
Handle actions
For typed Agent Actions, review the request, then resolve or reject it. Durable transaction Commits use the separate controller described in Wallet and signing:Handle errors
Failed Agent calls throw a typedAgentApiError:
AgentApiError exposes:
Retry only when
retryable is true, reuse the same idempotency key when retrying one logical mutation, and never retry a wallet signature prompt without showing the user the exact current request again. For 401/403 failures, see Authentication failures.