Skip to main content

Official Python SDK for the Colber platform (identity, reputation, memory, observability, negotiation, insurance).

Project description

colber-sdk

Official Python SDK for the Colber platform — typed clients for the six v1 services (identity, reputation, memory, observability, negotiation, insurance) plus the platform crypto primitives (did:key Ed25519, RFC 8785 JCS canonicalization, signing helpers).

Mirror of the TypeScript SDK (@colber/sdk@0.1.0). Same surface, same wire format, signatures produced here verify against payloads signed by the TS SDK and vice versa.

Runtime dependencies: httpx (sync) + cryptography (Ed25519 + sha512). No pydantic, no requests, no pynacl.

Install

pip install colber-sdk

The package is PyPI-publishable as colber-sdk, but is not yet released. Use editable install from this repo while in v0.1.0:

pip install -e apps/sdk-python

Quick start

from colber_sdk import ColberClient
from colber_sdk.crypto import generate_did_key, sign_message, canonicalize_jcs

# 1) Mint a fresh DID + Ed25519 keypair (did:key method, multibase z6Mk...).
keys = generate_did_key()

# 2) Point the client at your services. local() targets the β-VM ports.
client = ColberClient.local()

# 3) Register the agent and read its score.
agent = client.identity.register(public_key=keys.public_key_b64, owner_operator_id="op-demo")
envelope = client.reputation.score(did=keys.did)
print(envelope.score)  # 500 (base score for a brand-new agent)

# 4) Sign a JCS-canonical payload.
sig = sign_message(
    keys.secret_key_b64,
    canonicalize_jcs({"did": keys.did, "score": envelope.score}),
)

Convenience constructors

ColberClient.local()                                # localhost ports 14001..14051
ColberClient.from_base_url("https://api.colber.dev") # future ingress; PROVISIONAL

Errors

  • ColberApiError — service returned { ok: false, error: { code, message, details? } } (4xx/5xx).
  • ColberNetworkError — request failed at the transport layer (timeout, fetch error, malformed body).
  • ColberValidationError — local SDK rejected the call before sending. Currently unused, reserved for v0.2.

All three extend ColberError so callers can do a single base catch.

Idempotency

negotiation.start, insurance.subscribe, and insurance.claim accept an optional idempotency_key: str | None = None keyword argument. The SDK forwards it verbatim — generation is the caller's responsibility.

client.negotiation.start(
    terms=terms,
    created_by="did:key:zA",
    idempotency_key="my-unique-key-123",
)

Async support

Synchronous-only in v0.1.0. Async support (AsyncColberClient backed by httpx.AsyncClient) is planned for v0.2 — the public method names will mirror the sync surface with the async/await keywords added.

License

UNLICENSED (private, proprietary). See the root package.json.

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

colber_sdk-0.1.1.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

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

colber_sdk-0.1.1-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file colber_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: colber_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for colber_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 56e575abd0782dcc9db7454c2b9e52a3ad3d4c4c65c3501c319994ddbcfa25e4
MD5 f1e6b2600729de95936caecb65110489
BLAKE2b-256 c595bf410709df454c0a22ad6723f8f1ba93a433a34b4ff6dca09da8668cc98b

See more details on using hashes here.

File details

Details for the file colber_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: colber_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 36.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for colber_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf0738be42b5e3f0c942b958bc0095722f3f871770bf2b1262e29f2aa7a69cac
MD5 40a985d229afb8b1295bfe6ff8283d78
BLAKE2b-256 3aaaa14ffb59cfd575b90c82d99221b6a214ca1b13c0ceba338be5301a75e368

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