Skip to main content

Capability Exchange Protocol

Project description

CXP: Capability Exchange Protocol

Version Python CI

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 msgspec for high performance.
  • Omnichannel: From cloud runtimes (ASGI/SQL) to industrial hardware (Zebra/Konica).

Installation

pip install cxp

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.

  1. Computing: execution/plan-run, runtime/environment (secrets/resources), and the application/http family with concrete application/asgi, application/wsgi, and application/http-framework catalogs.
  2. Persistence: database/sql, database/mongodb (both satisfying database/common), storage/blob, cache/key-value.
  3. Communications: transport/http (with the transport/http-family umbrella and transport/websocket sibling), messaging/event-bus (concrete: messaging/nats), and notification/common (concrete: notification/web-push, notification/mobile-push).
  4. Queueing: queue/task-engine for background processing.
  5. Experience & Media: browser/automation (concrete: browser/playwright), media/video-streaming (HLS/DASH).
  6. Industrial: printing/manager (concrete: printing/label for Zebra/ZPL, printing/production for 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

1. Structured Error Reporting (CxpError)

Shared machine-readable error envelopes for catalogs that opt into the semantic layer.

if response.error and response.error.retryable:
    # Orchestrator can decide to retry automatically
    await retry_operation()

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

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

cxp-3.1.0.tar.gz (93.8 kB view details)

Uploaded Source

Built Distribution

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

cxp-3.1.0-py3-none-any.whl (93.0 kB view details)

Uploaded Python 3

File details

Details for the file cxp-3.1.0.tar.gz.

File metadata

  • Download URL: cxp-3.1.0.tar.gz
  • Upload date:
  • Size: 93.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for cxp-3.1.0.tar.gz
Algorithm Hash digest
SHA256 71c119a0380adcda45fc78c2d9e8953eb7824ff09638bfc58e1afe6409df4b49
MD5 36626dcf14f16abdea8c767c4ff6f444
BLAKE2b-256 4c839f696bd1df550feb11a7a6ff8d9c6707d5cc9b0a402fba1336801b95ac9f

See more details on using hashes here.

File details

Details for the file cxp-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: cxp-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 93.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for cxp-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59c698905552016aec4fc0bb0f7ef7ea0ed6fa7b588021aec4118ff63e609fb0
MD5 2ccb91274ba82a2ffc4366d7e0a41584
BLAKE2b-256 9d8cb77df892bb3cb86b04f506383daacdb602677a4f0308d9a6b40a69dc9f68

See more details on using hashes here.

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