kazen-event-schema
The shared event contract for KazenAI. One schema so Agent FinOps, Agent Lens, and the SDKs speak the same language about cost, runs, and control decisions.
Install: PyPI · kazen-event-schema · Docs: Event reference · Products: kazenai.com
Source: github.com/kazenai-ai/kazen-event-schema
Why it exists
Economic control only works if every surface agrees on what an “event” is:
- SDKs emit what happened (model calls, denials, settlements)
- FinOps accounts for spend and policy decisions
- Lens investigates failures with the same identifiers
kazen-event-schema is that contract — a small, versioned Pydantic model used across the stack.
Install
python -m pip install kazen-event-schema
Requires Python 3.10+. Pulled in automatically when you install kazenai or kazenai-finops.
Quick start
from kazen_event_schema import KazenEvent, normalize_event_type, is_model_call
assert normalize_event_type("llm.call") == "model.call"
assert is_model_call("model.call")
event = KazenEvent(
schema_version="1.2",
event_id="evt_…",
ts_ms=1_700_000_000_000,
event_type="model.call",
org_id="org-a",
workspace_id="prod",
project_id="prod",
surface="sdk",
agent_id="support-agent",
agent_role="agent",
run_id="run-1",
cost_usd=0.0042,
)
Common event types
| Area | Examples |
|---|---|
| Model invocation | model.call (legacy llm.call normalizes at ingest) |
| Human gates | gate.decision, human_gate |
| FinOps / control | finops.budget.reserve, finops.budget.denied, finops.trajectory, finops.loop.anomaly, finops.circuit_breaker.opened, finops.pause, finops.resumed |
| Run lifecycle | run.started, run.finished, run.failed |
Core fields
| Field | Required | Purpose |
|---|---|---|
schema_version |
yes | 1.0, 1.1, or 1.2 |
event_id |
yes | Stable id for idempotent ingest |
ts_ms |
yes | Unix milliseconds |
event_type |
yes | Dotted lowercase type |
org_id |
yes | Tenant |
workspace_id / project_id |
yes | Workspace scope |
run_id |
recommended | Correlates steps in a run |
step_id / parent_step_id |
recommended / optional | Step tree for multi-agent runs |
tokens / tokens_used / cost_usd |
optional | Usage and spend; token aliases normalize to the same count and conflicting values are rejected |
payload |
optional | Model id, tool names, refs |
Used by
| Package / service | Role |
|---|---|
kazenai / kazenai-finops |
SDK emit path |
| Agent FinOps | Accounting + ingest |
| Agent Lens | Investigation + timelines |
Consumer synchronization
FINAL_1_b_final uses manual schema synchronization. Consumers must validate the
canonical model before projecting fields, reject unknown top-level fields, and
test tokens/tokens_used, timestamp aliases, duplicate/conflict behavior, and
producer-to-persistence round trips. Exporting JSON Schema without checking for
a repository diff is not sufficient drift protection.
License
Apache License 2.0. See LICENSE and NOTICE.
Products: kazenai.com · founder@kazenai.com
Metadata
Release files for kazen-event-schema 0.6.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kazen_event_schema-0.6.4.tar.gz | 42.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kazen_event_schema-0.6.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.5 kB
Release files / kazen_event_schema-0.6.4.tar.gz
| Download URL | kazen_event_schema-0.6.4.tar.gz |
|---|---|
| Size | 42.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55ed8dddfa2a39a7abca214fe4e132f12a6f8b88c69c6ab1765fb36203823ca8
|
|
BLAKE2b-256 checksum How to use checksums |
b4ab3e299985b850bebaba5ad769ffce0dbce55c0e8e67f6dbf9167a86197d48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.
Transparency logRelease files / kazen_event_schema-0.6.4-py3-none-any.whl
| Download URL | kazen_event_schema-0.6.4-py3-none-any.whl |
|---|---|
| Size | 29.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66a867043d50dc512e81fa21a372270e10d29595b7f153a076b16aa6ba3e36d8
|
|
BLAKE2b-256 checksum How to use checksums |
bdcd91900539f5271767526ce867216d31ce5ff427aaedb9ec64bf0604d28ab0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.
Transparency log