Observability
Track and analyze your agent performance and behavior by connecting with third party observability tools.
Agency Swarm uses Langchain callbacks to connect with third party observability tools.
Although we strongly discourage using Langchain for agent development due to its numerous unnecessary abstractions, it currently has the widest support among third-party observability tools. For this reason, we have adopted its callback structure. However, no Langchain code is used within Agency Swarm.
To get started with observability features, install the Langchain package:
Supported Observability Platforms
When it comes to choosing your observability platform, there are a few options. You can use one or multiple trackers simultaneously for comprehensive monitoring:
Langfuse
Advanced tracing, metrics, and debugging tools
AgentOps
Platform for managing and tracking your agents
Local Tracking
Lightweight SQLite-based local tracking solution
Implementation
Technical details about tracking implementation
Getting Started
We currently recommend Langfuse because it is fully open source, easy to use, and offers the most comprehensive set of features and support. You can also combine it with other trackers for enhanced observability.
Install Package
Set Environment Variables
Initialize Tracking
Install Package
Set Environment Variables
Initialize Tracking
Install Dependencies
Set API Key
Either add to your .env
file:
Or pass directly when initializing (for multi-user applications):
Run and Monitor
- Run your agent
- Visit app.agentops.ai/drilldown to observe your agent
- After the run, AgentOps prints a clickable URL in the console that takes you directly to your session
Local SQLite implementation:
Install Dependencies
Initialize Tracking
A SQLite database will be created in the current directory.
Custom Database Path (Optional)
How It Works
Agency Swarm uses a simple but powerful tracking system that captures every interaction in your agent’s lifecycle:
- Event Tracking: Every message, tool call, and error is automatically tracked with unique IDs and timestamps.
- Hierarchical Structure: Events are organized in a tree structure, showing how different parts of your agent interact.
- Multiple Platforms: You can send this data to different platforms (Langfuse, AgentOps, or local SQLite) for analysis.
The tracking system is built on top of Langchain’s callback interface, which means it can work with any observability tool that supports Langchain. This gives you flexibility while keeping the implementation simple.
What Gets Tracked
The system automatically captures:
- Messages: Every conversation between users and agents
- Tool Calls: When agents use tools and their results
- Errors: Any issues that occur during execution
- Performance: Token usage, timing, and other metrics
- Relationships: How different parts of your agent interact
This data helps you understand your agent’s behavior, debug issues, and optimize performance.