Installation
Download the wheel from GitHub Releases using yourAGENTEYE_TOKEN. If you do not yet have a token, see GitHub Token Setup for the setup steps and required permissions.
Using gh CLI + pip:
gh CLI + uv:
gh CLI):
Quick Start
configure()
event.* call. Safe to omit; defaults work out of the box. All arguments are keyword-only; pass them by name as shown above.
When base_dir is None (the default), the SDK reads $AGENTEYE_HOME if set,
otherwise falls back to ~/.agenteye. This matches the collector’s own resolution,
so a single AGENTEYE_HOME env var configures the shared event spool for both
the SDK and the collector, required for sidecar / single-pod deployments where
both processes must agree on the spool path.
Environment
Label every event with a deployment environment (production, staging, qa, canary, etc.). Set it once; the SDK attaches it to every event automatically.
Option 1: via configure():
configure(environment=...) wins over the environment variable. If neither is set, defaults to "dev".
The environment value appears as a first-class filter in the dashboard and is stored as an indexed column on the server for fast queries.
Constraint: environment values must not contain a literal , comma. The dashboard filters use comma-separated multi-select on the wire (?environment=prod,staging), so an environment named prod,blue would be split into two values. Events with comma-containing environments are rejected at ingest time.
Event Reference
All event methods require these two fields:| Field | Type | Description |
|---|---|---|
session_id | str | Identifies the top-level agent run |
agent_id | str | Identifies which agent within the session emitted the event |
**kwargs for custom metadata (see Custom Fields).
event.agent_start()
Emitted when an agent begins work.
event.agent_end()
Emitted when an agent finishes work.
event.tool_use()
Emitted when an agent invokes a tool. Pair with tool_result; the SDK auto-computes duration_ms.
event.tool_result()
Emitted when a tool returns. Correlates with tool_use via tool_call_id.
event.model_request()
Emitted just before sending a prompt to an LLM.
messages entries accept either a plain string content or Anthropic-style list-of-blocks content. Sampling params (temperature, max_tokens, etc.) can be passed as extra kwargs.
event.model_response()
Emitted when the LLM returns a response.
content accepts either a plain string (generic providers) or a list of Anthropic-style content blocks. Tool calls live inside content as {"type": "tool_use", ...} blocks, with no separate tool_calls field.
event.hook_triggered()
Emitted when a hook fires. Pair with hook_completed; the SDK auto-computes duration_ms.
event.hook_completed()
Emitted when a hook finishes. Correlates with hook_triggered via hook_id.
event.error()
Emitted when an unhandled error occurs.
Human-in-the-Loop Events
Human-in-the-loop events give you oversight over the moments where a person steps into the agent’s execution (waiting for approval, providing input, pausing, or stopping the agent). They let you measure how long humans take to respond (the SDK auto-computesduration_ms on the paired events), audit who paused or interrupted an agent, and build approval and oversight workflows that surface in the dashboard.
event.human_wait()
Emitted when the agent pauses execution to wait for a human to provide input. Pair with human_input; the SDK auto-computes duration_ms (how long the human took to respond).
event.human_input()
Emitted when a human provides input and the agent resumes. Correlates with human_wait via input_id. duration_ms is auto-computed and must not be passed by the caller.
event.human_pause()
Emitted when a human actively pauses the agent (e.g. via a dashboard control). The agent is suspended but not terminated.
event.human_interrupt()
Emitted when a human actively stops the agent mid-execution. Unlike human_pause, the agent’s work is terminated rather than suspended.
Custom Fields
Any extra keyword arguments are appended to the event after the standard fields:timestamp, type, and environment are reserved and raise ValueError (Reserved field names cannot be used as custom fields: [...]) if passed as custom fields. session_id and agent_id are required parameters on every event method and cannot be supplied a second time; Python raises TypeError if you do. Set the environment with configure(environment=...) (or the AGENTEYE_ENVIRONMENT variable) instead.
How Events Are Written
Events are buffered in-process and flushed to disk everyflush_interval seconds (default 500 ms). Each flush writes one JSONL file:

