The SDK New

A governed agent in 10 lines.

cendor-sdk is a governed, provider-agnostic agent SDK. Cost budgets, tamper-evident audit, PII redaction, and record/replay testing are the foundation, not plugins — so the same ten lines run in production and in an offline test. In Python andTypeScript.

governed_agent.py
from cendor.sdk import Agent, tool, run, budget, guard, Policy, AuditLog

@tool
def get_weather(city: str) -> str:
    "Current weather for a city."
    return f"Sunny in {city}"

agent = Agent(name="assistant", model="gpt-4o", tools=[get_weather])
log = AuditLog(system="support", path="audit.jsonl")

# budget enforces pre-flight; guard redacts PII + records to the audit chain
with budget(usd=0.25, on_exceed="block"), guard(Policy.default(), audit=log):
    result = run(agent, "What's the weather in Paris?", audit=log)

print(result.output, result.cost)   # governed, audited, replayable

Drop the budget/guard context and it's a plain agent on cendor-core alone — governance is opt-in, never a rewrite.

Why it's different

Governance is the foundation.

Other SDKs bolt observability on afterward. Here, every run is budgeted, audited, and replayable by construction — built on the same six libraries you can drop down to at any time.

Budgets

Pre-flight caps block or downgrade an over-budget call before a token is spent; per-feature / per-user cost attribution for free.

Tamper-evident audit

Every call, tool, and decision lands on a hash-chained log that verifies offline — one edited byte fails. Evidence to support compliance, not a guarantee.

PII redaction

guard() scans and redacts before send (or blocks) via a policy — detected secrets and PII are stripped before the request leaves your process, and the refusal is auditable.

Record / replay

Capture a whole run once, replay it offline forever — deterministic evals over cassettes, no API key, no flakiness.

The agent surface

Everything an agent SDK needs.

Agent loop

Sync + async, streaming, bounded max_turns; steps harvested into Result.steps.

Native tools

@tool derives a JSON Schema from type hints (Optional/Union/Literal/nested Pydantic).

Handoff

Cross-provider handoff carries canonical history; supervisor() routing, segment-bound.

Memory & state

Session, SQLite store, summarizing memory, crash-resume checkpointing.

Structured output

dataclass / Pydantic / JSON-schema output_type with provider-native modes.

Interop

MCP client, A2A server, M365 / Foundry adapter, post-hoc OTel gen_ai.* span trees.

Model-agnostic

One canonical message shape. Ten providers.

The provider is inferred from the model id (or forced). Provider extras stay optional — pip install "cendor-sdk[openai,anthropic]".

OpenAI (Chat Completions)OpenAI (Responses)AnthropicGoogle GeminiAWS BedrockOllamaHugging FaceAzure AI Foundry (Chat)Azure AI Foundry (Responses)Foundry Local
Get started

Start governed.

$ pip install "cendor-sdk[openai,anthropic]"
$ npm i @cendor/sdk openai

Pulls the six governance libraries as hard deps. Already have a framework? Use the libraries beneath it instead.