Python SDK for d:spatch agent-to-host communication
Project description
dspatch-sdk
Python SDK for building containerized AI agents on the d:spatch orchestration platform.
Agents run inside Docker containers and communicate with the d:spatch router over gRPC. The SDK handles connection lifecycle, turn management, and provides a simple Context API for logging, messaging, inter-agent communication, and user inquiries.
Installation
pip install dspatch-sdk
Requires Python 3.10+.
Quick Start
from dspatch import DspatchEngine, Context
engine = DspatchEngine()
@engine.agent()
async def my_agent(ctx: Context):
await ctx.log("info", "Agent started")
await ctx.message("Hello from my agent!")
engine.run()
With Claude
from dspatch import DspatchEngine, ClaudeAgentContext
engine = DspatchEngine()
@engine.agent(context_class=ClaudeAgentContext)
async def my_agent(ctx: ClaudeAgentContext):
await ctx.run()
engine.run()
With OpenAI
from dspatch import DspatchEngine, OpenAiAgentContext
engine = DspatchEngine()
@engine.agent(context_class=OpenAiAgentContext)
async def my_agent(ctx: OpenAiAgentContext):
await ctx.run()
engine.run()
Context API
The Context object is passed to your agent function each turn:
| Method | Description |
|---|---|
ctx.log(level, message) |
Structured logging (visible in the d:spatch app) |
ctx.activity(description) |
Activity status updates |
ctx.message(content, role) |
Send a message to the conversation |
ctx.files(paths) |
Attach files |
ctx.inquire(question, priority, timeout) |
Ask the user a question (blocks until answered) |
ctx.talk_to(peer, message) |
Send a message to another agent (blocks until response) |
ctx.prompt(text) |
Raw prompt passthrough |
Agent Template
Agents are configured with a dspatch.agent.yml in their project directory:
name: My Agent
description: What this agent does.
entry_point: agent.py
fields:
system_prompt: <base64-encoded prompt>
required_env:
- ANTHROPIC_API_KEY
See the user guide for the full config reference.
Documentation
Full documentation at dspatch.dev/docs.
License
AGPL-3.0 — see LICENSE for details.
Project details
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 dspatch_sdk-0.1.3.tar.gz.
File metadata
- Download URL: dspatch_sdk-0.1.3.tar.gz
- Upload date:
- Size: 44.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cebfa5e2997db6dc1a971fb7e344414b0b7d6c2209b60404d49e651115db017
|
|
| MD5 |
15225386c3a9c3f4216316bb3bb0cb83
|
|
| BLAKE2b-256 |
f9f38be5c374ebf9cc2f063fcf2f08ff88b8c9861de81eee00cb6f9d92201edc
|
Provenance
The following attestation bundles were made for dspatch_sdk-0.1.3.tar.gz:
Publisher:
publish.yml on dspatch/sdk.python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dspatch_sdk-0.1.3.tar.gz -
Subject digest:
6cebfa5e2997db6dc1a971fb7e344414b0b7d6c2209b60404d49e651115db017 - Sigstore transparency entry: 1237154805
- Sigstore integration time:
-
Permalink:
dspatch/sdk.python@7532c1ffe14f9360d7363afc1d182b6913409a9f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/dspatch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7532c1ffe14f9360d7363afc1d182b6913409a9f -
Trigger Event:
push
-
Statement type:
File details
Details for the file dspatch_sdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: dspatch_sdk-0.1.3-py3-none-any.whl
- Upload date:
- Size: 44.0 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 |
bac266a92306e1af0e26adb23bc3ad3f7cb9c014c612fd1c2fcbad7356c9ed53
|
|
| MD5 |
1a00fedb1d503f74ec683718b88e217a
|
|
| BLAKE2b-256 |
e9595d8322639f00fc53afb0c3955fe4c0a54f9f87553799b9237a5e7de66e08
|
Provenance
The following attestation bundles were made for dspatch_sdk-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on dspatch/sdk.python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dspatch_sdk-0.1.3-py3-none-any.whl -
Subject digest:
bac266a92306e1af0e26adb23bc3ad3f7cb9c014c612fd1c2fcbad7356c9ed53 - Sigstore transparency entry: 1237154929
- Sigstore integration time:
-
Permalink:
dspatch/sdk.python@7532c1ffe14f9360d7363afc1d182b6913409a9f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/dspatch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7532c1ffe14f9360d7363afc1d182b6913409a9f -
Trigger Event:
push
-
Statement type: