Skip to main content

Typed Python SDK for the Cordum control plane.

Project description

cordum-sdk

Typed Python SDK for the Cordum control plane.

cordum-sdk is generated from the canonical OpenAPI spec and wrapped with a small hand-tuned facade for:

  • sync and async clients
  • auth helpers
  • retry/backoff policy
  • typed error mapping
  • pagination helpers
  • streaming/SSE helpers

Install

pip install cordum-sdk

Sync quickstart

from cordum_sdk import CordumClient

with CordumClient("https://api.cordum.example", auth="cordum_api_key", tenant_id="tenant-123") as client:
    jobs = client.jobs.list_jobs()
    for job in jobs.items:
        print(job.id, job.state)

Async quickstart

from cordum_sdk import AsyncCordumClient

async with AsyncCordumClient("https://api.cordum.example", auth="cordum_api_key", tenant_id="tenant-123") as client:
    jobs = await client.jobs.list_jobs()
    print(len(jobs.items))

Authentication

API key

from cordum_sdk import CordumClient

client = CordumClient("https://api.cordum.example", auth="cordum_api_key", tenant_id="tenant-123")

Bearer token

from cordum_sdk import CordumClient
from cordum_sdk.auth import BearerTokenAuth

client = CordumClient(
    "https://api.cordum.example",
    auth=BearerTokenAuth("bearer-token"),
    tenant_id="tenant-123",
)

Session login

from cordum_sdk import AsyncCordumClient
from cordum_sdk.auth import SessionAuth

auth = SessionAuth("https://api.cordum.example", email="you@example.com", password="correct-password")
client = AsyncCordumClient("https://api.cordum.example", auth=auth, tenant_id="tenant-123")

SAML redirect flow

import httpx

from cordum_sdk import CordumClient
from cordum_sdk.auth import SamlAuth


def exchange_relay_state(relay_state: str) -> dict[str, str]:
    with httpx.Client(base_url="https://api.cordum.example") as http_client:
        response = http_client.post("/api/v1/auth/saml/acs", json={"relay_state": relay_state})
        response.raise_for_status()
        return response.json()


auth = SamlAuth("https://idp.example.com/sso/start", exchange_relay_state)
print("Open:", auth.initiate())
auth.complete("relay-state-from-callback")

client = CordumClient("https://api.cordum.example", auth=auth, tenant_id="tenant-123")

Retries + Idempotency-Key

Retries are enabled by default for idempotent methods (GET, HEAD, PUT, DELETE, OPTIONS) and for POST only when you supply an idempotency key.

from uuid import uuid4

from cordum_sdk import CordumClient
from cordum_sdk._generated.models.submit_job_request import SubmitJobRequest

with CordumClient("https://api.cordum.example", auth="cordum_api_key", tenant_id="tenant-123") as client:
    response = client.jobs.submit_job(
        body=SubmitJobRequest(prompt="hello"),
        idempotency_key=uuid4(),
    )
    print(response.job_id)

Pagination + Streaming

from cordum_sdk import CordumClient

with CordumClient("https://api.cordum.example", auth="cordum_api_key", tenant_id="tenant-123") as client:
    for job in client.jobs.paginate("list_jobs"):
        print(job.id)

    for event in client.mcp.stream():
        print(event.event, event.data)
        break

Error handling

Exception Status
AuthenticationError 401
AuthorizationError 403
NotFoundError 404
ConflictError 409
ValidationError 400 / 422
RateLimitError 429
ServerError 5xx
NetworkError / TimeoutError transport / timeout
from cordum_sdk.errors import NotFoundError

Typed models

  • Streaming events use the Pydantic v2 StreamEvent model.
  • Generated request/response models live in cordum_sdk._generated.models.
  • Friendly resource namespaces (client.jobs, client.workflows, etc.) return those generated typed models directly.

Compatibility

  • Python 3.9+
  • Generated from docs/api/openapi/cordum-api.yaml
  • Current bundled spec version: 2026-04-13

Examples

  • examples/hello_world.py
  • examples/async_streaming.py
  • docs/quickstart.md

Regenerating from the spec

python -m pip install -e ".[generator]"
bash scripts/generate.sh

On Windows PowerShell:

python -m pip install -e ".[generator]"
.\scripts\generate.ps1

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

cordum_sdk-0.1.0.tar.gz (152.6 kB view details)

Uploaded Source

Built Distribution

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

cordum_sdk-0.1.0-py3-none-any.whl (511.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cordum_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d16da8d82f6e29da4879a9997e98667063cdfee8c2b6eec214e89536fd5ef203
MD5 d5171199e9eb5cf4f2e5b3eedc4250b2
BLAKE2b-256 fa6779961f91efed1116f262f7906708b94b05baf99a936eec8656481e9e60da

See more details on using hashes here.

Provenance

The following attestation bundles were made for cordum_sdk-0.1.0.tar.gz:

Publisher: sdk-python.yml on cordum-io/cordum

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

File details

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

File metadata

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

File hashes

Hashes for cordum_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fe60cdad5c239fef6face600091c78731e0ba7ec19797222b095fd6a947d5b8
MD5 c8a6245d106f26fff6c3c3ccdcaf469a
BLAKE2b-256 d855b582db86c1a1fac401998a4eb86f773a4ffdff9efbc6981db1451752bd5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cordum_sdk-0.1.0-py3-none-any.whl:

Publisher: sdk-python.yml on cordum-io/cordum

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