Metadata-Version: 2.5
Name: a13n
Version: 0.9.0
Summary: Python SDK for a13n Service
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.13
Requires-Dist: attrs<27,>=25
Requires-Dist: httpx<1,>=0.28
Requires-Dist: jsonschema<5,>=4.23
Requires-Dist: pydantic<3,>=2.12
Requires-Dist: python-dateutil<3,>=2.9
Requires-Dist: websockets<16,>=15
Description-Content-Type: text/markdown

# a13n Python SDK

Use the async Python SDK to run agents and work with the resources of a13n Service 0.9.0. The SDK requires Python 3.13 or newer.

## Quick start

Install with `pip install a13n`. Set `A13N_SERVICE_URL` to your Service base URL, `A13N_API_KEY` to a workspace API key, and `A13N_AGENT` to an agent ID available in that workspace.

```python
import asyncio
import os
from a13n import Client


async def main():
    async with Client() as client:
        run = await client.agents(os.environ["A13N_AGENT"]).run("Say hello.")
        print(run.text)


asyncio.run(main())
```

## Continue the conversation

Inside the client context, use `chat = client.agents(agent_id).chat()` and call `await chat.run(prompt)` for each turn. Pass `thread=thread_id` to continue an existing conversation. Save `run.thread_id` if you need to reopen it later.

## Stream progress

```python
async with client.agents(agent_id).stream("Summarize the project.") as stream:
    async for text in stream.text_stream:
        print(text, end="", flush=True)
    run = await stream.result()
```

The stream previews live text; `run.text` comes from the saved Run. Use `agent.submit()` to save an inbox receipt before waiting or to hand off waiting to another process.

## Native Service API

Resource collections live directly on `Client`. Call a collection with an ID to select a resource. Access optional wire evidence from `client.with_raw_response`.

```python
async for agent in client.agents.list():
    print(agent.id)
response = await client.with_raw_response.agents(agent_id).get()
print(response.status_code, response.request_id, response.parsed)
```

## Next steps

- [Python SDK guide](docs/README.md)
- [Moving to 0.9.0](docs/execution-and-migration.md)
- [Development and validation](CONTRIBUTING.md)
