Skip to main content
AgentOps automatically tracks LLM interactions in your application. For more detailed tracking, especially in multi-agent systems, you can use the @agent decorator to associate operations with specific agents.

Using the Agent Decorator

For structured tracking in complex applications, you can use the @agent decorator to explicitly identify different agents in your system:
If you don’t specify a name, the agent will use the class name by default:

Basic Agent Tracking (Simple Applications)

For simple applications, AgentOps will automatically track your LLM calls without additional configuration:

Multi-Agent Systems

For complex multi-agent systems, you can organize multiple agents within a single trace:

Agent Communication and Coordination

You can track complex agent interactions and communication patterns:

Dashboard Visualization

All operations are automatically associated with the agent that originated them. Agents are given a name which is what you will see in the dashboard.

Operations are labeled with the name of the Agent that originated them

Best Practices

  1. Start Simple: For most applications, just using agentops.init() is sufficient.
  2. Use Decorators When Needed: Add the @agent decorator when you need to clearly distinguish between multiple agents in your system.
  3. Meaningful Names: Choose descriptive names for your agents to make them easier to identify in the dashboard.
  4. Organize with Traces: Use the @trace decorator to group related agent operations into logical workflows.
  5. Track Costs: Use the @tool decorator with cost parameters to track the expenses associated with agent operations.
  6. Agent Specialization: Create specialized agents for different types of tasks to improve observability and maintainability.

Migration from Session Decorator

If you’re migrating from the legacy @session decorator, replace it with the @trace decorator:
The @trace decorator provides the same functionality as the legacy @session decorator but with more flexibility and better integration with the new trace management features.