Skip to main content

SOX Protocol — reference Python implementation of the inter-agent channels protocol.

Project description

sox-protocol

PyPI License Python

Runtime-agnostic peer messaging for LLM agents. SOX Protocol gives multi-agent systems a documented, conformant pattern for speculative-execute-while-awaiting-clarification: when agent A needs input from agent B, A posts the question, continues working under a best-guess interpretation, and non-destructively integrates B's late-arriving answer into its in-progress reasoning — without blocking.

Existing frameworks offer turn-taking schedulers, handoffs, or actor primitives. None ship a packaged discipline for the speculate-then-reconcile pattern. SOX does.

This package is the reference Python implementation. It's SOX v1.0-conformant on both stdio and HTTP transports (33/33 fixtures pass on each).


Install

pip install sox-protocol sox-plugin-schema-strict
sox-protocol install                  # in your Claude Code project root

The installer writes:

  • .mcp.json — registers the SOX MCP server with Claude Code
  • .claude/settings.json — allows the server + adds cadence hooks
  • .claude/skills/inter-agent-channels/SKILL.md — the discipline document
  • tools/sox-hooks/{post_tool_use,stop}.sh — inbox-cadence reminder hooks

Verify:

claude mcp list           # → sox: ... ✓ Connected
sox-protocol verify       # full backing-store / MCP / hook / skill probe

Install the schema-strict plugin non-editable (no -e). Its sox-plugin.yaml manifest isn't exposed via editable installs and the MCP server fails plugin discovery without it.


CLI surface

sox-protocol --help
  serve            Start the SOX server (stdio | http transport)
  chat             Launch the interactive Textual TUI
  install          Install the SOX adapter into a Claude Code project
  upgrade          PyPI check + pip-upgrade + file refresh + SQLite migration
  verify           Health-check the project's SOX install
  lint-discipline  Validate a discipline markdown file
  version          Print the installed version

  -V, --version    Print the installed version and exit

Two practical recipes

Boot a long-running agent companion. Two terminals against the same project:

# Terminal 1 — interactive TUI; auto-discovers the project's .mcp.json
sox-protocol chat --agent-id $(whoami) --channel agent/companion

# Terminal 2 — Claude Code as the agent
SOX_AGENT_ID=companion claude

The TUI and Claude Code share the same SQLite store automatically.

One-step skill activation. When you want the skill itself to subscribe an agent on load (instead of needing a follow-up prompt), use --auto-subscribe:

sox-protocol install --auto-subscribe --channel team/eng

The installed SKILL.md then includes an Activation block that tells the LLM to subscribe to agent/<your-id> + team/eng, drain pending messages once, and emit a heartbeat — all on first skill load.

Upgrade-in-place

sox-protocol upgrade
# Step 1/3: checking PyPI for newer versions…
#   sox-protocol             local=0.1.5  latest=0.1.6  → upgrade available
#   sox-plugin-schema-strict local=1.0.0  latest=1.0.0
#   Upgrading 1 package(s) via pip…
# (auto re-execs with the new code)
# Step 2/3: refreshing installed files…
# Step 3/3: SQLite schema migration…

Single command from "I just heard there's a new release" to "everything aligned": pip packages, project files, schema migrations, all converged in one run. Add --check-only for drift detection without changes.


What's in the box

  • Four MCP toolschannels__send, channels__recv, channels__subscribe, channels__list_channels. All non-blocking; the discipline + cadence enforcer keep the pull-based design from causing starvation.
  • Three backing stores — SQLite (default, WAL mode), filesystem, in-memory (tests only). NATS / Redis pluggable via the BackingStore port.
  • Two transports — stdio (Claude Code default) and HTTP (sox-protocol serve --transport http). Both pass the same conformance suite.
  • Plugin contract — third-party plugins extend the pipeline (schema validation, audit logging, rate limiting) via the sox_protocol.plugins entry-point group. The schema-strict reference plugin proves the contract end-to-end.
  • Cadence enforcer — pure-function decision engine that injects "drain your inbox" reminders after N tool calls without a recv, and blocks agent exit while the inbox is non-empty. Operator-tunable via env vars.
  • Live install e2e testpytest -m live spawns two real claude CLI subprocesses against a tmp venv, has them exchange messages via the protocol, asserts on the SQLite state. Verified end-to-end on both Anthropic API and Claude Max subscription auth paths.

Project layout

The sox-protocol PyPI distribution is one component of the pseudosky/sox-protocol monorepo:

Path Contents
packages/python/ this package — reference Python implementation
plugins/sox-plugin-schema-strict/ the canonical reference plugin, published as sox-plugin-schema-strict on PyPI
spec/ language-neutral protocol artefacts (JSON Schema for tools/events, conformance fixtures, discipline markdown, port behaviour contracts)
docs/ design rationale, integration guide, ADRs
tools/conformance_runner.py language-neutral conformance harness — runs spec/conformance/*.yaml against any implementation

For full design rationale and the formal spec see the GitHub repo and especially docs/DESIGN.md, docs/USAGE.md, and docs/INSTALL.md.


Status & conformance

Component Status Conformance
Spec (v1.0) Frozen; language-neutral n/a
Python (this package) Production-ready 33/33 stdio · 33/33 HTTP
TypeScript Placeholder; open to contributions Must pass conformance suite to merge
Rust Placeholder; open to contributions Same
python -m pytest -q
# 1300+ passed
python tools/conformance_runner.py --target packages/python --transport stdio --strict
# Results: 33 passed, 0 failed, 34 skipped / 67 total

License

Apache 2.0, including the express patent grant in §3. Contributors and adopters are protected from patent assertions on the protocol primitives they help build or use. See the repo's docs/ip/ for the IP strategy and OIN application tracker.

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

sox_protocol-0.2.1.tar.gz (328.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sox_protocol-0.2.1-py3-none-any.whl (490.9 kB view details)

Uploaded Python 3

File details

Details for the file sox_protocol-0.2.1.tar.gz.

File metadata

  • Download URL: sox_protocol-0.2.1.tar.gz
  • Upload date:
  • Size: 328.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sox_protocol-0.2.1.tar.gz
Algorithm Hash digest
SHA256 147e646622388722803a855ac57f14a24dc3011fe5e1147fa9eb606ac787a678
MD5 6e32e17f5a61900a89202f06a9991c73
BLAKE2b-256 85869dcb51ecb2da5ee531e5a104f0c3b62b7eeae11f4872c9c486e42c098f9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for sox_protocol-0.2.1.tar.gz:

Publisher: python-publish.yml on PseudoSky/sox-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sox_protocol-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sox_protocol-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 490.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sox_protocol-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72e95e1d3133a48c38beb7c3941106a703157af0d776b211ef4f692a7e1d9cf9
MD5 149b210bbce66a6eee58b08598837f8d
BLAKE2b-256 59e4e67c07a807df078182f049a7c966056eb13f25ca2e47f67da0e201e7313a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sox_protocol-0.2.1-py3-none-any.whl:

Publisher: python-publish.yml on PseudoSky/sox-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page