Skip to main content

Python SDK for Cero Labs — agent-native expert escalation for AI workflows.

Project description

cerolabs

Python SDK for Cero Labs — the agent-native API for on-demand domain expertise.

When your agent hits an edge case, cerolabs routes the case to a verified domain expert and returns a structured, schema-validated response your workflow can use directly.

Install

pip install "git+https://github.com/os1123/cero-labs.git#subdirectory=sdk/python"

Requires Python 3.10+.

Package name for PyPI: cerolabs. The publish workflow is configured in this repo, but the live PyPI project still needs trusted-publisher setup.

Quick start

from cerolabs import Cero

cero = Cero(api_key="cero_...")

schema = {
    "type": "object",
    "properties": {
        "appeal_recommended": {"type": "boolean"},
        "reasoning": {"type": "string"},
    },
    "required": ["appeal_recommended", "reasoning"],
}

resolution = cero.escalate_and_wait(
    domain="healthcare.rcm",
    query="Should we appeal this CO-50 denial?",
    context={"cpt": "93015", "payer": "Blue Cross"},
    schema=schema,
)

print(resolution.answer["appeal_recommended"])
print(resolution.answer["reasoning"])

Pydantic models

If you already use Pydantic, pass the model class directly. The SDK will derive output_schema for Cero and validate the expert answer on the way back.

from pydantic import BaseModel

from cerolabs import Cero


class CodingDecision(BaseModel):
    cpt_codes: list[str]
    icd10_codes: list[str]
    notes: str | None = None


cero = Cero(api_key="cero_...")
resolution = cero.escalate_and_wait(
    domain="healthcare.coding",
    query="Verify the code set for this operative note.",
    context={"note_id": "OP-123"},
    schema=CodingDecision,
)

assert isinstance(resolution.answer, CodingDecision)
print(resolution.answer.cpt_codes)

Async client

import asyncio

from cerolabs import AsyncCero


async def main() -> None:
    async with AsyncCero(api_key="cero_...") as cero:
        resolution = await cero.escalate_and_wait(
            domain="legal.contract",
            query="Is this indemnity clause outside standard policy?",
        )
        print(resolution.answer)


asyncio.run(main())

API

  • Cero(api_key, base_url?, timeout_s?): sync client
  • AsyncCero(api_key, base_url?, timeout_s?): async client
  • escalate(...): create an escalation and return immediately
  • wait_for_resolution(escalation_id, ...): long-poll until resolved
  • escalate_and_wait(...): convenience wrapper
  • check_escalation(escalation_id): get current status
  • cancel_escalation(escalation_id): cancel a pending/routed escalation
  • submit_feedback(escalation_id, score, comment?): rate the expert answer
  • list_escalations(...): list recent escalations
  • list_domains(): live supported domains
  • usage(): tenant credits, tier, and limits

Machine-readable docs

Publish locally

python -m pip install build twine
python -m build
python -m twine check dist/*

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

cerolabs-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

cerolabs-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cerolabs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a1a1238e99c0f2aaa775301d752b342b861435d8e3cc0ca128f437d7edaf872
MD5 35875e7773185ceb3aeccbb682cd2f75
BLAKE2b-256 523565bc51137cec3337bd76d374024ed5d9a0b73b9703212ec3e8e337e1f99a

See more details on using hashes here.

Provenance

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

Publisher: publish-python-sdk.yml on os1123/cero-labs

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

File details

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

File metadata

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

File hashes

Hashes for cerolabs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 409a78c4193a2e538b7a5232930f321f0186170705c3653736e88cb1eb3cea7f
MD5 bb45d7773ed26832e7b262aecf973d38
BLAKE2b-256 c4713c0449459f292d1e402e7953ab59c4b238a7653a410e708d4729e324b101

See more details on using hashes here.

Provenance

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

Publisher: publish-python-sdk.yml on os1123/cero-labs

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