Skip to main content
Generated by python scripts/gateway-client/reference_python.py. Covers atlaso, atlaso.testing, result types, memory APIs, and tool adapters reached through a user scope. Shared-method sections document inherited APIs on clients, user scopes, completed results, and memory tools.

Shared client methods

Shared configuration and methods inherited by the public adapters.

Shared client methods.init

Initialize _Base with the supplied configuration.

Shared client methods.client_options

Spread into your provider client: OpenAI(**atlaso.client_options()). Carries no user.

Shared client methods.anthropic_options

Spread into Anthropic(…); the provider client appends /v1/messages.

Shared client methods.read_receipt

Read a call’s receipt from .with_raw_response.create(...). Never changes a chunk or a request.

Shared client methods.receipt_from_headers

Parse gateway reply headers into a typed receipt without invoking callbacks.

Shared client methods.classify

Classify an exception without logging or sending it anywhere.

Atlaso

Sync entry point. atlaso = Atlaso() # ATLASO_KEY user = atlaso.for_user(“demo-user-42”) # one per request reply = user.openai().chat.completions.create(…)

Atlaso.read_receipt

Read a call’s receipt from .with_raw_response.create(...). Never changes a chunk or a request.

Atlaso.openai

The shared OpenAI client this object builds on first use (pip install openai). It uses this object’s max_retries, its timeout when you set one, and its http_client when the provider’s HTTP library accepts it. It carries no user. With a key whose memory is for “Me”, calls use your own memory; with a per-user key, a call without a user goes out with no memory. For your app’s users, use for_user(id).

Atlaso.anthropic

The shared Anthropic client this object builds on first use (pip install anthropic). No user.

Atlaso.memory

Your own memory, with a “Me” key: add, add_many, list, search, update and delete. No erase. A key set to “Memory for each user of my app” uses for_user(id).memory instead (this one answers memory_scope_per_user). A key whose memory is Off answers memory_off.

Atlaso.shared

Shared facts for this server key’s project.

Atlaso.calls

Developer-key call lookup.

Atlaso.usage

Per-user usage pages.

Atlaso.for_user

Create a scope for one user in this key’s project. Call per request.

Atlaso.revoke_browser_token

Revoke one browser token by public id.

Atlaso.close

Close the connections this object created: its memory API pool and the clients behind user.openai() / user.anthropic(). Never a client you passed in.

AsyncAtlaso

Async entry point; the same surface with async memory methods.

AsyncAtlaso.openai

The shared AsyncOpenAI client this object builds on first use (pip install openai). It carries no user. With a key whose memory is for “Me”, calls use your own memory; with a per-user key, a call without a user goes out with no memory. For your app’s users, use for_user(id).

AsyncAtlaso.anthropic

The shared AsyncAnthropic client this object builds on first use (pip install anthropic). No user.

AsyncAtlaso.memory

Your own memory, with a “Me” key (async): add, add_many, list, search, update and delete. No erase.

AsyncAtlaso.shared

Shared facts for this server key’s project.

AsyncAtlaso.calls

Asynchronous developer-key call lookup.

AsyncAtlaso.usage

Asynchronous per-user usage pages.

AsyncAtlaso.for_user

Create a scope for one user in this key’s project. Call per request.

AsyncAtlaso.revoke_browser_token

Revoke one browser token by public id.

AsyncAtlaso.close

Close the connections this object created: its memory API pool and the clients behind user.openai() / user.anthropic(). Never a client you passed in.

ErrorInfo

Typed facts about one error. Python names; to_dict() gives the canonical camelCase JSON.

ErrorInfo.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

AtlasoError

Base class for every error this library raises itself.

ConfigurationError

A setup mistake caught before any request leaves (code says which).

ConfigurationError.init

Initialize ConfigurationError with the supplied configuration.

MemoryAPIError

A memory API call failed; .info holds the typed ErrorInfo.

MemoryAPIError.init

Initialize MemoryAPIError with the supplied configuration.

CursorInvalidError

The list cursor no longer exists (400 invalid_after). The iterator never restarts silently.

NotSentError

The request never reached the server (the connection did not open), so nothing was saved. Raised by add() once its retries are used up. safe_to_repeat is True: sending the same add again cannot create a duplicate.

InvalidRequestError

An argument refused before anything was sent (for example a malformed fact id). Also a ValueError, so existing handlers keep working. info.kind is “invalid_request” and it is never retryable: resending the same arguments cannot succeed.

InvalidRequestError.init

Initialize InvalidRequestError with the supplied configuration.

Memory

One stored fact. Stored text may differ from the input: recognised passwords, API keys and tokens are redacted, but unrecognised secrets and other sensitive details can remain.

Memory.from_wire

Parse a gateway fact object into a typed Memory.

Memory.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

Page

A newest-first page of facts with a continuation cursor.

Page.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

SharedFact

One fact every app user of the key’s project gets. No app-user label: it belongs to the project.

SharedFact.from_wire

Parse a gateway shared fact object.

SharedFact.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

SharedPage

A newest-first page of shared facts; total counts the project’s facts on every page.

SharedPage.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

MemoryExport

All facts for one user in this key’s project, newest first. Not an atomic snapshot.

MemoryExport.to_dict

JSON-ready right-of-access response, with UTC generation time and counts.

AddedResult

Saved. memory is the stored fact. Stored text may differ from the input: recognised passwords, API keys and tokens are redacted, but unrecognised secrets and other sensitive details can remain.

AddedResult.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

AddUnknownResult

No clear answer: reuse idempotency_key to resend safely within 24 hours.

AddUnknownResult.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

AddRejectedResult

Nothing was stored: an erase of this user is still running.

AddRejectedResult.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

SharedAddedResult

Saved. memory is the stored shared fact. Stored text may differ from the input: recognised passwords, API keys and tokens are redacted, but unrecognised secrets and other sensitive details can remain.

SharedAddedResult.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

SearchHit

A memory and its within-answer search score.

BatchResult

Per-item save results returned by the gateway.

UpdateResult

New fact and the id it replaced.

Completed result methods

Shared by outcomes that are already final: there is nothing to resume.

Completed result methods.resume

Reject resumption of an already completed operation.

DeletedResult

The requested fact was deleted from this user’s project.

DeletedResult.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

AlreadyGoneResult

The id was not there.

AlreadyGoneResult.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

DeletePendingResult

The server is still deleting. resume() resends the same DELETE (safe).

DeletePendingResult.resume

Resend the same DELETE (safe). Async scopes return an awaitable.

DeletePendingResult.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

ErasedResult

Every fact of this user in this key’s project is gone. Erased facts cannot be recovered.

ErasedResult.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

ErasePendingResult

The server is still erasing. resume() resends the same erase (safe).

ErasePendingResult.resume

Resend the same erase (safe). Async scopes return an awaitable.

ErasePendingResult.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

MemoryList

Iterates every memory for the user, newest first, fetching pages as needed.

MemoryList.init

Initialize MemoryList with the supplied configuration.

MemoryList.page

Fetch only the first page.

AsyncMemoryList

Lazily read newest-first facts, fetching pages only as they are consumed.

AsyncMemoryList.init

Initialize AsyncMemoryList with the supplied configuration.

AsyncMemoryList.page

Fetch one page using this iterator’s initial limit and cursor.

SharedList

Iterates every shared fact of the project, newest first, fetching pages as needed.

SharedList.init

Initialize SharedList with the supplied configuration.

SharedList.page

Fetch only the first page.

AsyncSharedList

Lazily read newest-first shared facts, fetching pages only as they are consumed.

AsyncSharedList.init

Initialize AsyncSharedList with the supplied configuration.

AsyncSharedList.page

Fetch one page using this iterator’s initial limit and cursor.

_FactsApi

The fact methods of user.memory and atlaso.memory (sync); export and erase are user.memory’s only.

_FactsApi.add

Save one fact with an automatic idempotency key; reuse the returned key for manual resend.
Preview recall for this memory; scores compare within one answer.

_FactsApi.add_many

Save 1-50 facts with one idempotency key and per-item results.

_FactsApi.update

Correct a fact; the new fact has a new id and the old id is no longer listed or recalled.

_FactsApi.list

Read newest-first facts, fetching pages lazily.

_FactsApi.delete

Delete one fact: “deleted”, “already_gone” or “pending” (then call result.resume()).

_AsyncFactsApi

The fact methods of user.memory and atlaso.memory (async); export and erase are user.memory’s only.

_AsyncFactsApi.add

Save one fact with an automatic idempotency key; reuse the returned key for manual resend.
Preview recall for this memory; scores compare within one answer.

_AsyncFactsApi.add_many

Save 1-50 facts with one idempotency key and per-item results.

_AsyncFactsApi.update

Correct a fact; the new fact has a new id and the old id is no longer listed or recalled.

_AsyncFactsApi.list

Read newest-first facts, fetching pages lazily.

_AsyncFactsApi.delete

Delete one fact. Pending results can be resumed.

MemoryApi

Memory routes for one user (sync).

MemoryApi.init

Initialize MemoryApi with the supplied configuration.

MemoryApi.export

Collect every page or fail without a partial object; an erase during an export can end it early.

MemoryApi.export_stream

Lazily iterate newest first, retaining one page.

MemoryApi.erase

Erase every fact for this user in this project: “erased” or “pending” (then result.resume()).

AsyncMemoryApi

Memory routes for one user (async).

AsyncMemoryApi.init

Initialize AsyncMemoryApi with the supplied configuration.

AsyncMemoryApi.export

Collect every page or fail without a partial object; an erase during an export can end it early.

AsyncMemoryApi.export_stream

Lazily iterate facts, retaining one page.

AsyncMemoryApi.erase

Erase every fact for this user in the current project. Pending results can be resumed.

OwnerMemoryApi

Your own memory, for a “Me” key (sync): the memory the Atlaso plugins use. Facts land in the key’s project, or in your personal memory when the key has none. A delete is a real forget everywhere. There is no erase: delete all of your memories on the dashboard.

OwnerMemoryApi.init

Bind a server-key client without a user header.

AsyncOwnerMemoryApi

Your own memory, for a “Me” key (async). There is no erase: use the dashboard.

AsyncOwnerMemoryApi.init

Bind a server-key client without a user header.

SharedApi

Project shared facts, available only from a server-key client.

SharedApi.init

Bind a server-key client without a user header.

SharedApi.add

Store one project fact with an automatic idempotency key, or the one you pass to resend an uncertain add safely. An uncertain write is never retried automatically.

SharedApi.list

Read newest-first shared facts, fetching pages lazily.

SharedApi.delete

Delete one shared fact; resume a pending deletion.

SharedApi.delete_all

Permanently delete every shared fact in this key’s project.

AsyncSharedApi

Asynchronous project shared facts.

AsyncSharedApi.init

Bind a server-key client without a user header.

AsyncSharedApi.add

Store one project fact with an automatic idempotency key, or the one you pass to resend an uncertain add safely. An uncertain write is never retried automatically.

AsyncSharedApi.list

Read newest-first shared facts, fetching pages lazily.

AsyncSharedApi.delete

Delete one shared fact; resume a pending deletion.

AsyncSharedApi.delete_all

Permanently delete every shared fact in this key’s project.

CallCost

Provider list price; unknown and estimated costs remain explicit.

GatewayCall

Content-free call record. An interrupted call uses its last checkpoint. An in_progress row has not settled. Both states have estimated=True; a late final receipt can replace them with the provider’s actual usage.

Calls

Call lookups with optional receipt-write polling.

Calls.init

Bind call lookups to a client and optional user scope.

Calls.get

Get a call; poll call_not_ready and in_progress for at most wait seconds.

AsyncCalls

Async call lookups.

AsyncCalls.init

Bind asynchronous call lookups to a client and optional user scope.

AsyncCalls.get

Get a call; poll call_not_ready and in_progress for at most wait seconds.

Usage

Lazy app-user cost pages.

Usage.init

Bind usage reads to a client and optional app user.

Usage.app_users

Yield rows with app_user_label, calls, cost_usd (string or null), cost_complete (bool), unpriced_calls and refused_calls in a UTC window. A false cost_complete means the monthly total is not final.

Usage.get

Return one scoped user’s usage row, or None when absent.

AsyncUsage

Async lazy app-user cost pages.

AsyncUsage.init

Bind asynchronous usage reads to a client and optional app user.

AsyncUsage.app_users

Yield rows with app_user_label, calls, cost_usd (string or null), cost_complete (bool), unpriced_calls and refused_calls in a UTC window. A false cost_complete means the monthly total is not final.

AsyncUsage.get

Return one scoped user’s usage row, or None when absent.

MemoryReceipt

Memory activity reported by the gateway for this model request.

MemoryReceipt.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

Cost

Known decimal cost or an explicit pending or unknown state.

Cost.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

CacheInfo

Reported cache read and write counts; missing counts are None.

CacheInfo.to_dict

Return a JSON-ready projection using the shared wire-contract field names.

Receipt

Per-call metadata. Raw gateway metadata and remote error text are untrusted.

Receipt.to_dict

Canonical camelCase JSON projection (contracts/receipt.schema.json).

Tracked

A tracked sync call: .data (the provider result), .stream (streams only), .receipt. For a stream, .receipt is a live snapshot: memory from headers at once, cost pending; after the loop ends for any reason it is final and .finished is True. Iterating .data directly instead of .stream bypasses tracking.

Tracked.init

Initialize Tracked with the supplied configuration.

Tracked.receipt

Read an independent snapshot of this call’s current receipt.

Tracked.finished

Whether receipt tracking has reached a final state.

Tracked.close

Stop a stream you will not finish reading; closes the connection. Returns the final receipt.

AsyncTracked

A tracked async call. await t.done() resolves when the stream ends for any reason; it never raises.

AsyncTracked.init

Initialize AsyncTracked with the supplied configuration.

AsyncTracked.receipt

Read an independent snapshot of this call’s current receipt.

AsyncTracked.finished

Whether receipt tracking has reached a final state.

AsyncTracked.done

Wait for a final receipt. This observer does not consume the stream and never raises.

AsyncTracked.aclose

Stop a stream you will not finish reading; closes the connection.

ProviderRouting

The gateway’s provider request field, with its wire names.

RoutingBody

What routing() returns: {"provider": {...}}, or {} when no option was set.

routing

Build the gateway’s provider field for extra_body=:: client.chat.completions.create(model=…, messages=…, extra_body=routing(order=[“anthropic”, “bedrock”])) order: try these providers first, in this order. only: use only these providers. ignore: never use these providers. allow_fallbacks: False = if the provider the gateway picked fails, fail the call instead of trying a backup. Checked here, before anything is sent: a non-boolean allow_fallbacks and lists that are not lists of distinct, non-empty names raise InvalidRequestError (code invalid_routing). An unknown keyword is a TypeError. Options left as None are not sent; with none set this returns {}, which adds nothing.

answered_by

The provider that answered a call, as a name routing() accepts (such as “bedrock”), read from the receipt’s model id; None when no provider answered. receipt.provider_host is the host name of the server that answered:: backup = answered_by(tracked.receipt) != “anthropic”

Shared user scope methods

Shared per-request headers and provider binding inherited by user scopes.

Shared user scope methods.init

Initialize _ScopeBase with the supplied configuration.

Shared user scope methods.headers

Per-call headers for frameworks: pass as extra_headers on each call.

Shared user scope methods.client

A cheap copy of your provider client with this user attached. Make one per request.

UserScope

One user in the current project, with synchronous memory operations and tools.

UserScope.init

Initialize UserScope with the supplied configuration.

UserScope.openai

This user’s copy of the shared OpenAI client that this object builds on first use.
With your own OpenAI client: the same as client(openai_client).
This user’s copy of the shared OpenAI client: user.openai().chat.completions.create(...). With no argument it uses one user-free OpenAI client that this Atlaso object builds on first use (needs pip install openai). Pass your own client to use it instead, like client().

UserScope.anthropic

This user’s copy of the shared Anthropic client that this object builds on first use.
A guarded per-user copy of the Anthropic client you pass.
This user’s copy of the shared Anthropic client (needs pip install anthropic), or of the one you pass.

UserScope.create_browser_token

Mint a short-lived browser token for this scope’s user.

UserScope.revoke_browser_tokens

Revoke every active browser token for this scope’s user.

AsyncUserScope

One user in the current project, with asynchronous memory operations and tools.

AsyncUserScope.init

Initialize AsyncUserScope with the supplied configuration.

AsyncUserScope.openai

This user’s copy of the shared AsyncOpenAI client that this object builds on first use.
With your own AsyncOpenAI client: the same as client(openai_client).
This user’s copy of the shared AsyncOpenAI client: user.openai().chat.completions.create(...). With no argument it uses one user-free AsyncOpenAI client that this AsyncAtlaso object builds on first use (needs pip install openai). Pass your own client to use it instead, like client().

AsyncUserScope.anthropic

This user’s copy of the shared AsyncAnthropic client that this object builds on first use.
A guarded per-user copy of the AsyncAnthropic client you pass.
This user’s copy of the shared AsyncAnthropic client (needs pip install anthropic), or of the one you pass.

AsyncUserScope.create_browser_token

Mint a short-lived browser token for this scope’s user.

AsyncUserScope.revoke_browser_tokens

Revoke every active browser token for this scope’s user.

BrowserTokenLimits

Optional browser-token restrictions, using the gateway’s wire field names. Model names suggest this release’s catalog and accept future strings. The gateway, not this type, enforces the requested restrictions.

BrowserToken

Short-lived bearer returned by the gateway. Keep token on the intended device only.

BrowserTokenRevoke

Result of revoking one public token id.

BrowserTokensRevoke

Result of revoking all tokens for one app user.

Shared tool methods

Shared configuration and methods inherited by the public adapters.

Shared tool methods.init

Initialize _Base with the supplied configuration.

OpenAITools

definitions for the provider SDK’s tools=; run(call) inside your own loop returns a string.

OpenAITools.init

Initialize OpenAITools with the supplied configuration.

OpenAITools.run

Validate and execute a model function call using this user’s memory tools.

AsyncOpenAITools

Async function-tool definitions and execution bound to one user.

AsyncOpenAITools.init

Initialize AsyncOpenAITools with the supplied configuration.

AsyncOpenAITools.run

Validate and execute a model function call using this user’s memory tools.

MemoryTools

Synchronous memory tools bound to this user’s memory API.

MemoryTools.init

Initialize MemoryTools with the supplied configuration.

MemoryTools.for_openai

Build function definitions and a scoped executor for OpenAI tool calls.

MemoryTools.functions

Plain typed functions with docstrings, for agent frameworks that wrap functions as tools.

AsyncMemoryTools

Asynchronous memory tools bound to this user’s memory API.

AsyncMemoryTools.init

Initialize AsyncMemoryTools with the supplied configuration.

AsyncMemoryTools.for_openai

Build function definitions and a scoped executor for OpenAI tool calls.

AsyncMemoryTools.functions

Return the scoped asynchronous function-tool adapter.

FakeGateway

Use httpx_client() or async_httpx_client(); neither opens a socket. Options accept snake_case, or the contract’s camelCase via from_contract(). Keys map synthetic tokens to project/keyScope/required/memory settings. next() accepts either a scenario dict or keyword arguments. State changes are serialized so the same fake is safe for threads and async clients.

FakeGateway.init

Initialize FakeGateway with the supplied configuration.

FakeGateway.from_contract

Build a deterministic offline fake from a language-neutral contract fixture.

FakeGateway.next

Queue a synthetic reply or fault; returns this fake for chaining.

FakeGateway.users

Return a copied snapshot of the default project’s synthetic users.

FakeGateway.snapshot

Copy all synthetic user stores in one project.

FakeGateway.owner

Copy a “Me” key’s own facts: a project’s, or the personal ones (project None).

FakeGateway.shared

Copy a project’s shared facts.

FakeGateway.httpx_client

Build a synchronous HTTP client backed by this offline fake.

FakeGateway.async_httpx_client

Build an asynchronous HTTP client backed by this offline fake.

FakeGateway.handle_request

Handle a synthetic HTTP request without network access.

Constants and result aliases

These aliases narrow on the outcome field; version metadata comes from the package.