This operation is labeled with the name of the Agent that originated it
Nesting Operations Under Agents
Operations performed by an agent should be decorated with the@operation decorator to ensure they’re properly nested under the agent:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use the @agent decorator to create agent spans
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 decorator to ensure they’re properly nested under the agent:
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")
