Skip to main content

Official Python SDK for Catentio. `PublicClient` speaks the public API (https://catent.io/v1 — API-key auth: agents, templates, runs, projects, webhooks). `CatentioClient` speaks the internal control plane (session-cookie auth via the Huudis device flow).

Project description

catentio-saas (Python)

Official Python SDK for the catentio-saas control plane. Python parity with @forjio/catentio-saas-node — same 25 resource namespaces, same Bearer auth via Huudis OIDC, same API envelope.

Install

pip install catentio-saas

(Python import: catentio_saas — PEP 8 underscore-naming.)

Quickstart

Static API key (server-to-server)

from catentio_saas import CatentioClient

with CatentioClient(api_key="cat_pk_...") as catentio:
    workspaces = catentio.workspaces.list()
    print(workspaces)

    run = catentio.agents.invoke("cimi", {"message": "hello"})
    print(run["id"])

Bearer session (CLI / device-flow)

from catentio_saas import CatentioClient, Session

# An access_token from your Huudis device-flow login.
session = Session(
    access_token="...",
    refresh_token="...",
    expires_at=1_800_000_000,
    issuer="https://huudis.com",
    client_id="catentio-cli",
)

with CatentioClient(session=session) as catentio:
    projects = catentio.projects.list()

For automatic refresh, wire a refresh_fn into the Session. The SDK keeps the refresh callable pluggable so it can use the huudis Python SDK's refresh_access_token (or your own) without taking a hard dependency on it.

Resource namespaces

Namespace Routes
catentio.workspaces list, show, create, destroy, set_state
catentio.agents list, get, invoke
catentio.runs list, get, cancel
catentio.projects list, get, create, list_attachments, add_attachment, list_tasks, get_task, list_subtasks, get_subtask, list_attempts, list_artifacts, list_events, cost, pause, resume, abandon, run_step, retry_subtask
catentio.templates list
catentio.tools list, get, create, update, delete
catentio.skills list, get
catentio.memory stats, list_entries, get_entry, create_entry, update_entry
catentio.api_keys list, create, delete
catentio.billing catalog, summary, subscribe
catentio.cost summary
catentio.integrations list, configure, delete
catentio.webhooks list, create, delete
catentio.scheduled_jobs list, create, update, delete
catentio.feature_flags list, set
catentio.files list, upload, delete
catentio.output_destinations list, get, create, update, delete
catentio.discord status, send_message
catentio.gojo sessions
catentio.heartbeats list, config, update_config
catentio.system info, health (unauth)
catentio.chat send, history
catentio.events list
catentio.inbound_webhooks list

Every method takes an optional token= last-arg to override the client-level Bearer for a single call (e.g. acting on behalf of another workspace).

Errors

from catentio_saas import CatentioError, NetworkError

try:
    catentio.workspaces.show("ws_404")
except CatentioError as e:
    print(e.code, e.message, e.status, e.request_id)
except NetworkError as e:
    print("transport failure:", e.message)

Source

https://github.com/hachimi-cat/saas-catentio/tree/main/sdk/python

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

catentio_saas-0.3.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

catentio_saas-0.3.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file catentio_saas-0.3.0.tar.gz.

File metadata

  • Download URL: catentio_saas-0.3.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for catentio_saas-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6fc3a131aa0a769260a4a2f377a0d2831e0f31941bebc29c454247483a464b75
MD5 7a1e7979293fac82591d5660ec677752
BLAKE2b-256 34dc1daad8f0cdd2a1adc7fa72280e4aa51a2dc37c8e9d468057670b073f9937

See more details on using hashes here.

File details

Details for the file catentio_saas-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: catentio_saas-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for catentio_saas-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75fa2c1b94eaba14f7af790ed78e34586db260ecd1e888438ce0c1d2401aeaac
MD5 c331fe54af803a575ed6cdc32076eb17
BLAKE2b-256 953e76c9cb2829586b8f60ee673e4d8c896cbe6762f5ba02e1f6da191e6a5752

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