Decorators work by wrapping functions or classes that they are placed above. You’ve probably seen this before. Using decorators allows us to add a lot of functionality to your code with minimal work on your part.

python
@example_decorator()
def hello_world():
   ...

@track_agent()

If your implementation uses Classes to denote Agents, this decorator enables automatic agent tracking.

Learn more about tracking agents here.

@record_action()

Sometimes, your agent system uses functions that are important to track as Actions.

Adding this decorator above any function will allow every instance of that function call to be tracked and displayed in your Session Drill-Down on the dashboard.

@record_tool()

Some functions are used as Tools. If you are not using an agent framework that records ToolEvents with AgentOps automatically, this decorator will record ToolEvents when the function is called.

Adding this decorator above any function will allow every instance of that function call to be tracked and displayed in your Session Drill-Down on the dashboard.