Repository navigation
Commit 8f26600
Use bespokelabs-sandbox to run code in sandboxes (#716)
* Replace code execution backends with bespokelabs-sandbox
Remove the four built-in execution backends (multiprocessing, docker, ray, e2b)
and replace them with a single unified backend powered by bespokelabs-sandbox.
This delegates sandbox lifecycle, isolation, and multi-provider support to the
sandbox package while keeping curator's orchestration layer (caching, retries,
request/response files) intact.
- Add SandboxCodeExecutionBackend using bespokelabs.sandbox.Sandbox
- bespokelabs-sandbox is a required dep; "local" backend works out of the box
- code_execution extra installs docker/ray/e2b SDKs for non-local backends
- Preserve legacy docker_image and base_url config params for backwards compat
- Tar archives retain directory structure (os.path.relpath, not basename)
- Regenerate poetry.lock for the new dependency graph
- Update tests and examples for new backend names
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Pin bespokelabs-sandbox to 0.1.1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Remove redundant docker/ray/e2b deps and code_execution extra
Backend SDKs are managed by bespokelabs-sandbox's own extras
(e.g. pip install bespokelabs-sandbox[docker]).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Remove code_execution extra from CI workflow
The code_execution extra was removed from pyproject.toml since backend
SDKs are now managed by bespokelabs-sandbox's own extras.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Always return message=success for completed executions
Non-zero exit codes are valid outcomes (e.g. code-verification workloads).
Setting error on non-zero exits caused validate_existing_response_file to
discard and re-run those responses on every resume.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Auto-format base_backend.py and curator_response.py with ruff
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add unit tests for CuratorResponse and misc to meet 80% coverage
- Test all dataclass add/append methods on TokenUsage, CostInfo,
RequestStats, PerformanceStats
- Test CuratorResponse save/load, to_dict, get_failed_requests,
__getattr__ deprecation, update_tracker_stats offline path
- Test safe_model_dump normal and fallback paths
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Enforce per-execution timeout via shell timeout command
The sandbox lifecycle timeout (timeout_secs) is a safety net, not the
per-execution limit. Use `timeout N` in the shell command to kill the
python process after exactly N seconds, matching the old subprocess.run
timeout behavior.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: Format test_misc.py with ruff
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Improve sandbox backend error handling and add unit tests
- Distinguish exit code 124 (timeout) with message="timeout"
- Format non-zero exit code errors with stderr details
- Preserve stdout/stderr/files in exception handler
- Add unit tests with fake sandbox for all error paths
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent cb11a56 commit 8f26600
22 files changed
Lines changed: 544 additions & 857 deletions
File tree
- .github/workflows
- examples/code-execution
- chart-generation
- code-verification
- math-animation
- src/bespokelabs/curator
- code_executor
- code_execution_backend
- types
- tests
- code_executor
- unittests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | 111 | | |
113 | | - | |
| 112 | + | |
114 | 113 | | |
115 | 114 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 115 | + | |
121 | 116 | | |
122 | 117 | | |
123 | 118 | | |
| |||
126 | 121 | | |
127 | 122 | | |
128 | 123 | | |
129 | | - | |
| 124 | + | |
130 | 125 | | |
131 | 126 | | |
132 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
| 78 | + | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
| 38 | + | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | | - | |
49 | 46 | | |
50 | 47 | | |
51 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
5 | 12 | | |
6 | 13 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 14 | + | |
11 | 15 | | |
12 | | - | |
13 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
14 | 19 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
18 | 23 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 33 | + | |
30 | 34 | | |
31 | | - | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
656 | 654 | | |
657 | 655 | | |
658 | 656 | | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
0 commit comments