Skip to main content

kazen-event-schema

PyPI Python 3.10+ License

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

Consuming events safely

If you ingest KazenEvents in your own service:

  • Validate each event with KazenEvent before reading fields; unknown top-level fields are rejected.
  • Treat tokens and tokens_used (and the timestamp aliases) as the same value — the model normalizes them and rejects conflicting values.
  • Use event_id for idempotent ingest: a repeated event with the same content is a duplicate, a repeated id with different content is a conflict.
  • Pin a compatible range (kazen-event-schema>=0.6,<0.7) and run your ingest-to-storage tests when you upgrade.

License

Apache License 2.0. See LICENSE and NOTICE.

Products: kazenai.com · founder@kazenai.com

Metadata

Release files for kazen-event-schema 0.6.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kazen-event-schema 0.6.5
File Size Uploaded
kazen_event_schema-0.6.5.tar.gz 27.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kazen-event-schema 0.6.5
File Interpreter ABI Platform
kazen_event_schema-0.6.5-py3-none-any.whl Python 3 none any Details

Total release size: 57.2 kB

Release files / kazen_event_schema-0.6.5.tar.gz

Download URL kazen_event_schema-0.6.5.tar.gz
Size 27.6 kB
Tags Source
SHA-256 checksum
How to use checksums
501050196fea469be0ed4e921d3f37e5bfed30ff042e4e643d9c74a85481e618
BLAKE2b-256 checksum
How to use checksums
a8f3665cd6604a61d60275786900fe519ebc48d5e69df88f1ae7f1dbc968e7df
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

Release files / kazen_event_schema-0.6.5-py3-none-any.whl

Download URL kazen_event_schema-0.6.5-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48bf6331d93731343a33e5b3292238d272f442822b232697c223df2b95b66bec
BLAKE2b-256 checksum
How to use checksums
20d8e1dbdb52026ae934b6d423d5bf75555d1afe9f9ee273d01b550fb3b76f68
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

Release history Release notifications | RSS feed

This release

0.6.5 This release

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page