Autonoma SDK — automate the Autonoma Environment Factory endpoint
Project description
Autonoma Python SDK
Python implementation of the Autonoma Environment Factory SDK.
Package
| Package | Description |
|---|---|
autonoma-ai |
Core protocol (HMAC, refs, graph, handler) |
autonoma-ai[sqlalchemy] |
SQLAlchemy executor adapter |
autonoma-ai[django] |
Django executor adapter and server handler |
autonoma-ai[flask] |
Flask server adapter |
autonoma-ai[fastapi] |
FastAPI server adapter |
autonoma-ai[postgres] |
PostgreSQL driver (psycopg2) |
autonoma-ai[all] |
All adapters and drivers |
Quick Start
Install
pip install autonoma-ai
# With extras:
pip install "autonoma-ai[sqlalchemy,fastapi,postgres]"
# Or everything:
pip install "autonoma-ai[all]"
FastAPI + SQLAlchemy
from autonoma.types import HandlerConfig
from autonoma_fastapi import create_fastapi_handler
from autonoma_sqlalchemy import sqlalchemy_executor
from sqlalchemy import create_engine
engine = create_engine("postgresql://user:pass@localhost/mydb")
config = HandlerConfig(
executor=sqlalchemy_executor(engine),
scope_field="organization_id",
shared_secret="your-shared-secret",
signing_secret="your-signing-secret",
auth=lambda user, context: {
"headers": {"Authorization": f"Bearer {create_session_token(user['id'])}"}
},
)
router = create_fastapi_handler(config)
app.include_router(router, prefix="/api/autonoma")
Model name ↔ table name
By default, the SDK derives a model name from each SQL table by splitting on _ and PascalCasing each part — no pluralization. Examples:
| SQL table | Auto-derived model name |
|---|---|
user |
User |
api_key |
ApiKey |
branch_deployment |
BranchDeployment |
organizations |
Organizations (stays plural) |
api_keys |
ApiKeys (stays plural) |
If every factory you register is keyed under the auto-derived name, omit table_name_map entirely. The SDK handles the mapping.
You only need table_name_map when a factory key disagrees with the auto-derived name. Common reasons:
- Your tables are plural but you want singular factory keys:
organizationstable ↔Organizationkey. - Legacy short names:
usrtable ↔Userkey,acltable ↔AccessControlkey.
The map is sparse, not exhaustive: only list entries that actually differ. Auto-derivation covers the rest.
# Tables in DB: organization, user, api_key, deal (singular)
# Factories keyed: Organization, User, ApiKey, Deal
# table_name_map = None # auto-derive is exact; omit the kwarg
# Tables in DB: organizations, users, api_keys
# Factories keyed singular → every entry disagrees:
config = HandlerConfig(
...,
table_name_map={
"Organization": "organizations",
"User": "users",
"ApiKey": "api_keys",
},
factories={"Organization": ..., "User": ..., "ApiKey": ...},
)
Red flag: if your table_name_map has one entry per factory and every entry is just a plural↔singular rename, consider keeping factory keys plural (Organizations) and dropping the map entirely. Plural keys are valid — pick whichever convention your scenarios use.
Commands
poetry install --all-extras # install with all adapters
poetry run pytest # run tests
poetry run pytest -k "sqlalchemy" # tests matching pattern
Documentation
For protocol-level documentation, see the root protocol/ directory. For runnable examples, see examples/python/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autonoma_ai-0.2.1.dev1777335389.tar.gz.
File metadata
- Download URL: autonoma_ai-0.2.1.dev1777335389.tar.gz
- Upload date:
- Size: 31.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bffe3d984630993a30abb62a6d2d44f1edd820d749d7edcf17dc2c140a1933c
|
|
| MD5 |
a6797885c4d9e37f39b5281d134323d7
|
|
| BLAKE2b-256 |
f06c8656dd658f6c67fd581f24e8ba687cc5aba375da45f5915683bf65dacbf3
|
Provenance
The following attestation bundles were made for autonoma_ai-0.2.1.dev1777335389.tar.gz:
Publisher:
canary.yml on Autonoma-AI/sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autonoma_ai-0.2.1.dev1777335389.tar.gz -
Subject digest:
5bffe3d984630993a30abb62a6d2d44f1edd820d749d7edcf17dc2c140a1933c - Sigstore transparency entry: 1395783793
- Sigstore integration time:
-
Permalink:
Autonoma-AI/sdk@349b2a4189419610eabc4b6ffd0988789ffeed5f -
Branch / Tag:
refs/heads/tomasipaggio/typed_inputs - Owner: https://github.com/Autonoma-AI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
canary.yml@349b2a4189419610eabc4b6ffd0988789ffeed5f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file autonoma_ai-0.2.1.dev1777335389-py3-none-any.whl.
File metadata
- Download URL: autonoma_ai-0.2.1.dev1777335389-py3-none-any.whl
- Upload date:
- Size: 39.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a6f5003392c30aa19d0de64fd4761724cf0a048344c1604b276ffd88237add5
|
|
| MD5 |
da94edc92508fad5219c4f577a794259
|
|
| BLAKE2b-256 |
1e80f94f7554d00e9bc17d457d099960617b45b180594403aa6af493bcaf1173
|
Provenance
The following attestation bundles were made for autonoma_ai-0.2.1.dev1777335389-py3-none-any.whl:
Publisher:
canary.yml on Autonoma-AI/sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autonoma_ai-0.2.1.dev1777335389-py3-none-any.whl -
Subject digest:
1a6f5003392c30aa19d0de64fd4761724cf0a048344c1604b276ffd88237add5 - Sigstore transparency entry: 1395783806
- Sigstore integration time:
-
Permalink:
Autonoma-AI/sdk@349b2a4189419610eabc4b6ffd0988789ffeed5f -
Branch / Tag:
refs/heads/tomasipaggio/typed_inputs - Owner: https://github.com/Autonoma-AI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
canary.yml@349b2a4189419610eabc4b6ffd0988789ffeed5f -
Trigger Event:
workflow_dispatch
-
Statement type: