Use the @agent decorator to create agent spans
@agent
This operation is labeled with the name of the Agent that originated it
from agentops.sdk.decorators import agent @agent(name='ResearchAgent') class MyAgent: def __init__(self): # Agent initialization pass # Agent methods
@agent class ResearchAgent: # This agent will have the name "ResearchAgent" pass
@operation
from agentops.sdk.decorators import agent, operation @agent class ResearchAgent: @operation def search_web(self, query): # Search implementation return results @operation def analyze_data(self, data): # Analysis implementation return analysis
from agentops.sdk.decorators import session, agent, operation @agent class ResearchAgent: @operation def perform_research(self, topic): # Research implementation return results @session def research_workflow(topic): agent = ResearchAgent() return agent.perform_research(topic) # Run the session result = research_workflow("quantum computing")