mesa-rest client, resolves the default organization for you, and exposes a native virtual filesystem for repo I/O and shell execution.
Python 3.10 or newer is required.
Installation
Create a client
Client options
str | None
Ed25519 private key. The SDK reads
MESA_PRIVATE_KEY when no explicit private key is supplied.str
REST API base URL. Defaults to
https://api.mesa.dev/v1. http and https are accepted. Trailing slashes are stripped.str | None
Appended to the SDK user agent. The default user agent starts with
mesa-sdk-python.Client lifecycle
Create oneMesa client for your process or application and reuse it across request handlers. If your framework has a lifespan hook and you want explicit cleanup, wrap the client in async with Mesa(...) at application lifespan, not inside each handler.
Organization resolution
The client reads its organization from the private key. Resource methods always use that organization and do not accept anorg value.
await mesa.org.get() when you need organization metadata from the API.
Resource APIs
Response objects
The high-level SDK returns model instances generated bymesa-rest. Use attribute access, not dictionary access.
Common types
Import common dataclasses and native result types frommesa_sdk.
Upstream configuration types live in
mesa_sdk.types:
mesa.repos.update(...), UpstreamConfig.auth is tri-state: omit to preserve existing credentials, pass None to clear credentials, or pass TokenAuth / UsernamePasswordAuth to set credentials.
Error model
REST API operations raiseMesaError subclasses.
SDK setup errors include
MissingCredentialError, InvalidApiUrlError, OrgResolutionError, and InvalidOptionsError.
Filesystem and Bash operations raise built-in Python exceptions such as FileNotFoundError, FileExistsError, IsADirectoryError, NotADirectoryError, PermissionError, NotImplementedError, and OSError.
Raw generated client
mesa.raw exposes the authenticated generated mesa-rest client. Use it when the high-level SDK does not expose a generated REST operation or option yet.
Response[T] wrapper with status_code, parsed, and headers. High-level SDK methods unwrap successful responses and raise typed errors for non-2xx responses.

