Skip to main content

Overview

Monitoring is essential for running production multi-agent systems. This guide covers how to monitor agent performance, track metrics, implement logging, and gain full observability into your Swarms deployment.

Logging Architecture

Loguru Integration

Swarms uses Loguru for powerful, structured logging:

Multi-Level Logging

Configure different log levels for different outputs:

Contextual Logging

Add context to logs for better traceability:

Agent-Level Monitoring

Built-in Verbose Mode

Custom Monitoring Wrapper

Queue Monitoring (AOP)

Real-Time Queue Statistics

Queue Metrics Dashboard

Performance Metrics

Response Time Tracking

Throughput Monitoring

Error Tracking

Error Rate Monitoring

Health Checks

Agent Health Check

System Health Check

Alerting

Simple Alert System

Best Practices

1. Use Structured Logging

2. Log at Appropriate Levels

  • DEBUG: Detailed diagnostic information
  • INFO: General informational messages
  • WARNING: Warning messages for recoverable issues
  • ERROR: Error messages for failures
  • CRITICAL: Critical errors requiring immediate attention

3. Include Context

4. Monitor Key Metrics

  • Response time (mean, median, p95, p99)
  • Throughput (requests per second/minute)
  • Error rate
  • Queue sizes (if using AOP)
  • Resource usage (CPU, memory)

5. Set Up Alerts

  • High error rates
  • Slow response times
  • Resource exhaustion
  • Queue backlogs