Skip to content

Getting started with Kili Events

Kili Character

What is Kili?

Kili is a platform that empowers a data-centric approach to Machine Learning through quality training data creation. It provides collaborative data annotation tools and APIs that enable quick iterations between reliable dataset building and model training. More info about the product here.

If you are looking for the Kili product documentation, it is located here.

Kili Events

Kili system raise multiple events corresponding to user actions.

Each event is described once as a JSON Schema. Events travel over the wire in camelCase (the GraphQL representation, e.g. stepGroupId), and a generated Pydantic v2 package — kili-events — lets you consume them in Python.

Installation

pip install kili-events

camelCase on the wire, snake_case in Python

Events travel over the wire in camelCase (e.g. stepGroupId) — this is the GraphQL shape you receive from the event bus.

The Python package exposes idiomatic snake_case attributes (step_group_id). The Pydantic models map between the two automatically, so you read the wire payload directly and access fields the Pythonic way — but serializing back to the wire requires by_alias=True.

Wire / GraphQL Python attribute
Field name stepGroupId step_group_id
Parse — Event.model_validate(raw)
Serialize to wire — evt.model_dump(by_alias=True)

Parsing an event

from kili_events import ProjectWorkflowStepGroupUpdatedEvent

# `raw` is the camelCase payload received from the event bus
evt = ProjectWorkflowStepGroupUpdatedEvent.model_validate(raw)

# Access fields in snake_case
evt.payload.step_group_id
evt.payload.step_group_name

# Serialize back to the wire format (camelCase) — by_alias is required
evt.model_dump(by_alias=True)
# JSON string variant:
evt.model_dump_json(by_alias=True)

Both input formats work in Python

Thanks to populate_by_name, the Pydantic models accept either the camelCase wire keys or the snake_case field names — for parsing and keyword construction alike. The nested payload models live in each event's module:

from kili_events.ProjectWorkflowStepGroupUpdatedEvent import Payload

Payload(step_group_id="sg1", step_group_name="Review", fields=["status"])   # snake_case
Payload(stepGroupId="sg1", stepGroupName="Review", fields=["status"])       # camelCase

Each event page in the Reference section documents its full schema, with the property names shown in both Python (snake_case) and GraphQL (camelCase) tabs.