Skip to main content

Symmetric Context Exchange Protocol (SCXP) SDK for Python: consumer + provider surface, handshake, id correlation/dispatch, and Gen A tool-schema generation. Transport-agnostic.

Project description

scxp

Python SDK for the Symmetric Context Exchange Protocol (SCXP) — a protocol for exchanging tool catalogs and tool calls between a consumer (which discovers and invokes tools) and a provider (which registers and serves them).

The SDK is transport-agnostic: you bring the transport (WebSocket, TCP, stdio, ...) by implementing a small Channel, and the SDK handles the protocol — handshake, id correlation, batching, and tool-schema generation.

Install

pip install scxp

Requires Python 3.11+.

Provider — expose tools

from scxp import Provider, ProviderCatalog, tool, Info

class Tools:
    @tool(name="add", domain="com.example.math", description="Add two integers.")
    def add(self, a: int, b: int) -> int:
        return a + b

catalog = ProviderCatalog.from_object(Tools(), Info(name="my-provider", version="1.0.0"))

# `channel` is your Channel implementation, already connected.
provider = await Provider.create(channel, catalog)
# The provider now serves tools/list and tools/call.

Consumer — discover and invoke tools

from scxp import Consumer, ConsumerConfig, Info

# `channel` is your Channel implementation, already connected.
consumer = await Consumer.create(
    channel, ConsumerConfig(info=Info(name="my-app", version="1.0.0"))
)

manifest = await consumer.list_tools()          # discover
result = await consumer.call_tool("add", {"a": 2, "b": 3})   # invoke
print(result.content[0].text)  # "5"

Bring your own transport

Implement Channel (send bytes, receive bytes, observe close). A runnable WebSocket example lives under examples/.

from scxp import Channel  # a typing.Protocol with: send / on_message / on_close

Docs

  • Consumer and provider integration guides: docs/
  • Protocol spec and JSON Schemas: the SCXP repository

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

scxp-0.1.0.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

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

scxp-0.1.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file scxp-0.1.0.tar.gz.

File metadata

  • Download URL: scxp-0.1.0.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for scxp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 146e83f6e43489218f41cb2087caa251ae1f075ab43a8941f3c58f54eed9a8c2
MD5 e393f1c52518999f7370953995238650
BLAKE2b-256 7113118726385635898fd163f479f38c5c2b442b05111436f482de933958ef5d

See more details on using hashes here.

File details

Details for the file scxp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: scxp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for scxp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e196f6e7d8353a7b0748b73b468b2f5a42c670fe6c4aafc1a497196f12fb762f
MD5 9794efa5a5bb644f36957a703d21eff8
BLAKE2b-256 530c147dd992c9edc749f5cbf62c39aa439baf3347eaf460765b263d3c711505

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