CXP: Capability Exchange Protocol
CXP is a semantic interoperability protocol for software components. It allows libraries, runtimes, and services to publish their capabilities and telemetry through a small shared contract.
Why CXP?
Modern components are often black boxes. CXP gives them two explicit surfaces:
- Capabilities: So an orchestrator can understand what a component can do.
- Telemetry: So an orchestrator can observe what is happening at runtime.
CXP acts as a semantic bridge, allowing tools like AI agents, test runners, or orchestrators to operate against a shared contract instead of provider-specific assumptions.
Design Goals
- Small Core: Keep the protocol surface narrow and stable.
- High Fidelity: Support expressive catalogs with metadata schemas, shared DTOs, and structured telemetry vocabularies.
- Data-Oriented: Exchange typed data using
msgspecfor high performance. - Omnichannel: From cloud runtimes (ASGI/SQL) to industrial hardware (Zebra/Konica).
Installation
pip install cxp
The base package only requires msgspec. Document exchange is optional:
pip install 'cxp[exchange]'
To pin this release, use pip install 'cxp[exchange]==4.0.0'.
Catalog Layers
CXP includes a growing suite of first-party catalogs organized in six logical layers:
Each layer exposes a family catalog (the abstract contract) plus one or more concrete catalogs that satisfy it.
- Computing:
execution/plan-run,runtime/environment(secrets/resources), and theapplication/httpfamily with concreteapplication/asgi,application/wsgi, andapplication/http-frameworkcatalogs. - Persistence:
database/sql,database/mongodb(both satisfyingdatabase/common),storage/blob,cache/key-value. - Communications:
transport/http(with thetransport/http-familyumbrella andtransport/websocketsibling),messaging/event-bus(concrete:messaging/nats), andnotification/common(concrete:notification/web-push,notification/mobile-push). - Queueing:
queue/task-enginefor background processing. - Experience & Media:
browser/automation(concrete:browser/playwright),media/video-streaming(HLS/DASH). - Industrial:
printing/manager(concrete:printing/labelfor Zebra/ZPL,printing/productionfor Konica Minolta).
For the full list of registered interfaces and operations, see docs/catalogs/index.md.
Quick Start
from cxp import (
Capability,
CapabilityMatrix,
ComponentIdentity,
HandshakeRequest,
get_catalog,
negotiate_with_provider_catalog,
)
# Resolve the standard catalog for the interface
catalog = get_catalog("database/sql")
assert catalog is not None
# Build the orchestrator request
request = HandshakeRequest(
client_identity=ComponentIdentity(
interface="database/sql",
provider="my-orchestrator",
version="1.0.0",
),
required_capabilities=("transactions",),
)
# Negotiate with a provider
# response = negotiate_with_provider_catalog(request, my_sql_provider, catalog)
Key Features
Versioned document exchange (4.0)
cxp.exchange adds strict, portable documents and deterministic three-valued
requirements evaluation alongside the preserved legacy API. It includes exact
quantities, immutable snapshots, content-bound catalogs and opt-in protocol v2
format negotiation. Document specification version 1 is independent of both.
Run the packaged, hardware-free examples with:
python -m cxp.exchange.examples
See the exchange specification, integration guide and 4.0 migration guide. Consumers should review their dependency constraints and integration tests before adopting this major release.
1. Structured Error Reporting (CxpError)
Shared machine-readable error envelopes for catalogs that opt into the semantic layer.
# retryable describes the error, not permission to repeat side effects.
# Reconcile an uncertain outcome first. Only the caller can authorize a retry
# under a reviewed idempotency guarantee and its key/scope/time conditions.
2. High-Fidelity Results
Many first-party operations return structured data defined in results.py (for example HttpResponse, DbCursor, AsyncWorkReport).
3. Bidirectional Validation
Catalogs can define input_schema and result_schema for operations when the domain benefits from explicit request/response contracts.
Documentation
See docs/index.md for the full documentation set:
License
MIT
Contributing
CXP is standalone. See CONTRIBUTING.md for local checks, artifact verification and the separate publication gate. No sibling repositories or internal infrastructure are required.
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 cxp-4.0.0.tar.gz.
File metadata
- Download URL: cxp-4.0.0.tar.gz
- Upload date:
- Size: 202.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ea9eb553f884bc9bc4e377f90575406f5128cae77519a6e87083138e6d0988b
|
|
| MD5 |
7ff67d18438919bc9a22122b80eb1f52
|
|
| BLAKE2b-256 |
5bfacfdf2612c361d76cdd54cd934d806652ccd4e4ba0b3fdb7862e7bdd8754c
|
File details
Details for the file cxp-4.0.0-py3-none-any.whl.
File metadata
- Download URL: cxp-4.0.0-py3-none-any.whl
- Upload date:
- Size: 128.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da5b4ff9dfed59775fa2409d4ce26889888fe1c7143cc15828079287bed3a7d8
|
|
| MD5 |
95657f043ecaf5359234e92ac404084d
|
|
| BLAKE2b-256 |
b3ce87926879df619b5c01fc35a51b7ef4123f5c7d2699d9d9d284c8984a3904
|