Skip to main content

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, schema)
autonoma-ai[django] Django server handler
autonoma-ai[flask] Flask server adapter
autonoma-ai[fastapi] FastAPI server adapter
autonoma-ai[all] All server adapters

Quick Start

Install

pip install autonoma-ai
# With extras:
pip install "autonoma-ai[fastapi]"
# Or everything:
pip install "autonoma-ai[all]"

FastAPI

from pydantic import BaseModel, ConfigDict
from autonoma.types import HandlerConfig
from autonoma.factory import define_factory
from autonoma_fastapi import create_fastapi_handler

class OrganizationInput(BaseModel):
    model_config = ConfigDict(extra="ignore")
    name: str
    slug: str

def create_org(data, ctx):
    org = db.create_organization(name=data.name, slug=data.slug)
    return {"id": str(org.id), "name": org.name, "slug": org.slug}

def teardown_org(record, ctx):
    db.delete_organization(record["id"])

config = HandlerConfig(
    scope_field="organization_id",
    shared_secret="your-shared-secret",
    signing_secret="your-signing-secret",
    factories={
        "Organization": define_factory(
            create=create_org,
            input_model=OrganizationInput,
            teardown=teardown_org,
        ),
    },
    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")

Commands

poetry install --all-extras   # install with all adapters
poetry run pytest              # run tests

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

autonoma_ai-0.2.8.dev1783151896.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autonoma_ai-0.2.8.dev1783151896-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file autonoma_ai-0.2.8.dev1783151896.tar.gz.

File metadata

File hashes

Hashes for autonoma_ai-0.2.8.dev1783151896.tar.gz
Algorithm Hash digest
SHA256 74ffbf9dd23766e01aecbf1a55e0089e93b17638591c31c2a229362ca08fbb69
MD5 afead2651e24f108d58a8f9c32c5407a
BLAKE2b-256 fcfab25f6c3a0f08dd9836680e3de6d1f02f742d2dd1e42a2a15da40ac52e39e

See more details on using hashes here.

Provenance

The following attestation bundles were made for autonoma_ai-0.2.8.dev1783151896.tar.gz:

Publisher: canary.yml on Autonoma-AI/sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file autonoma_ai-0.2.8.dev1783151896-py3-none-any.whl.

File metadata

File hashes

Hashes for autonoma_ai-0.2.8.dev1783151896-py3-none-any.whl
Algorithm Hash digest
SHA256 b0046c814b9472e4ae8fb515c6e9200904582aba3d6f1dd84c3391fdf19e3467
MD5 59e82266db922c6ccb6272e544026c61
BLAKE2b-256 9dbb6304f5f7e49133281c6cef25d1db5651c2929e495065efa6079c4dec79a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for autonoma_ai-0.2.8.dev1783151896-py3-none-any.whl:

Publisher: canary.yml on Autonoma-AI/sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page