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.
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, replayableDrop the budget/guard context and it's a plain agent on cendor-core alone — governance is opt-in, never a rewrite.
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.
Pre-flight caps block or downgrade an over-budget call before a token is spent; per-feature / per-user cost attribution for free.
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.
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.
Capture a whole run once, replay it offline forever — deterministic evals over cassettes, no API key, no flakiness.
Everything an agent SDK needs.
Sync + async, streaming, bounded max_turns; steps harvested into Result.steps.
@tool derives a JSON Schema from type hints (Optional/Union/Literal/nested Pydantic).
Cross-provider handoff carries canonical history; supervisor() routing, segment-bound.
Session, SQLite store, summarizing memory, crash-resume checkpointing.
dataclass / Pydantic / JSON-schema output_type with provider-native modes.
MCP client, A2A server, M365 / Foundry adapter, post-hoc OTel gen_ai.* span trees.
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]".