agentbox-rl 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. agentbox_rl-0.2.0/.gitignore +54 -0
  2. agentbox_rl-0.2.0/LICENSE +176 -0
  3. agentbox_rl-0.2.0/PKG-INFO +427 -0
  4. agentbox_rl-0.2.0/README.md +387 -0
  5. agentbox_rl-0.2.0/docker/python-sandbox/Dockerfile +10 -0
  6. agentbox_rl-0.2.0/examples/agentbox.yaml +35 -0
  7. agentbox_rl-0.2.0/examples/art_grpo_offline.py +91 -0
  8. agentbox_rl-0.2.0/examples/art_integration.py +85 -0
  9. agentbox_rl-0.2.0/examples/bench_run.py +125 -0
  10. agentbox_rl-0.2.0/examples/benchmarks/coding-mini/suite.json +69 -0
  11. agentbox_rl-0.2.0/examples/benchmarks/coding-mini/tasks/fix_fizzbuzz_001/files/fizzbuzz.py +2 -0
  12. agentbox_rl-0.2.0/examples/benchmarks/coding-mini/tasks/fix_fizzbuzz_001/files/test_fizzbuzz.py +13 -0
  13. agentbox_rl-0.2.0/examples/benchmarks/coding-mini/tasks/fix_fizzbuzz_001/task.json +28 -0
  14. agentbox_rl-0.2.0/examples/benchmarks/coding-mini/tasks/fix_reverse_001/files/reverse.py +2 -0
  15. agentbox_rl-0.2.0/examples/benchmarks/coding-mini/tasks/fix_reverse_001/files/test_reverse.py +7 -0
  16. agentbox_rl-0.2.0/examples/benchmarks/coding-mini/tasks/fix_reverse_001/task.json +29 -0
  17. agentbox_rl-0.2.0/examples/generate_tasks.py +73 -0
  18. agentbox_rl-0.2.0/examples/hello_rollout.py +74 -0
  19. agentbox_rl-0.2.0/examples/parallel_rollouts.py +78 -0
  20. agentbox_rl-0.2.0/examples/tasks/fix_fizzbuzz/task.json +21 -0
  21. agentbox_rl-0.2.0/examples/tasks/fix_reverse/task.json +20 -0
  22. agentbox_rl-0.2.0/pyproject.toml +84 -0
  23. agentbox_rl-0.2.0/src/agentbox/__init__.py +52 -0
  24. agentbox_rl-0.2.0/src/agentbox/agent/__init__.py +6 -0
  25. agentbox_rl-0.2.0/src/agentbox/agent/agent.py +59 -0
  26. agentbox_rl-0.2.0/src/agentbox/agent/loop.py +201 -0
  27. agentbox_rl-0.2.0/src/agentbox/agent/prompts.py +44 -0
  28. agentbox_rl-0.2.0/src/agentbox/benchmark/__init__.py +29 -0
  29. agentbox_rl-0.2.0/src/agentbox/benchmark/compare.py +51 -0
  30. agentbox_rl-0.2.0/src/agentbox/benchmark/hash.py +59 -0
  31. agentbox_rl-0.2.0/src/agentbox/benchmark/loader.py +152 -0
  32. agentbox_rl-0.2.0/src/agentbox/benchmark/report.py +175 -0
  33. agentbox_rl-0.2.0/src/agentbox/benchmark/runner.py +131 -0
  34. agentbox_rl-0.2.0/src/agentbox/benchmark/schema.py +198 -0
  35. agentbox_rl-0.2.0/src/agentbox/benchmark/setup_check.py +57 -0
  36. agentbox_rl-0.2.0/src/agentbox/cli/__init__.py +1 -0
  37. agentbox_rl-0.2.0/src/agentbox/cli/bench.py +571 -0
  38. agentbox_rl-0.2.0/src/agentbox/cli/generate.py +314 -0
  39. agentbox_rl-0.2.0/src/agentbox/cli/main.py +276 -0
  40. agentbox_rl-0.2.0/src/agentbox/cli/traj.py +82 -0
  41. agentbox_rl-0.2.0/src/agentbox/config.py +84 -0
  42. agentbox_rl-0.2.0/src/agentbox/config_load.py +107 -0
  43. agentbox_rl-0.2.0/src/agentbox/errors.py +79 -0
  44. agentbox_rl-0.2.0/src/agentbox/jobs/__init__.py +15 -0
  45. agentbox_rl-0.2.0/src/agentbox/jobs/artifacts.py +65 -0
  46. agentbox_rl-0.2.0/src/agentbox/jobs/cache.py +39 -0
  47. agentbox_rl-0.2.0/src/agentbox/jobs/types.py +67 -0
  48. agentbox_rl-0.2.0/src/agentbox/metrics/__init__.py +5 -0
  49. agentbox_rl-0.2.0/src/agentbox/metrics/aggregate.py +63 -0
  50. agentbox_rl-0.2.0/src/agentbox/model/__init__.py +17 -0
  51. agentbox_rl-0.2.0/src/agentbox/model/base.py +32 -0
  52. agentbox_rl-0.2.0/src/agentbox/model/errors.py +5 -0
  53. agentbox_rl-0.2.0/src/agentbox/model/mock.py +43 -0
  54. agentbox_rl-0.2.0/src/agentbox/model/openai_compat.py +153 -0
  55. agentbox_rl-0.2.0/src/agentbox/model/probe.py +186 -0
  56. agentbox_rl-0.2.0/src/agentbox/py.typed +0 -0
  57. agentbox_rl-0.2.0/src/agentbox/runner/__init__.py +6 -0
  58. agentbox_rl-0.2.0/src/agentbox/runner/parallel.py +194 -0
  59. agentbox_rl-0.2.0/src/agentbox/runner/rollout.py +251 -0
  60. agentbox_rl-0.2.0/src/agentbox/sandbox/__init__.py +15 -0
  61. agentbox_rl-0.2.0/src/agentbox/sandbox/docker_backend.py +158 -0
  62. agentbox_rl-0.2.0/src/agentbox/sandbox/images.py +29 -0
  63. agentbox_rl-0.2.0/src/agentbox/sandbox/manager.py +265 -0
  64. agentbox_rl-0.2.0/src/agentbox/sandbox/paths.py +65 -0
  65. agentbox_rl-0.2.0/src/agentbox/sandbox/prune.py +42 -0
  66. agentbox_rl-0.2.0/src/agentbox/sandbox/snapshot.py +43 -0
  67. agentbox_rl-0.2.0/src/agentbox/sandbox/types.py +67 -0
  68. agentbox_rl-0.2.0/src/agentbox/tasks/__init__.py +18 -0
  69. agentbox_rl-0.2.0/src/agentbox/tasks/bulk.py +67 -0
  70. agentbox_rl-0.2.0/src/agentbox/tasks/filter.py +100 -0
  71. agentbox_rl-0.2.0/src/agentbox/tasks/generate/__init__.py +42 -0
  72. agentbox_rl-0.2.0/src/agentbox/tasks/generate/batch.py +308 -0
  73. agentbox_rl-0.2.0/src/agentbox/tasks/generate/constraints.py +41 -0
  74. agentbox_rl-0.2.0/src/agentbox/tasks/generate/dedup.py +109 -0
  75. agentbox_rl-0.2.0/src/agentbox/tasks/generate/generator.py +665 -0
  76. agentbox_rl-0.2.0/src/agentbox/tasks/generate/llm_validate.py +325 -0
  77. agentbox_rl-0.2.0/src/agentbox/tasks/generate/lm.py +79 -0
  78. agentbox_rl-0.2.0/src/agentbox/tasks/generate/prompts.py +7 -0
  79. agentbox_rl-0.2.0/src/agentbox/tasks/generate/review.py +111 -0
  80. agentbox_rl-0.2.0/src/agentbox/tasks/generate/signatures.py +178 -0
  81. agentbox_rl-0.2.0/src/agentbox/tasks/generate/static_qc.py +236 -0
  82. agentbox_rl-0.2.0/src/agentbox/tasks/generate/strip_impl.py +71 -0
  83. agentbox_rl-0.2.0/src/agentbox/tasks/generate/validate.py +212 -0
  84. agentbox_rl-0.2.0/src/agentbox/tasks/loader.py +15 -0
  85. agentbox_rl-0.2.0/src/agentbox/tasks/rewards.py +47 -0
  86. agentbox_rl-0.2.0/src/agentbox/tasks/schema.py +79 -0
  87. agentbox_rl-0.2.0/src/agentbox/tasks/seeder.py +78 -0
  88. agentbox_rl-0.2.0/src/agentbox/tasks/verifier.py +65 -0
  89. agentbox_rl-0.2.0/src/agentbox/tools/__init__.py +16 -0
  90. agentbox_rl-0.2.0/src/agentbox/tools/base.py +54 -0
  91. agentbox_rl-0.2.0/src/agentbox/tools/builtins.py +31 -0
  92. agentbox_rl-0.2.0/src/agentbox/tools/decorator.py +89 -0
  93. agentbox_rl-0.2.0/src/agentbox/tools/executor.py +87 -0
  94. agentbox_rl-0.2.0/src/agentbox/tools/file_tools.py +162 -0
  95. agentbox_rl-0.2.0/src/agentbox/tools/registry.py +99 -0
  96. agentbox_rl-0.2.0/src/agentbox/tools/shell.py +63 -0
  97. agentbox_rl-0.2.0/src/agentbox/tools/tests_tool.py +35 -0
  98. agentbox_rl-0.2.0/src/agentbox/trajectory/__init__.py +12 -0
  99. agentbox_rl-0.2.0/src/agentbox/trajectory/formats/__init__.py +6 -0
  100. agentbox_rl-0.2.0/src/agentbox/trajectory/formats/art.py +68 -0
  101. agentbox_rl-0.2.0/src/agentbox/trajectory/formats/jsonl.py +17 -0
  102. agentbox_rl-0.2.0/src/agentbox/trajectory/recorder.py +76 -0
  103. agentbox_rl-0.2.0/src/agentbox/trajectory/render.py +334 -0
  104. agentbox_rl-0.2.0/src/agentbox/trajectory/schema.py +124 -0
  105. agentbox_rl-0.2.0/src/agentbox/types.py +42 -0
  106. agentbox_rl-0.2.0/src/agentbox/version.py +3 -0
  107. agentbox_rl-0.2.0/tests/integration/test_benchmark_run.py +134 -0
  108. agentbox_rl-0.2.0/tests/integration/test_parallel_rollouts.py +91 -0
  109. agentbox_rl-0.2.0/tests/integration/test_rollout_mock.py +91 -0
  110. agentbox_rl-0.2.0/tests/integration/test_sandbox.py +60 -0
  111. agentbox_rl-0.2.0/tests/unit/test_agent_loop.py +119 -0
  112. agentbox_rl-0.2.0/tests/unit/test_art_group.py +49 -0
  113. agentbox_rl-0.2.0/tests/unit/test_benchmark_hash.py +29 -0
  114. agentbox_rl-0.2.0/tests/unit/test_benchmark_loader.py +53 -0
  115. agentbox_rl-0.2.0/tests/unit/test_benchmark_report.py +25 -0
  116. agentbox_rl-0.2.0/tests/unit/test_config_load.py +43 -0
  117. agentbox_rl-0.2.0/tests/unit/test_dedup_review.py +79 -0
  118. agentbox_rl-0.2.0/tests/unit/test_filter.py +32 -0
  119. agentbox_rl-0.2.0/tests/unit/test_generate_parse.py +24 -0
  120. agentbox_rl-0.2.0/tests/unit/test_jobs.py +25 -0
  121. agentbox_rl-0.2.0/tests/unit/test_llm_validate.py +126 -0
  122. agentbox_rl-0.2.0/tests/unit/test_metrics.py +29 -0
  123. agentbox_rl-0.2.0/tests/unit/test_model_probe.py +101 -0
  124. agentbox_rl-0.2.0/tests/unit/test_parallel.py +24 -0
  125. agentbox_rl-0.2.0/tests/unit/test_paths.py +32 -0
  126. agentbox_rl-0.2.0/tests/unit/test_rewards.py +16 -0
  127. agentbox_rl-0.2.0/tests/unit/test_setup_check.py +46 -0
  128. agentbox_rl-0.2.0/tests/unit/test_static_qc.py +78 -0
  129. agentbox_rl-0.2.0/tests/unit/test_strip_and_cache.py +32 -0
  130. agentbox_rl-0.2.0/tests/unit/test_task_schema.py +21 -0
  131. agentbox_rl-0.2.0/tests/unit/test_tools.py +68 -0
  132. agentbox_rl-0.2.0/tests/unit/test_trajectory_art.py +26 -0
  133. agentbox_rl-0.2.0/tests/unit/test_two_stage_strip.py +40 -0
@@ -0,0 +1,54 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual envs
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+
28
+ # Testing / typing
29
+ .pytest_cache/
30
+ .mypy_cache/
31
+ .ruff_cache/
32
+ .coverage
33
+ htmlcov/
34
+ .tox/
35
+
36
+ # IDE
37
+ .idea/
38
+ .vscode/
39
+ *.swp
40
+ .DS_Store
41
+
42
+ # Project artifacts
43
+ trajectories/
44
+ out/
45
+ *.log
46
+ .env
47
+ .env.*
48
+
49
+ # Docker
50
+ .docker-cache/
51
+ bench-results/
52
+
53
+ # Pi agent artifacts
54
+ .pi-subagents/
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranty or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,427 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentbox-rl
3
+ Version: 0.2.0
4
+ Summary: Fully local agentic virtual environment for trajectory building
5
+ Project-URL: Homepage, https://github.com/konic-labs/agentbox
6
+ Project-URL: Documentation, https://github.com/konic-labs/agentbox#readme
7
+ Author: AgentBox Contributors
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: agents,docker,llm,rl,sandbox,trajectory
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: anyio>=4.0
21
+ Requires-Dist: docker>=7.0
22
+ Requires-Dist: httpx>=0.27
23
+ Requires-Dist: openai>=1.40
24
+ Requires-Dist: pydantic>=2.6
25
+ Requires-Dist: structlog>=24.0
26
+ Requires-Dist: typer>=0.12
27
+ Provides-Extra: art
28
+ Requires-Dist: openpipe-art>=0.4; extra == 'art'
29
+ Provides-Extra: dev
30
+ Requires-Dist: mypy>=1.11; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
32
+ Requires-Dist: pytest-timeout>=2.3; extra == 'dev'
33
+ Requires-Dist: pytest>=8.0; extra == 'dev'
34
+ Requires-Dist: ruff>=0.6; extra == 'dev'
35
+ Provides-Extra: generate
36
+ Requires-Dist: dspy>=2.5; extra == 'generate'
37
+ Provides-Extra: rich
38
+ Requires-Dist: rich>=13; extra == 'rich'
39
+ Description-Content-Type: text/markdown
40
+
41
+ <div align="center">
42
+
43
+ # AgentBox
44
+
45
+ **ART-native rollout engine for real agentic trajectories in Docker sandboxes.**
46
+
47
+ [Quick Start](#quick-start) ·
48
+ [Workflow](#workflow) ·
49
+ [Tools](#tools) ·
50
+ [Models](#models--providers) ·
51
+ [Tasks](#tasks) ·
52
+ [Trajectories](#trajectories--art) ·
53
+ [CLI](#cli-reference) ·
54
+ [Benchmarks](#benchmarks) ·
55
+ [Docs](#technical-docs) ·
56
+ [Development](#development) ·
57
+ [License](#license)
58
+
59
+ ![Python](https://img.shields.io/badge/Python-3.11%2B-blue)
60
+ ![Runtime](https://img.shields.io/badge/Runtime-Docker%20%7C%20AsyncIO-black)
61
+ ![ART](https://img.shields.io/badge/ART-native-orange)
62
+ ![Package](https://img.shields.io/badge/Package-agentbox-green)
63
+ ![License](https://img.shields.io/badge/License-Apache%202.0-green)
64
+
65
+ </div>
66
+
67
+ AgentBox is an **ART-native** environment + rollout harness: isolated Docker
68
+ sandboxes, structured tools (or pure shell), task seeding, verifiers, and
69
+ multi-turn trajectories shaped for [OpenPipe ART](https://github.com/OpenPipe/ART)
70
+ (`messages_and_choices`, rewards, groups) — for online GRPO with ART’s inference
71
+ backend, offline SFT dumps, and the same real-rollout path for benchmarks.
72
+
73
+ It is **not** a trainer. ART (or TRL / Unsloth / verl) owns training; AgentBox
74
+ owns the virtual env and trajectory collection.
75
+
76
+ ## Highlights
77
+
78
+ - **ART-native trajectories** — `to_art_dict()` / `to_art()`; GRPO groups via `ParallelRunner`
79
+ - **One container per rollout** — clean state, parallel isolation, labeled GC
80
+ - **OpenAI tools protocol** — Chat Completions + tool calling (ART-compatible wire format)
81
+ - **Provider-agnostic models** — Featherless, OpenRouter, vLLM, Ollama, ART backend client, …
82
+ - **Builtins + custom tools** — `BaseTool` / `@tool`, override-by-name
83
+ - **Task seeding** — `starter_files` + `setup_commands` before the agent starts
84
+ - **Objective rewards** — pytest / command verifiers (hybrid-ready with ART RULER)
85
+ - **ParallelRunner** — concurrent rollouts and GRPO-style groups
86
+ - **Trajectory export** — JSON, JSONL, ART-native dicts
87
+ - **Typer CLI** — `doctor`, `generate`, `bench`, `traj`, `run`, `export`, `prune`
88
+ - **Real-rollout benchmarks** — freeze tasks + env; multi-student scoring
89
+ - **Task generation** — batch + two-stage stubs + static/Docker/LLM QC (no private scripts)
90
+ - **Trajectory HTML** — official verifier vs agent self-check dashboard
91
+
92
+ ## Quick Start
93
+
94
+ **Prerequisites:** Python 3.11+, [Docker](https://docs.docker.com/get-docker/)
95
+ daemon running, optional [`uv`](https://github.com/astral-sh/uv).
96
+
97
+ ```bash
98
+ git clone https://github.com/konic-labs/agentbox.git
99
+ cd agentbox
100
+ uv venv .venv --seed --python 3.12
101
+ source .venv/bin/activate
102
+ uv pip install -e ".[dev]"
103
+
104
+ # Optional
105
+ uv pip install -e ".[rich]" # progress bars
106
+ uv pip install -e ".[art]" # live art.Trajectory
107
+ uv pip install -e ".[generate]" # DSPy task generation
108
+ ```
109
+
110
+ Sanity checks (no external LLM required):
111
+
112
+ ```bash
113
+ agentbox version
114
+ agentbox doctor
115
+ uv run pytest tests/unit -q
116
+ python examples/hello_rollout.py
117
+ ```
118
+
119
+ ### Minimal Python rollout (mock)
120
+
121
+ ```python
122
+ import asyncio
123
+ from agentbox import Task, Rollout
124
+ from agentbox.config import SandboxConfig, ResourceLimits
125
+ from agentbox.model import MockModelClient, ModelResponse
126
+ from agentbox.trajectory.schema import ToolCall, FunctionCall
127
+ import json
128
+
129
+ async def main():
130
+ task = Task.from_json("examples/tasks/fix_fizzbuzz/task.json")
131
+ fixed = 'def fizzbuzz(n):\n return "Fizz" if n % 3 == 0 else str(n)\n'
132
+ mock = MockModelClient([
133
+ ModelResponse(
134
+ content=None,
135
+ tool_calls=[ToolCall(
136
+ id="c1",
137
+ function=FunctionCall(
138
+ name="write_file",
139
+ arguments=json.dumps({"path": "fizzbuzz.py", "content": fixed}),
140
+ ),
141
+ )],
142
+ ),
143
+ ModelResponse(content="done", tool_calls=[]),
144
+ ])
145
+ traj = await Rollout.run(
146
+ task,
147
+ model=mock,
148
+ sandbox=SandboxConfig(
149
+ limits=ResourceLimits(network_disabled=False),
150
+ ),
151
+ )
152
+ print(traj.final_status, traj.reward)
153
+ traj.save("out/traj.json")
154
+
155
+ asyncio.run(main())
156
+ ```
157
+
158
+ ### Real model (Ollama)
159
+
160
+ ```bash
161
+ agentbox run examples/tasks/fix_fizzbuzz/task.json \
162
+ --model qwen2.5-coder:7b \
163
+ --base-url http://localhost:11434/v1 \
164
+ --api-key ollama \
165
+ --network \
166
+ --out trajectories/
167
+ ```
168
+
169
+ ```python
170
+ from agentbox import Agent, Task, Rollout
171
+
172
+ agent = Agent(
173
+ model="qwen2.5-coder:7b",
174
+ base_url="http://localhost:11434/v1",
175
+ api_key="ollama",
176
+ max_steps=20,
177
+ )
178
+ traj = await Rollout.run(task=Task.from_json("examples/tasks/fix_fizzbuzz/task.json"), agent=agent)
179
+ ```
180
+
181
+ ### Parallel / GRPO-style groups
182
+
183
+ ```python
184
+ from agentbox import ParallelRunner, Agent
185
+
186
+ runner = ParallelRunner(concurrency=16, agent=agent)
187
+ trajs = await runner.run_tasks(tasks, n_per_task=1)
188
+ groups = await runner.run_groups(tasks, group_size=4)
189
+ art = [[t.to_art_dict() for t in g] for g in groups]
190
+ ```
191
+
192
+ ## Workflow
193
+
194
+ | Step | What happens | Artifact |
195
+ | --- | --- | --- |
196
+ | 0. Task | Load or generate Task definition | `task.json` |
197
+ | 1. Sandbox | Create labeled Docker container | running container |
198
+ | 2. Seed | Write `starter_files`, run `setup_commands` | `/workspace` ready |
199
+ | 3. Agent | Multi-turn tools via OpenAI protocol | messages + tool records |
200
+ | 4. Verify | pytest / command exit code | reward |
201
+ | 5. Record | Finalize trajectory, destroy container | JSON / ART dict |
202
+
203
+ ```txt
204
+ task → create sandbox → seed → agent loop → verifier → trajectory → destroy
205
+ ```
206
+
207
+ ## Tools
208
+
209
+ | Builtin | Role |
210
+ | --- | --- |
211
+ | `list_files` | List workspace paths |
212
+ | `read_file` | Read file content |
213
+ | `write_file` | Create / overwrite |
214
+ | `edit_file` | Exact one-occurrence replace (`old_string` / `new_string`) |
215
+ | `run_command` | Shell in container |
216
+ | `run_tests` | Default `python -m pytest -q` |
217
+
218
+ Modes: `structured` (all builtins), `shell` (`run_command` only), `custom`.
219
+
220
+ Custom tools:
221
+
222
+ ```python
223
+ from agentbox.tools import tool
224
+
225
+ @tool(description="Count lines")
226
+ async def count_lines(sandbox, path: str) -> str:
227
+ r = await sandbox.exec(f"wc -l -- {path}")
228
+ return r.stdout.strip()
229
+
230
+ agent = Agent(model="...", base_url="...", custom_tools=[count_lines])
231
+ ```
232
+
233
+ Same `name` overrides a builtin. Details: [docs/tools.md](docs/tools.md).
234
+
235
+ ## Models & Providers
236
+
237
+ OpenAI Chat Completions + tools only. Configure any compatible endpoint:
238
+
239
+ | Type | Examples | Config |
240
+ | --- | --- | --- |
241
+ | External | Featherless, OpenRouter, Together, Fireworks | `base_url` + `api_key` |
242
+ | Local | vLLM, SGLang, Ollama `/v1` | `base_url`; `api_key` optional |
243
+
244
+ ```python
245
+ Agent(model="glm-5.2", base_url="https://api.featherless.ai/v1", api_key="...")
246
+ Agent(model="Qwen/Qwen2.5-7B-Instruct", base_url="http://localhost:8000/v1")
247
+ ```
248
+
249
+ ## Tasks
250
+
251
+ ```json
252
+ {
253
+ "task_id": "fix_fizzbuzz_001",
254
+ "description": "Fix fizzbuzz so tests pass.",
255
+ "starter_files": { "fizzbuzz.py": "...", "test_fizzbuzz.py": "..." },
256
+ "setup_commands": ["pip install -q pytest"],
257
+ "verifier": {
258
+ "type": "pytest",
259
+ "command": "python -m pytest -q",
260
+ "success_exit_code": 0
261
+ },
262
+ "metadata": { "difficulty": "easy", "tags": ["python"] }
263
+ }
264
+ ```
265
+
266
+ Automated generation (optional):
267
+
268
+ ```python
269
+ from agentbox.tasks.generate import TaskGenerator, GenerateConfig
270
+
271
+ gen = TaskGenerator(GenerateConfig(
272
+ model="glm-5.2",
273
+ base_url="https://api.featherless.ai/v1",
274
+ api_key="...",
275
+ validate_in_docker=True,
276
+ ))
277
+ task = await gen.generate(difficulty="easy", domain="python")
278
+ ```
279
+
280
+ ## Trajectories & ART
281
+
282
+ AgentBox is built to drop into ART workflows:
283
+
284
+ | Flow | AgentBox role | ART role |
285
+ | --- | --- | --- |
286
+ | **Online GRPO** | Docker env, tools, tasks, optional verifier | Inference (vLLM/LoRA) + `backend.train` |
287
+ | **Offline SFT** | Bulk rollouts from any API | SFT on exported trajectories |
288
+ | **Rewards** | Verifier scores | Optional RULER on groups (hybrid OK) |
289
+
290
+ ```python
291
+ traj.save("trajectories/run.json")
292
+ art = traj.to_art_dict() # ART-native: messages_and_choices, reward, metrics, metadata
293
+ # uv pip install -e ".[art]"
294
+ # live = traj.to_art() # openpipe-art Trajectory object
295
+ ```
296
+
297
+ ```bash
298
+ agentbox export traj.json --format art -o traj.art.json
299
+ python examples/art_integration.py
300
+ ```
301
+
302
+ ## Production workflows
303
+
304
+ End-to-end lab path **without private scripts**:
305
+
306
+ ```bash
307
+ # 0) Optional project config (teacher + students)
308
+ cp examples/agentbox.yaml ./agentbox.yaml # edit endpoints
309
+
310
+ # 1) Probe tool-calling before a long suite
311
+ agentbox doctor --model MODEL --base-url http://localhost:8000/v1
312
+
313
+ # 2) Generate a QC-passed task set
314
+ agentbox generate batch -m MODEL --base-url URL -n 20 -c 8 --two-stage \
315
+ -o generated/tasks
316
+
317
+ # 3) Freeze a suite and run multi-student bench
318
+ agentbox bench create suites/coding-v1 --from-tasks generated/tasks \
319
+ --suite-id coding-v1 --name "coding v1"
320
+ agentbox bench run suites/coding-v1 \
321
+ --student small=qwen3.5:0.8b@http://localhost:11434/v1 \
322
+ --student big=MODEL@http://localhost:8000/v1 \
323
+ --probe --out bench-results/run1
324
+
325
+ # 4) Inspect
326
+ agentbox bench show bench-results/run1/report.json --out REPORT.md
327
+ agentbox traj render bench-results/run1 -o traj-dash.html
328
+
329
+ # 5) ART offline groups
330
+ python examples/art_grpo_offline.py
331
+ ```
332
+
333
+ Details: [docs/generation.md](docs/generation.md) · [docs/art_grpo.md](docs/art_grpo.md) · [docs/trajectories.md](docs/trajectories.md).
334
+
335
+ ## CLI Reference
336
+
337
+ ```bash
338
+ agentbox doctor [--prune] [--model M --base-url URL]
339
+ agentbox build-image [--tag agentbox/sandbox:latest]
340
+ agentbox generate one|batch|validate-llm|validate-docker …
341
+ agentbox run TASK.json -m MODEL --base-url URL [--network] [--out trajectories/]
342
+ agentbox run-dir tasks/ -m MODEL --base-url URL -c 16 --n 4
343
+ agentbox bench create DIR --from-tasks tasks/ --suite-id ID --name NAME
344
+ agentbox bench freeze DIR && agentbox bench validate DIR --strict
345
+ agentbox bench run DIR -m MODEL --base-url URL --model-id LABEL -o bench-results/run1
346
+ agentbox bench run DIR --student id=model@url --probe --limit 5
347
+ agentbox bench show bench-results/run1/report.json --out extended.md
348
+ agentbox traj show traj.json
349
+ agentbox traj render bench-results/run1 -o traj-dash.html
350
+ agentbox export traj.json --format art -o out.json
351
+ agentbox prune
352
+ ```
353
+
354
+ Full flag list: [docs/cli.md](docs/cli.md) · [docs/benchmarks.md](docs/benchmarks.md).
355
+
356
+ ## Benchmarks
357
+
358
+ Same Docker rollouts as training collection, frozen as a suite, scored against
359
+ any OpenAI-compatible endpoint (local or external).
360
+
361
+ ```bash
362
+ python examples/bench_run.py # hermetic mock solver (Docker required)
363
+
364
+ agentbox bench run examples/benchmarks/coding-mini \
365
+ --model-id ollama-qwen \
366
+ --model qwen2.5-coder:7b \
367
+ --base-url http://localhost:11434/v1 \
368
+ --api-key ollama \
369
+ --out bench-results/run1
370
+ ```
371
+
372
+ Setup checks run after seed (env health); task verifiers own success/reward.
373
+ Details: [docs/benchmarks.md](docs/benchmarks.md).
374
+
375
+ ## Sandbox image
376
+
377
+ Default: **`python:3.12-slim-bookworm`** (glibc; not Alpine).
378
+
379
+ ```bash
380
+ agentbox build-image # optional baked image with pytest + unix tools
381
+ ```
382
+
383
+ Override: `SandboxConfig(image="my-org/env:1.2")` or presets in
384
+ `agentbox.sandbox.images`.
385
+
386
+ ## Technical Docs
387
+
388
+ | Doc | Concern |
389
+ | --- | --- |
390
+ | [docs/index.md](docs/index.md) | Documentation map |
391
+ | [docs/setup.md](docs/setup.md) | Install & first runs |
392
+ | [docs/architecture.md](docs/architecture.md) | Module boundaries & data flow |
393
+ | [docs/configuration.md](docs/configuration.md) | All config fields |
394
+ | [docs/sandbox.md](docs/sandbox.md) | Docker lifecycle, jail, prune |
395
+ | [docs/tools.md](docs/tools.md) | Builtins & custom tools |
396
+ | [docs/models.md](docs/models.md) | Providers & clients |
397
+ | [docs/agent.md](docs/agent.md) | Loop, timeouts, prompts |
398
+ | [docs/tasks.md](docs/tasks.md) | Schema, seeder, verifier |
399
+ | [docs/generation.md](docs/generation.md) | Automated task generation |
400
+ | [docs/trajectories.md](docs/trajectories.md) | Formats & ART export |
401
+ | [docs/runner.md](docs/runner.md) | Rollout & parallel |
402
+ | [docs/cli.md](docs/cli.md) | CLI reference |
403
+ | [docs/benchmarks.md](docs/benchmarks.md) | Real-rollout multi-model suites |
404
+ | [docs/security.md](docs/security.md) | Isolation model |
405
+ | [docs/development.md](docs/development.md) | Tests & extension |
406
+
407
+ ## Development
408
+
409
+ ```bash
410
+ uv pip install -e ".[dev]"
411
+ uv run pytest tests/unit -q
412
+ uv run pytest tests/integration -q -m docker
413
+ uv run agentbox doctor
414
+ ```
415
+
416
+ Conventional Commits (`feat:`, `fix:`, `docs:`, `test:`, …). See
417
+ [docs/development.md](docs/development.md).
418
+
419
+ ## Security (short)
420
+
421
+ Tools run **only** inside Docker; paths jailed under `/workspace`; network off
422
+ by default; never mount the Docker socket into sandboxes. Details:
423
+ [docs/security.md](docs/security.md).
424
+
425
+ ## License
426
+
427
+ Apache License 2.0. See [LICENSE](LICENSE).