Sandboxed Memory Profiling for Agent Code Execution with LangChain and E2B
Quantify KV-cache memory consumption and execution runtime when executing agent code snippets. Construct a LangChain agent using the E2B sandbox environment to execute untrusted code while tracking real-time host memory allocation and runtime overhead.
What you are building
Build a stateful LangChain agent that executes dynamic Python code in isolated E2B sandboxes and monitors KV-cache and system memory footprints under concurrent runs.
How work is evaluated
Evaluates E2B sandbox metrics capture accuracy during agent tool invocation.
Datasets
Public datasets, plus the private datasets you have access to.
How submissions are scored
Execution Success Test
Check that return_code is 0.
This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.
Memory Overhead Drift
Measures accuracy of reported memory footprint. • target: 0.98 • range: 0-1
This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.
Learning goals
Deploy code execution sandboxes using E2B integrated with LangChain agents.
Track dynamic host RAM and GPU KV-cache allocation during concurrent code execution.
Ensure execution safety and isolation for automated code generation tasks.
Resources
A test suite of 20 computational Python scripts with known memory requirements.
Challenge setup
Evaluates E2B sandbox metrics capture accuracy during agent tool invocation.
Challenge input
Python code snippet to execute
LangChain
Agent orchestration framework.
E2B
Isolated microVM execution environment.
Evaluated output
JSON containing return_code, peak_memory_mb, execution_time_s
- Check that return_code is 0.
- Measures accuracy of reported memory footprint. • target: 0.98 • range: 0-1
- Benchmark: E2B Code Interpreter Benchmark
- Memory Overhead Drift target: 0.98
- 1 public reference case
- Python execution harness
- Python sandbox (unavailable on Versalist)
Shows the first task, up to three tools, and up to three evidence items.
View technical recipe
Configured tools
- E2B · Optional
- Langchain · Required
- LangChain · Optional
- E2B · Optional
- Langchain · Required
- LangChain · Optional
Evaluation contract
- Execution Success Test · Weight 1
- Memory Overhead Drift · Weight 1
Metrics
- Memory Overhead Drift · Target 0.98
Benchmarks
- E2B Code Interpreter Benchmark
- security
Reference cases
- 1 public reference case
Workflow tasks
- Task 1
Input: Python code snippet to execute
Output: JSON containing return_code, peak_memory_mb, execution_time_s
Execution harness: Python
Evaluation tools
- LangChain · Framework
- E2B · Agent System Sandbox
Recipe freeze marker
No recipe freeze time is recorded.