Events
Agent Event Types
Event Class
The Event class is an abstract base class for events that will be recorded. It should not be instantiated directly.
Parameter | Type | Default | Example | Description |
---|---|---|---|---|
params | dict | None | {"param1": "value1"} | Additional parameters for the event |
returns | str | None | ”Success” | Return value of the event |
init_timestamp | str | A timestamp of instantiation | ”2023-03-15T18:59:13Z” | The time when the Event was initiated |
end_timestamp | str | A timestamp of instantiation | ”2023-03-15T19:00:13Z” | The time when the Event was completed |
agent_id | UUID | UUID of the triggering agent | 123e4567-e89b-12d3-a456-426614174000 | The unique identifier of the agent that triggered the event |
id | UUID | A new UUID | 123e4567-e89b-12d3-a456-426614170000 | The unique identifier of the event |
ActionEvent
The ActionEvent
is a generic event for recording events that do not fit into the bounds of a more specific Event type.
Parameter | Type | Default | Example | Description |
---|---|---|---|---|
action_type | str | None | ”Click” | Type of the action |
logs | str | None | ”Executed action successfully” | Logs generated during the action event |
screenshot | str | None | ”/path/to/screenshot.png” | Path to screenshot captured during the action event |
An action event can be used the same way as other events but also with the record_function
decorator.
This decorator will record an ActionEvent
with the params and returns of the function as well as execution time.
LLMEvent
The LLMEvent class is for recording calls to LLMs. AgentOps auto-instruments calls to the most popular LLMs e.g. GPT, Claude, Gemini, etc.
In most cases, LLMEvent
should not be used by the developer. These are created automatically.
Parameter | Type | Default | Example | Description |
---|---|---|---|---|
thread_id | UUID | None | 123e4567-e89b-12d3-a456-426614174000 | Thread ID of the event |
prompt | str or List | None | ”What’s the weather today?” | The prompt for the event |
prompt_tokens | int | None | 5 | Number of tokens in the prompt |
completion | str or object | None | ”It’s sunny and warm.” | The completion of the event |
completion_tokens | int | None | 4 | Number of tokens in completion |
model | Models or str | None | Models.MODEL_NAME or “model_name” | The model used for the event |
ToolEvent
The ToolEvent class is for recording calls to tools e.g. searchWeb, fetchFromDB.
Parameter | Type | Default | Example | Description |
---|---|---|---|---|
name | str | None | ”Parsing Tool” | Name of the tool |
logs | str or dict | None | ”Tool executed successfully” or {"status": "success"} | Logs from the tool execution |
The tool event should be created previous to running the tool in order to track the execution time.
ErrorEvent
Error events can be used alone or in reference to another event. The can reference errors that the LLM made or errors in execution, up to the developer.
Parameter | Type | Default | Example | Description |
---|---|---|---|---|
trigger_event | Event | None | Event instance | The Event that triggered the ErrorEvent |
error_type | str | None | ”Runtime Error” | Type of the error |
code | str | None | ”ERR001” | Code of the error |
details | str | None | ”Null pointer exception” | Detailed description of the error |
logs | str | None | ”Error occurred at line 10” | Logs related to the error |
timestamp | str | A timestamp when the ErrorEvent was instantiated | ”2023-03-15T18:59:13Z” | Timestamp when the ErrorEvent was created |