Recording Events
Log events such as agent actions, LLM calls, tool calls, and errors. See Event Class.
To get the most out of AgentOps, it is best to carefully consider what events to record - not simply record whatever your agent is logging. AgentOps offers two ways to record events:
@record_action
Decorator
event_type
(str): Type of the event.
To make AgentOps easier to integrate, we also provide a function decorator to automatically create and record an event for your function.
The decorator will record the function’s parameters, return values, and the time duration. We suggest using this on functions that take a long time and contain nested functions. For example, if you decorate a function that makes several OpenAI calls, then each OpenAI call will show in the replay graph as a child of the decorated function.
@record_tool
Decorator
tool_name
(str): The name of the tool represented by the python function
Additionally, we provide a function decorator to automatically create tool events for python functions.
The decorator will record the function’s parameters, returns, and the time duration. We suggest using this on functions that take a long time and contain nested functions. For example, if you decorate a function that makes several OpenAI calls, then each OpenAI call will show in the replay graph as a child of the decorated function.
record()
Method
From this point, simply call the .record()
method in the AgentOps client:
Record any child of the Event type or ErrorEvent.