Seemingly magic tools that can be added to functions and classes for easier instrumenting.
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.AgentOps provides a set of decorators that allow you to easily instrument your code for tracing and monitoring AI agent workflows. These decorators create spans (units of work) that are organized hierarchically to track different types of operations.python
@session
@session
decorator creates a session span, which serves as the root for all other spans. No spans can exist without a session at the top.
@agent
@agent
decorator creates an agent span for tracking agent operations. Agent spans are typically children of session spans and parents of operation spans.
@operation
/ @task
@operation
and @task
decorators are aliases that create operation/task spans for tracking specific operations. These spans are typically children of agent spans.
@workflow
@workflow
decorator creates workflow spans for tracking workflows, which can contain multiple operations.
async/await
)yield
)async
and yield
)