Skip to content

[Feature Request] Add sandbox resource usage metrics and limits #1257

@rehan243

Description

@rehan243

Feature Description

Expose real-time resource usage (CPU, memory, disk) for running sandboxes and allow configurable limits.

Use Case

When using E2B for AI code execution in production:

  1. Need to prevent runaway processes from consuming resources
  2. Want to track resource usage for billing/optimization
  3. Need to set per-sandbox memory limits for multi-tenant environments

Proposed API

sandbox = Sandbox(memory_limit_mb=512, cpu_limit=1.0)
metrics = sandbox.get_metrics()  # {cpu_pct: 45, mem_mb: 200, disk_mb: 50}

This would make E2B more suitable for production deployments with strict resource governance. Great platform!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions