Python SDK for the Ash AI agent orchestration platform
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ash_ai_sdk-0.0.22.tar.gz.
File metadata
- Download URL: ash_ai_sdk-0.0.22.tar.gz
- Upload date:
- Size: 45.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e78c49f0f12360694a9aa2dab5bf341ceb077c212b300f34016360121efc346
|
|
| MD5 |
94916fd808ff5d48344903d66d9323fd
|
|
| BLAKE2b-256 |
cfa528354a56d332c2a7497140fa31f130abd2c88d9e0f0ef408fd8ce5886827
|
Provenance
The following attestation bundles were made for ash_ai_sdk-0.0.22.tar.gz:
Publisher:
publish-pypi.yml on ash-ai-org/ash-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ash_ai_sdk-0.0.22.tar.gz -
Subject digest:
6e78c49f0f12360694a9aa2dab5bf341ceb077c212b300f34016360121efc346 - Sigstore transparency entry: 1078599917
- Sigstore integration time:
-
Permalink:
ash-ai-org/ash-ai@4bda28abb4071d0a62b0451e6b6ea0cedc5a55f5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ash-ai-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@4bda28abb4071d0a62b0451e6b6ea0cedc5a55f5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ash_ai_sdk-0.0.22-py3-none-any.whl.
File metadata
- Download URL: ash_ai_sdk-0.0.22-py3-none-any.whl
- Upload date:
- Size: 132.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
173f18696966a612bbd55c36a436ebaa688e6beeb6e9f51a69f408f1f4e4fd41
|
|
| MD5 |
4b9ffd35a70825fcb9b390f8ca5e1ffa
|
|
| BLAKE2b-256 |
2eaa8e9441dfa9eb380fc8b74cabe9290f3b30ab85efdd23230d8dd90e5e93b8
|
Provenance
The following attestation bundles were made for ash_ai_sdk-0.0.22-py3-none-any.whl:
Publisher:
publish-pypi.yml on ash-ai-org/ash-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ash_ai_sdk-0.0.22-py3-none-any.whl -
Subject digest:
173f18696966a612bbd55c36a436ebaa688e6beeb6e9f51a69f408f1f4e4fd41 - Sigstore transparency entry: 1078599938
- Sigstore integration time:
-
Permalink:
ash-ai-org/ash-ai@4bda28abb4071d0a62b0451e6b6ea0cedc5a55f5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ash-ai-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@4bda28abb4071d0a62b0451e6b6ea0cedc5a55f5 -
Trigger Event:
push
-
Statement type: