Skip to main content

ash-ai-sdk

Python SDK for Ash — deploy and orchestrate hosted AI agents.

Installation

pip install ash-ai-sdk

Quick Start

The high-level AshClient is the recommended way to use the SDK. It supports SSE streaming out of the box:

from ash_sdk import AshClient
from ash_sdk.streaming import MessageEvent, TextDeltaEvent, ErrorEvent, DoneEvent

client = AshClient("http://localhost:4100", token="your-api-key")

# Create a session with SDK options
session = client.create_session(
    "my-agent",
    system_prompt="You are a helpful assistant.",
    model="claude-sonnet-4-20250514",
)

# Stream messages with SSE
for event in client.send_message_stream(session.id, "Hello!"):
    if isinstance(event, MessageEvent):
        print(event.data)
    elif isinstance(event, TextDeltaEvent):
        print(event.delta, end="", flush=True)
    elif isinstance(event, ErrorEvent):
        print(f"Error: {event.error}")
    elif isinstance(event, DoneEvent):
        print("\n[Done]")

# Clean up
client.end_session(session.id)

Session Creation Options

All Claude Code SDK options are supported at session creation:

session = client.create_session(
    "my-agent",
    model="claude-sonnet-4-20250514",
    system_prompt="You are a coding assistant.",
    permission_mode="bypassPermissions",
    allowed_tools=["Read", "Write", "Bash"],
    mcp_servers={
        "my-server": {
            "command": "npx",
            "args": ["-y", "@my/mcp-server"],
        }
    },
    betas=["interleaved-thinking"],
)

Async Support

Both the high-level client and the generated API functions support async:

import asyncio
from ash_sdk import AshClient
from ash_sdk.streaming import MessageEvent

async def main():
    client = AshClient("http://localhost:4100", token="your-api-key")
    session = client.create_session("my-agent")

    async for event in client.asend_message_stream(session.id, "Hello!"):
        if isinstance(event, MessageEvent):
            print(event.data)

    client.end_session(session.id)

asyncio.run(main())

Message Options

Control model behavior per-message:

for event in client.send_message_stream(
    session.id,
    "Explain quantum computing",
    model="claude-sonnet-4-20250514",
    max_turns=5,
    max_budget_usd=0.50,
    effort="high",
    thinking={"type": "enabled", "budgetTokens": 10000},
):
    ...

Low-Level API

For direct control, use the auto-generated API functions:

from ash_sdk import AuthenticatedClient
from ash_sdk.api.sessions import post_api_sessions
from ash_sdk.api.agents import get_api_agents
from ash_sdk.models import PostApiSessionsBody

client = AuthenticatedClient(base_url="http://localhost:4100", token="your-api-key")

with client as c:
    agents = get_api_agents.sync(client=c)

    session = post_api_sessions.sync(
        client=c,
        body=PostApiSessionsBody(
            agent="my-agent",
            system_prompt="You are helpful.",
        ),
    )

API Coverage

The SDK covers all Ash API endpoints:

  • Agents — deploy, list, get, delete
  • Sessions — create, list, get, delete, pause, resume, stop, fork
  • Messages — send messages with SSE streaming, list history
  • Files — list, upload, browse session workspaces
  • Credentials — create, list, delete agent secrets
  • Queue — enqueue items, list, get stats
  • Attachments — upload, list, download, delete
  • Usage — track token usage and costs

Links

Metadata

Release files for ash-ai-sdk 0.0.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ash-ai-sdk 0.0.22
File Size Uploaded
ash_ai_sdk-0.0.22.tar.gz 45.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ash-ai-sdk 0.0.22
File Interpreter ABI Platform
ash_ai_sdk-0.0.22-py3-none-any.whl Python 3 none any Details

Total release size: 177.8 kB

Release files / ash_ai_sdk-0.0.22.tar.gz

Download URL ash_ai_sdk-0.0.22.tar.gz
Size 45.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6e78c49f0f12360694a9aa2dab5bf341ceb077c212b300f34016360121efc346
BLAKE2b-256 checksum
How to use checksums
cfa528354a56d332c2a7497140fa31f130abd2c88d9e0f0ef408fd8ce5886827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

Release files / ash_ai_sdk-0.0.22-py3-none-any.whl

Download URL ash_ai_sdk-0.0.22-py3-none-any.whl
Size 132.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
173f18696966a612bbd55c36a436ebaa688e6beeb6e9f51a69f408f1f4e4fd41
BLAKE2b-256 checksum
How to use checksums
2eaa8e9441dfa9eb380fc8b74cabe9290f3b30ab85efdd23230d8dd90e5e93b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.22 This release

2 release files

0.0.21

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page