AgentSight Collector
English | 中文
A high-performance Rust streaming framework for real-time AI agent observability through eBPF-based system monitoring. The collector provides a pluggable architecture for processing SSL/TLS traffic and process lifecycle events with minimal overhead.
Overview
The AgentSight Collector is the core data processing engine that:
- Executes embedded eBPF programs for system-level monitoring
- Processes event streams through configurable analyzer chains
- Provides multiple runners for different monitoring scenarios
- Offers real-time streaming with async/await architecture
- Supports flexible output formats and destinations
Architecture
eBPF Programs → JSON Events → Runners → Analyzer Chains → Output
Core Components
- Runners: Execute eBPF binaries and create event streams
- Analyzers: Process and transform events in configurable chains
- Events: Standardized event format with rich metadata
- Binary Extractor: Manages embedded eBPF programs with automatic cleanup
Quick Start
Installation
# Install the packaged CLI
# Clone and build
Basic Usage
# Live agent session view
# Launch and record an agent command
# SSL traffic monitoring with HTTP parsing
# Process lifecycle monitoring
# Stdio payload monitoring for a local MCP server or CLI child process
# Combined debug monitoring with the web UI
Commands
Debug SSL Monitoring
Monitor SSL/TLS traffic with advanced processing capabilities:
# Basic SSL monitoring
# Enable Server-Sent Events processing
# Enable HTTP parsing with raw data
# Apply filters to reduce noise
# Pass arguments to underlying eBPF program
Debug Process Monitoring
Track process lifecycle events:
# Basic process monitoring
# Filter by process name
# Filter by PID
# Quiet mode (no console output)
Debug Stdio Monitoring
Capture plaintext stdin/stdout/stderr payloads from a target process:
# Capture stdio payloads from one PID
# Filter by UID or comm
# Capture all file descriptors instead of only 0/1/2
Debug Trace Monitoring
Comprehensive monitoring with both SSL and process events:
# Full debug trace monitoring
# Filter by process command
# SSL-only monitoring
# Process-only monitoring
# Advanced filtering
# Custom output file
# Web UI with visualization
# Stdio-only monitoring through the trace entrypoint
Configuration Options
SSL Options
--sse-merge: Enable Server-Sent Events processing--http-parser: Parse HTTP requests/responses from SSL traffic--http-raw-data: Include raw SSL data in HTTP events--http-filter: Filter HTTP events by pattern--ssl-filter: Filter SSL events by pattern
Process Options
--comm: Filter by process command name--pid: Filter by process ID--duration: Minimum process duration in ms--mode: Process filtering mode (0=all, 1=proc, 2=filter)
Debug Trace Options
--ssl: Enable/disable SSL monitoring--process: Enable/disable process monitoring--stdio: Enable/disable stdio payload monitoring--system: Enable system resource monitoring--server: Start the local web UI--stdio-uid: Filter stdio events by user ID--stdio-all-fds: Capture all file descriptors instead of only stdin/stdout/stderr--stdio-max-bytes: Limit captured bytes per stdio event--ssl-uid: Filter SSL events by user ID--ssl-handshake: Show SSL handshake events--log-file: Output file path--quiet: Suppress console output
Framework Architecture
Runners
Runners execute eBPF programs and create event streams:
// SSL Runner
let ssl_runner = from_binary_extractor
.with_args
.add_analyzer;
// Process Runner
let process_runner = from_binary_extractor
.with_args;
// Agent Runner (combines SSL + Process)
let agent_runner = new
.add_runner
.add_runner
.add_global_analyzer;
Analyzers
Analyzers process event streams in configurable chains:
- SSEProcessor: Merges HTTP chunks and processes Server-Sent Events
- HTTPParser: Parses HTTP requests/responses from SSL traffic
- HTTPFilter: Filters HTTP events by patterns
- SSLFilter: Filters SSL events by patterns
- FileLogger: Logs events to files
Console output is rendered by the CLI after the runner/analyzer pipeline returns events.
Event Format
Events use a standardized format:
Performance
- Low Overhead: eBPF monitoring with <3% performance impact
- Async Processing: Tokio-based async/await architecture
- Streaming: Real-time event processing with minimal memory usage
- Configurable: Modular analyzer chains for optimal performance
Examples
SSL Traffic Analysis
# Monitor HTTPS traffic with HTTP parsing
# Monitor Python processes with SSL
Process Lifecycle Tracking
# Monitor Python processes
# Monitor specific PID
Combined Monitoring
# Monitor web application
# Full system monitoring with web interface
# Log to file with quiet mode
Development
Building
# Development build
# Release build with optimizations
# Run tests
Adding Analyzers
use async_trait;
use Stream;
Binary Embedding
The collector automatically embeds eBPF binaries at compile time:
let binary_extractor = new.await?;
let ssl_path = binary_extractor.get_sslsniff_path;
let process_path = binary_extractor.get_process_path;
Security
- Root Privileges: eBPF programs require root access for kernel monitoring
- Independent Monitoring: System-level observation operates independently of application code
- Data Sensitivity: SSL traffic may contain sensitive information
- Secure Cleanup: Automatic cleanup of temporary files and processes
Troubleshooting
Common Issues
- Permission Denied: Ensure running with
sudoor appropriate capabilities - eBPF Not Supported: Requires Linux kernel 4.1+ with eBPF enabled
- Binary Extraction Failed: Check
/tmppermissions and disk space - High CPU Usage: Reduce event volume with filters
Debug Mode
# Enable debug logging
# Verbose eBPF program output
Requirements
- Rust: 1.88.0 or later (edition 2024)
- Linux: Kernel 4.1+ with eBPF support
- Libraries: clang, llvm, libelf-dev
- Privileges: Root access for eBPF operations
Dependencies
- tokio: Async runtime and stream processing
- serde: JSON serialization and deserialization
- clap: Command-line argument parsing
- chrono: Timestamp handling
- futures: Stream utilities and async processing
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass:
cargo test - Submit a pull request
License
[License information would go here]
Server Mode
The collector includes an embedded web server with frontend for visualization:
# Start tracing with the embedded frontend
# Access web interface
# http://127.0.0.1:7395/timeline
Web Interface Features
- Timeline View: Interactive event timeline with zoom and filtering
- Process Tree: Hierarchical process visualization
- Log View: Raw event inspection with JSON formatting
- Real-time Updates: Live data streaming and analysis
Related Projects
- AgentSight: Complete observability framework
- Frontend: React/TypeScript web interface (
../frontend/) - Analysis Tools: Python utilities for data processing (
../script/) - Documentation: Comprehensive guides and examples (
../docs/)
Package Information
- Package Name:
agentsight - Repository: https://github.com/eunomia-bpf/agentsight
- Binary Name:
agentsight(aftercargo build --release)