Python SDK

The Python SDK is a fully async client for building agents on the Athyr platform. It provides the same orchestration patterns, middleware, and resilience features as the Go SDK, designed for Python’s async/await paradigm.

Installation

pip install git+https://github.com/athyr-tech/athyr-sdk-python.git

Requires Python 3.10+ and a running Athyr server.

Quick Start

import asyncio
from athyr import AthyrAgent, AgentCard, CompletionRequest, Message

async def main():
    async with AthyrAgent(
        "localhost:9090",
        agent_card=AgentCard(name="my-agent", description="My first Athyr agent"),
    ) as agent:
        resp = await agent.complete(CompletionRequest(
            model="llama3",
            messages=[Message(role="user", content="Hello!")]
        ))
        print(resp.content)

asyncio.run(main())

Features

Core Agent

Orchestration Patterns

Located in athyr.orchestration:

PatternDescription
PipelineSequential agent chain (A → B → C)
FanOutParallel execution with aggregation
HandoffDynamic routing via triage agent
GroupChatMulti-agent collaborative discussion

Middleware

Tool Calling

Define tools with the @tool decorator:

from athyr import tool, ToolRegistry, run_tool_loop

@tool(description="Get weather for a city")
def get_weather(city: str, unit: str = "celsius") -> str:
    return f"Weather in {city}: sunny"

registry = ToolRegistry()
registry.register(get_weather)

response = await run_tool_loop(agent, request, registry)

Documentation

Full documentation and examples are maintained in the SDK repository:

Available Examples

ExampleDemonstrates
quickstartBasic agent setup
streamingStreaming LLM responses
messagingPub/sub and request/reply
tool_callingLLM function calling
chat_agentMemory sessions
pipelineSequential orchestration
fanoutParallel execution
groupchatMulti-agent collaboration
handoffDynamic routing via triage
resilient_agentError handling and retries

Next Steps