← All docs

Python

Drop-in for FastAPI, Django, Celery, and standalone scripts. Sync + async.

Drop the Cisora SDK into any Python agent. Sync and async APIs share the same surface.

Install

pip install cisora

Quickstart

import os
from cisora import Cisora

cisora = Cisora(
    api_key=os.environ["CISORA_API_KEY"],
    agent_name="customer-support-bot",
)

# Wrap any LLM call
reply = cisora.model_call(
    "claude-sonnet-4-5",
    lambda: anthropic.messages.create(...),
)

# Wrap any tool call
sent = cisora.tool(
    "send_email",
    lambda: resend.emails.send(...),
)

# Or check a planned action before running it
decision = cisora.check(
    action_type="tool",
    tool_name="delete_user",
    inputs={"user_id": "u_123"},
)
if decision.decision == "block":
    raise RuntimeError(decision.reason)

What gets captured

  • Model name, prompt + completion tokens, USD cost
  • Tool name, arguments, return value (PII auto-redacted)
  • Duration, success/error, traceback when an exception is raised
  • session_id, trace_id, parent_span_id for distributed traces
  • Custom metadata you pass per call
  • Policy decision for every action

Notes

Sync and async parity

Both Cisora (sync) and AsyncCisora (async) expose model_call, tool, check, and flush. Pick whichever matches your codebase.

Threadsafe

Internal queue is threadsafe — share a single Cisora instance across threads or workers.

Next steps