Events
Publish an event to a channel, then search what landed, every parameter, and the shapes that come back.
client.events has two methods: publish (POST /event) and search
(GET /events).
Publish
publish takes three positional arguments, the identifier, the payload, and
the channel UUID, and everything else by keyword.
from axonpush import AxonPush, EventType
with AxonPush() as client:
event = client.events.publish(
"web_search",
{"query": "AI agent frameworks"},
"b0f1c2d3-4e5f-6071-8293-a4b5c6d7e8f9",
agent_id="researcher",
event_type=EventType.AGENT_TOOL_CALL_START,
metadata={"tool_name": "web_search"},
)
if event:
print(event.event_id, event.status)The identifier is the event’s name. It does not have to be unique across events, many log records sharing a logger name all persist as separate rows.
Parameters
| Parameter | Type | Required | What it does |
|---|---|---|---|
identifier | str | yes | Event name, e.g. "web_search" or "task.started". Positional. |
payload | dict | yes | Event body. Passed through redaction. Positional. |
channel_id | str | yes | Target channel UUID. Positional. |
agent_id | str | no | Which agent emitted this. |
event_type | EventType or str | no | Defaults to custom server-side. |
metadata | dict | no | Free-form map, redacted on the same rules as payload. |
trace_id | str | no | Trace UUID. One is created and installed on the current context when omitted. |
span_id | str | no | Span id. Generated from the trace context when omitted. |
parent_span_id | str | no | Parent span id, for span linking. |
dedup_key | str | no | Idempotency key. Send the same key on a retry so the ingest pipeline collapses the duplicate. |
prompt_id | str | no | Prompt registry id. Lands in metadata as gen_ai.prompt.id. |
prompt_version_id | str | no | Prompt version. Lands in metadata as gen_ai.prompt.version. |
The environment comes from the client (AxonPush(environment="prod")); there is
no per-call override.
The API also accepts occurredAt (the original source time, which retries
should preserve) and expiresAt (an earlier content expiry, which can shorten
but never extend the 30-day retention window). publish in 0.0.19 does not
expose them; send them through the HTTP API if you need them.
What comes back
Ingest is asynchronous, so the response describes the accepted write, not the stored row:
| Field | Type | Meaning |
|---|---|---|
event_id | str | Server-assigned event UUID. |
status | str | Ingest status of the accepted write. |
The call returns None instead, rather than raising, when the API is
unreachable and fail_open is left on. See
fail-open.
Event types
from axonpush import EventType
EventType.AGENT_START # "agent.start"
EventType.AGENT_END # "agent.end"
EventType.AGENT_MESSAGE # "agent.message"
EventType.AGENT_TOOL_CALL_START # "agent.tool_call.start"
EventType.AGENT_TOOL_CALL_END # "agent.tool_call.end"
EventType.AGENT_ERROR # "agent.error"
EventType.AGENT_HANDOFF # "agent.handoff"
EventType.AGENT_LLM_TOKEN # "agent.llm.token"
EventType.AGENT_LOG # "agent.log"
EventType.APP_LOG # "app.log"
EventType.APP_SPAN # "app.span"EventType is a str enum, so the plain string works everywhere the enum
does: event_type="agent.start". The backend accepts any string; leave
event_type unset to get custom.
app.log and agent.log are what the logging integrations
emit; app.span is what the OpenTelemetry exporter
emits.
Search
search spans the whole organisation and takes every filter by keyword. All
filters are AND-ed; omit one to match everything.
results = client.events.search(
event_type="agent.error",
since="2026-08-01T00:00:00Z",
q="timeout",
limit=50,
)
for ev in results.events:
print(ev.occurred_at, ev.event_type, ev.trace_id)| Parameter | Type | What it does |
|---|---|---|
since / until | str | ISO 8601 bounds, since inclusive, until exclusive. |
limit | int | Page size. |
app_id | str | Restrict to one app. |
channel_id | str | Restrict to one channel. |
environment_id | str | Restrict to one environment UUID. |
event_type | str | One canonical event type. |
source | str | Ingest source: app, sentry or otlp. |
status | str | Event status. |
trace_id | str | Only events in this trace. |
agent_id / agent_name | str | Only events from this agent. |
tool_name | str | Tool name (gen_ai.tool.name). |
semantic_kind | str | agent, tool, llm, retriever, db, http or log. |
q | str | Case-insensitive free-text match over event fields. |
attr_key / attr_value | str | Match one attribute key and value. |
The response is a SearchEventsOutputBody whose events list holds stored
event records.
The stored event
Records returned by search and by traces.get() are richer
than the publish acknowledgement. Every record has event_id, org_id,
app_id, channel_id, event_type, source, created_at, occurred_at and
payload_spilled. Beyond those, the backend fills in what it could derive:
- Identity and linkage,
agent_id,agent_name,trace_id,span_id,parent_span_id,session_id,user_id,environment_id. - Content,
payload,metadata,attributes,resource_attributes. - Model attribution,
request_model,response_model,provider_name,operation_name,finish_reason,semantic_kind,tool_name. - Token and cost accounting,
input_tokens,output_tokens,total_tokens,reasoning_tokens,cache_read_tokens,cache_write_tokens,cost_usd,cost_source. - Timing and outcome,
duration_ms,ttft_ms,status,error_type,error_message,service_name.
These are optional: a hand-published custom event leaves most of them unset.