Skip to content

latent.protocol_schema

JSON Schema export for the :class:~latent.events.AgentEvent family.

Backbone of the contract-stability snapshot (the cross-repo drift gate, tests/unit/test_protocol_schema_snapshot.py). Derived from the dataclasses so it cannot drift from the runtime types — adding/removing/retyping a field on any event changes the schema, which fails the snapshot until the golden is regenerated. The oneOf it emits carries no wire discriminator, so it is a drift snapshot, not a code-generation source for foreign-language SDKs.

Emit the schema as JSON (--out writes the file directly, so it stays clean under wrappers like devbox run that print a banner to stdout):

python -m latent.protocol_schema --out tests/unit/snapshots/agent_event_schema.json

Functions

event_json_schema

event_json_schema() -> dict[str, Any]

A oneOf JSON Schema over the full AgentEvent family.

Each arm faithfully mirrors one event dataclass (fields + title). How an event is discriminated on the wire is the codec's concern (latent.wire), not this structural snapshot.

main

main(argv: list[str] | None = None) -> None