Overview
Implement E2BAgentAdapter so that --engine cloud runs the CodeFrame agent inside a full Linux VM via the E2B SDK, enabling long-running, fully isolated execution without touching the local filesystem.
Motivation
Some tasks are too risky or too slow to run on the local filesystem:
- Tasks that modify many files across the repo
- Tasks needing specific OS-level dependencies
- Parallel tasks where each needs a full clean environment
- CI-grade isolation without spinning up Docker
E2B provides on-demand Linux sandboxes via API with up to 1-hour execution windows.
Deliverables
codeframe/adapters/e2b/adapter.py
class E2BAgentAdapter:
"""Runs CodeFrame's ReAct agent loop inside an E2B sandbox."""
def execute(self, task: Task, context: TaskContext) -> AgentResult:
# 1. Create E2B sandbox
# 2. Upload workspace files (with credential scanning — no secrets)
# 3. Install codeframe in sandbox
# 4. Run ReactAgent inside sandbox
# 5. Download changed files
# 6. Return AgentResult
CLI
--engine cloud on cf work start and cf work batch run
- Requires
E2B_API_KEY in environment (validated at startup)
Budget tracking
- Track E2B sandbox-minutes per task and per batch
cf work show <id> displays cloud execution cost
- Configurable timeout (default: 30 min, max: 60 min)
Credential scanning
- Before upload, scan for
.env, secrets, API keys
- Refuse upload if credential patterns detected
- Log what was and wasn't uploaded
ExecutionContext integration
IsolationLevel.CLOUD routes through this adapter
context.workspace_path points to the downloaded results directory post-execution
Acceptance Criteria
Dependencies
Track
Phase 4.B — Execution Environment Layer
Overview
Implement
E2BAgentAdapterso that--engine cloudruns the CodeFrame agent inside a full Linux VM via the E2B SDK, enabling long-running, fully isolated execution without touching the local filesystem.Motivation
Some tasks are too risky or too slow to run on the local filesystem:
E2B provides on-demand Linux sandboxes via API with up to 1-hour execution windows.
Deliverables
codeframe/adapters/e2b/adapter.pyCLI
--engine cloudoncf work startandcf work batch runE2B_API_KEYin environment (validated at startup)Budget tracking
cf work show <id>displays cloud execution costCredential scanning
.env, secrets, API keysExecutionContextintegrationIsolationLevel.CLOUDroutes through this adaptercontext.workspace_pathpoints to the downloaded results directory post-executionAcceptance Criteria
E2BAgentAdapterincodeframe/adapters/e2b/adapter.py--engine cloudflag wired in CLI and runtimeE2B_API_KEYvalidated before execution startscf work showDependencies
Track
Phase 4.B — Execution Environment Layer