Overview
HopX provides agent performance metrics to monitor sandbox execution performance:- Agent Metrics: Agent performance metrics including uptime, execution counts, error rates, and per-endpoint statistics
Both
get_metrics_snapshot() and get_agent_metrics() return agent performance metrics. They provide the same data structure.Agent Metrics Snapshot
Get a snapshot of current agent performance metrics:- Python
- JavaScript
Agent Performance Metrics
Get detailed agent performance metrics:- Python
- JavaScript
Monitoring Agent Performance
Monitor agent metrics over time to track performance:- Python
- JavaScript
Metrics Structure
Agent Metrics Response
Bothget_metrics_snapshot() and get_agent_metrics() return the same structure:
Field Descriptions
uptime_seconds: Agent uptime in secondstotal_executions: Total number of code executions processedactive_executions: Currently running executionserror_count: Total number of errors encounteredrequests_total: Per-endpoint request countsavg_duration_ms: Average request duration by endpoint (milliseconds)p95_duration_ms: 95th percentile request duration by endpoint (milliseconds)
Use Cases
Monitoring Execution Performance
Monitor agent performance during code execution:- Python
- JavaScript
Performance Analysis
Analyze agent performance to identify bottlenecks:- Python
- JavaScript
Best Practices
API Reference
Python SDK
sandbox.get_metrics_snapshot()- Get agent performance metrics snapshotsandbox.get_agent_metrics()- Get agent performance metrics (same as get_metrics_snapshot)
JavaScript SDK
sandbox.getMetricsSnapshot()- Get agent performance metrics snapshotsandbox.getAgentMetrics()- Get agent performance metrics (same as getMetricsSnapshot)
API Endpoints
- GET
/metrics/snapshot- Get agent performance metrics snapshot
Related
- Process Monitoring - Monitor running processes
- SDK: sandbox.get_agent_metrics() - Python SDK method
- API: GET /system - VM Agent API endpoint
- CLI System Commands - System operations from CLI
Next Steps
- Learn about Process Monitoring to track running processes
- Explore Code Execution to execute code in sandboxes
- Review Managing Sandbox State for lifecycle control

