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 credential is supplied.MesaAuth | None
A credential group holding either a private key or an existing access token, never both. A client built from an access token forwards that token unchanged and cannot mint another one.
str
REST API base URL. Defaults to
https://api.mesa.dev/v1. http and https are accepted. Trailing slashes are stripped.str | None
Optional VCS gateway override. Only use when self-hosting Mesa.
str | None
Optional organization check. Private-key and access-token clients derive the organization from the credential and only accept a matching value.
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
Private-key and access-token clients read the organization from the credential. A constructor or per-callorg value is optional, but it must match that organization.
Resource namespaces
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.

