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, human.gate |
| FinOps / control | finops.trajectory, finops.circuit_breaker.opened, finops.pause, finops.resumed |
| Run lifecycle | run.started, run.completed, 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 / cost_usd |
optional | Usage and spend |
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 |
License
Apache License 2.0. See LICENSE and NOTICE.
Products: kazenai.com · founder@kazenai.com
Metadata
Release files for kazen-event-schema 0.6.3
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.3.tar.gz | 39.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kazen_event_schema-0.6.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.9 kB
Release files / kazen_event_schema-0.6.3.tar.gz
| Download URL | kazen_event_schema-0.6.3.tar.gz |
|---|---|
| Size | 39.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7dbb89e49aa04e72ef070f7eae88eefaa9fc82e9de0877b6326c2551759fc9eb
|
|
BLAKE2b-256 checksum How to use checksums |
17794ea4fe2dbc3c2bebf0e4c743b3a28352d84e2886c7cacf81f4c389c398aa
|
| 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 1, 2026.
Transparency logRelease files / kazen_event_schema-0.6.3-py3-none-any.whl
| Download URL | kazen_event_schema-0.6.3-py3-none-any.whl |
|---|---|
| Size | 28.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a01978297afed5ed74e3367c6fea6dd200c703d015dd3e1ca971213d9040c3ec
|
|
BLAKE2b-256 checksum How to use checksums |
6670e7cf54fe4d4122b7651f30d1002f9bf305ecc266d27117cad0dc3f59029b
|
| 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 1, 2026.
Transparency log