Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

agentflowbus (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/agentflowbus/
│   ├── 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 agentflowbus 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> and acp.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.py use 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

Release files for agentflowbus 0.2.0a0

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

Source distribution (sdist)

Source distribution for agentflowbus 0.2.0a0
File Size Uploaded
agentflowbus-0.2.0a0.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentflowbus 0.2.0a0
File Interpreter ABI Platform
agentflowbus-0.2.0a0-py3-none-any.whl Python 3 none any Details

Total release size: 42.6 kB

Release files / agentflowbus-0.2.0a0.tar.gz

Download URL agentflowbus-0.2.0a0.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7bbb1c232ba543e60942efd0dc388baddc15f26d120700f5fbb281c6d2c5647a
BLAKE2b-256 checksum
How to use checksums
ced0ded5da4e5ea1d97f45628314f751375712ae695022015d94e8c6ff4755f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / agentflowbus-0.2.0a0-py3-none-any.whl

Download URL agentflowbus-0.2.0a0-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
460c773b86d21152eac3e0263840f5204e5f1cfb796d075a3c252f59191388a1
BLAKE2b-256 checksum
How to use checksums
803cf07eac2b62db18759b83f7f2476f51765d64aaea02686f2fe643cf65c328
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.2.0a0 This release

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