Metadata-Version: 2.4
Name: autonai
Version: 1.0.0
Summary: Official Python SDK for AUTON — the operating system for AI-augmented companies.
Project-URL: Homepage, https://getauton.ai
Project-URL: Documentation, https://docs.getauton.ai
Project-URL: Repository, https://github.com/caio-bessa/auton
Author-email: AUTON <hello@getauton.ai>
License: MIT
Keywords: agents,ai,auton,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# autonai

Official Python SDK for [AUTON](https://getauton.ai) — the operating system
for AI-augmented companies. Full docs at
[docs.getauton.ai](https://docs.getauton.ai).

```bash
pip install autonai
```

Requires Python 3.9+.

## Quickstart

```python
import os
from autonai import AutonClient

client = AutonClient(
    base_url="https://api.getauton.ai",
    api_key=os.environ["AUTON_API_KEY"],  # Settings → API keys → auton_pat_…
)

# 1. Spawn a run
run = client.runs.spawn({
    "agent_id": "…",
    "company_id": "…",
    "area_id": "…",
    "actor_user_id": "…",
    "domain_config": {"template_id": "marketing.performance_marketing_manager"},
    "initial_messages": [
        {"role": "user", "content": "Pull last week's perf data and draft a Slack update"},
    ],
})

# 2. Stream deltas (generator; stops at the terminal delta)
for delta in client.runs.stream(run["run_id"]):
    print(delta["seq"], delta["kind"])

# 3. Triage approvals
inbox = client.approvals.list(status="pending")
client.approvals.decide(inbox[0]["id"], verdict="approve", by="…user uuid…", reason="Looks good")
```

## More examples

```python
# Knowledge: upload → search → cite
client.knowledge.upload(
    company_id=company_id,
    title="Brand book",
    source="upload",
    body="Voice: warm, direct, never jargon-heavy…",
)
hits = client.knowledge.search(company_id=company_id, query="brand voice")["hits"]

# Billing: this month's spend vs plan cap
usage = client.billing.usage("this_month")
print(usage["totals"]["cost_usd_micros"] / 1e6, "USD spent")

# Agent manuals: resolve with user preferences inlined
manual = client.agent_manuals.resolve(
    "marketing.performance_marketing_manager",
    company_id=company_id,
    user_preferences={"manual_tone": "concise", "preferred_locale": "pt-BR"},
)

# Heartbeats: a weekday 9am curator tick
hb = client.heartbeats.upsert(**heartbeat_fields)
client.heartbeats.fire_now(hb["id"])
```

## Behaviour

- **Auth** — `Authorization: Bearer <api_key>` on every call.
- **Retries** — idempotent GETs retry on 5xx/network (max 3, exponential
  backoff). Non-idempotent calls never retry unless you pass
  `idempotency_key=`.
- **Rate limits** — `Retry-After` on 429 is honoured automatically; the
  final failure raises `RateLimitError` with `.retry_after`.
- **Errors** — typed: `ValidationError`, `AuthenticationError`,
  `PermissionError_`, `NotFoundError`, `ConflictError`, `RateLimitError`,
  `ServerError` — all subclassing `AutonError` with `.status` / `.request_id`.
- **Self-hosting** — pass `orchestrator_url=` / `knowledge_url=` /
  `approvals_url=` when those services are exposed on their own origins.

Versioning follows the gateway major: `autonai==1.x` ↔ gateway `1.x`.
