-
Notifications
You must be signed in to change notification settings - Fork 1
Sandbox Modes
Abhishek Gahlot edited this page Mar 27, 2026
·
1 revision
DeepGym runs code in three modes. Pick the one that fits your situation.
dg = DeepGym(mode='local')Runs the verifier and solution as a subprocess on your machine. Fast, no isolation, no setup. Fine for development and trusted code. Do not use with untrusted code.
Host Machine
|-- python verifier.py solution.py
|-- stdout -> JSON parse -> RunResult
dg = DeepGym(mode='daytona')Each run creates an ephemeral Daytona sandbox (container). Full OS/filesystem/network isolation. Slower due to container startup (~2-5s). Use this for production and untrusted agents.
Daytona Sandbox (ephemeral container)
|-- /home/user/verifier.py (uploaded)
|-- /home/user/solution.py (uploaded)
|-- /home/user/test_cases.json (if present)
|-- python verifier.py solution.py
|-- sandbox destroyed after run
Requires:
| Variable | What |
|---|---|
DAYTONA_API_KEY |
Your Daytona API key |
DAYTONA_API_URL |
API endpoint (only for self-hosted) |
Snapshots skip dependency installation:
env = Environment(task='...', verifier_code='...', snapshot='docker-dind')dg = DeepGym(mode='auto')Tries Daytona if DAYTONA_API_KEY is set, otherwise falls back to local. This is the default. Code written with mode='auto' works everywhere.
| Local | Daytona | Auto | |
|---|---|---|---|
| Setup | None | API key | None |
| Isolation | None | Full container | Depends |
| Speed | ~50ms | ~2-5s startup | Depends |
| Network | Host | Isolated | Depends |
| Untrusted code | Unsafe | Safe | Safe if Daytona available |
Uses ThreadPoolExecutor for run_batch().
Uses asyncio.Semaphore to cap concurrent sandbox creation.
| Mode | Range |
|---|---|
| Local | 4-8 (match your CPU cores) |
| Daytona (self-hosted) | 10-20 |
| Daytona (cloud) | 20-100 |