Skip to main content
The Python SDK is a thin wrapper around the Task API. Every endpoint is a method on client.tasks; client.run() is the high-level helper that starts a task, polls until it finishes, and returns the output.

Install

Clients

Both clients support context managers (with AutumnClient() as client: / async with AsyncAutumnClient() as client:).

High-level

In the async client, client.run(...) returns an AsyncRunHandle that is both awaitable (await client.run(...)RunResult) and async-iterable (async for msg in run).

RunResult

Output rows come back as “cell” objects: each field is {"value": ..., "source_id": ...} plus metadata like _sources and _validation. result.output flattens these to plain {field: value} dicts for you; use result.rows when you need the sources and provenance.

Resources

All map one-to-one to Task API routes:

Attach a CSV

files.upload() runs the whole three-call upload for you: it creates a task if you do not pass task_id, presigns, PUTs the bytes without your API key attached, and validates.
attached carries the validated shape — filename, rows, fields, renamed, delimiter, and extra_columns. Pass content= with filename= instead of path to upload from memory. Accepts .csv, .txt, .md, .markdown up to 10 MB / 10,000 rows. The async client exposes the same method as await client.files.upload(...).

Errors

OutOfCreditsError maps to HTTP 402, TaskExecutingError to 409, AuthenticationError to 401, TaskNotFoundError to 404. RunTimeoutError is raised if run() exceeds its timeout.

Terminal state

A finished task returns to status: "plan" with activity: "idle". Use autumn_sdk.types.is_terminal(task) rather than checking status directly. run() and stream() already do.

See also

Structured output

Live messages