Python SDK for OpenAgentIO — ACP-compatible Envelope protocol on top of NATS / asyncio.
Project description
openagentio (Python SDK)
ACP-compatible Envelope protocol on top of NATS / asyncio. The protocol is shared with the Go SDK at the repo root; transport layers are implemented independently per language.
v0.2 skeleton — feature-equivalent surface to Go v0.1.
Layout
sdk/python/
├── pyproject.toml
├── src/openagentio/
│ ├── event/ # Envelope dataclass, event-type constants, payload shapes
│ ├── codec/ # JSON codec
│ ├── transport/ # base ABC + InMemoryDriver + NATSDriver
│ └── bus/ # Bus, Stream, StreamWriter, subject layout
├── tests/ # pytest, pytest-asyncio
└── examples/
└── echo_agent.py
Install (development)
cd sdk/python
python3.11 -m venv .venv # already done in this repo
.venv/bin/pip install -e ".[dev]"
Run tests
.venv/bin/pytest # unit tests (in-memory transport)
AFB_NATS_URL=nats://localhost:4222 .venv/bin/pytest tests/test_nats_integration.py
The NATS integration tests are gated on the AFB_NATS_URL env var. Start a
local broker first, e.g. nats-server -p 4222.
Example
import asyncio
from openagentio import Bus, InMemoryDriver
async def main() -> None:
bus = Bus(agent_id="echo", transport=InMemoryDriver())
await bus.connect()
async def echo(env):
return env.payload_json()
await bus.handle_invoke("echo", echo)
resp = await bus.invoke("echo", {"msg": "hello"})
print(resp.event_type, resp.payload_json())
await bus.close()
asyncio.run(main())
See examples/echo_agent.py for a runnable version that mirrors
examples/echo-agent/main.go from the Go SDK.
Protocol
The wire format is shared with the Go SDK:
spec_version = "acp/1.0",schema_version = 1- UUIDv7
event_id(RFC 9562) with UUIDv4 fallback - Subject layout
acp.v1.events.<event_type>andacp.v1.invoke.<target>(with optional<tenant>segment) - Envelopes published by Go can be decoded in Python and vice versa; the
golden tests in
tests/test_envelope.pyuse shared sample envelopes from<repo>/schema/samples/.
Status
| Surface | Status |
|---|---|
| Envelope (v0.1) | ✅ wire-compatible |
| In-memory transport | ✅ |
| NATS transport | ✅ (nats-py) |
| Pub / Sub | ✅ |
| Invoke / Reply | ✅ |
| Stream Invoke | ✅ |
| Middleware framework | ⏭ v0.3 |
| JetStream | ⏭ v0.3 |
| Sync wrapper | ⏭ v0.3 |
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 openagentio-0.2.0a0.tar.gz.
File metadata
- Download URL: openagentio-0.2.0a0.tar.gz
- Upload date:
- Size: 35.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7ff057121c658fe4181418e9ace66f9a39cb686790c2bfc96e6b5ce5fac329e
|
|
| MD5 |
9a1868683fd182941d646947eca878ee
|
|
| BLAKE2b-256 |
1721e5bf4be5f1d1231710ad635e8aa6d7da5c66b8c23f29bdd47609c76b5963
|
File details
Details for the file openagentio-0.2.0a0-py3-none-any.whl.
File metadata
- Download URL: openagentio-0.2.0a0-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ad1a9427936528cd2481fb5eeba3702617c51f6426a1c6fbe013f836170a7b7
|
|
| MD5 |
4d762741984fd189c0781265e0e40941
|
|
| BLAKE2b-256 |
eec63de189d70761d5dbd9aa235b70fb178bd438cd3ae114bbf064204c488af9
|