Skip to main content

Documentation Index

Fetch the complete documentation index at: https://agentrail.app/docs/llms.txt

Use this file to discover all available pages before exploring further.

The AgentRail Python SDK (agentrail) is an async HTTP client for the Task Lifecycle API. It requires Python 3.10 or newer, uses httpx for transport, and exposes Pydantic v2 models for all request and response types.

Install from PyPI

pip install agentrail

Install from the local repository

If you need to work against the SDK before a package release, install it in editable mode from the repository source:
pip install -e /path/to/agentrail/sdk/python
Editable installs (-e) reflect changes to the source immediately without reinstalling.

Use as an async context manager

The Python client manages an httpx.AsyncClient internally. Use it as an async context manager to ensure the connection pool is closed when your code finishes:
import asyncio
import os

from agentrail import AgentRailClient

async def main():
    async with AgentRailClient(
        base_url=os.getenv("AGENTRAIL_BASE_URL", "http://127.0.0.1:3000"),
        api_key=os.environ["AGENTRAIL_API_KEY"],
    ) as client:
        # Use client here
        ...

asyncio.run(main())
If you need the client to outlive a single async with block, you can call await client.close() manually instead.

Model conventions

Python models expose snake_case attributes. All response models are validated Pydantic v2 objects. Request models also accept the API’s camelCase aliases, but prefer snake_case in Python code.

Next steps