agent-sandbox-server 0.3.1a1__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 (99) hide show
  1. agent_sandbox_server-0.3.1a1/.gitignore +74 -0
  2. agent_sandbox_server-0.3.1a1/LICENSE +200 -0
  3. agent_sandbox_server-0.3.1a1/NOTICE +18 -0
  4. agent_sandbox_server-0.3.1a1/PKG-INFO +86 -0
  5. agent_sandbox_server-0.3.1a1/README.md +53 -0
  6. agent_sandbox_server-0.3.1a1/pyproject.toml +95 -0
  7. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/__init__.py +64 -0
  8. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/__main__.py +224 -0
  9. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/_coerce.py +169 -0
  10. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/_version.py +1 -0
  11. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/__init__.py +66 -0
  12. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/adapters/__init__.py +140 -0
  13. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/adapters/base.py +224 -0
  14. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/adapters/claude_code.py +132 -0
  15. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/adapters/codex.py +303 -0
  16. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/adapters/command.py +126 -0
  17. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/adapters/cursor.py +248 -0
  18. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/adapters/qwen_code.py +135 -0
  19. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/adapters/stream_json.py +269 -0
  20. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/api_common.py +654 -0
  21. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/api_definitions.py +445 -0
  22. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/api_environments.py +568 -0
  23. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/api_other.py +345 -0
  24. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/api_responses.py +1051 -0
  25. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/api_sessions.py +732 -0
  26. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/api_vaults.py +539 -0
  27. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/artifacts.py +201 -0
  28. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/config.py +558 -0
  29. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/errors.py +100 -0
  30. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/events.py +155 -0
  31. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/local_state.py +173 -0
  32. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/procenv.py +221 -0
  33. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/redact.py +94 -0
  34. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/runtime.py +1481 -0
  35. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/store.py +126 -0
  36. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/subagents.py +237 -0
  37. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/webhooks.py +206 -0
  38. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/wire_sessions.py +340 -0
  39. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/agents/workspace_files.py +244 -0
  40. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/app.py +727 -0
  41. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/contract.py +41 -0
  42. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/endpoints.py +892 -0
  43. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/guard.py +230 -0
  44. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/guards/__init__.py +56 -0
  45. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/guards/commands.py +299 -0
  46. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/guards/env.py +64 -0
  47. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/guards/paths.py +99 -0
  48. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/guards/process.py +60 -0
  49. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/guards/urls.py +57 -0
  50. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/policy.py +817 -0
  51. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/py.typed +0 -0
  52. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/registry.py +360 -0
  53. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/router.py +302 -0
  54. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/routes.py +327 -0
  55. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/routes_agents.py +627 -0
  56. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/routes_browser.py +546 -0
  57. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/routes_devtools.py +433 -0
  58. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/routes_files.py +751 -0
  59. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/routes_process.py +483 -0
  60. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/routes_pty.py +772 -0
  61. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/routes_system.py +523 -0
  62. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/runtime.py +793 -0
  63. agent_sandbox_server-0.3.1a1/src/agent_sandbox/server/types.py +107 -0
  64. agent_sandbox_server-0.3.1a1/tests/__init__.py +0 -0
  65. agent_sandbox_server-0.3.1a1/tests/conftest.py +1 -0
  66. agent_sandbox_server-0.3.1a1/tests/test_packaging.py +122 -0
  67. agent_sandbox_server-0.3.1a1/tests/test_server/__init__.py +1 -0
  68. agent_sandbox_server-0.3.1a1/tests/test_server/_live.py +136 -0
  69. agent_sandbox_server-0.3.1a1/tests/test_server/conftest.py +61 -0
  70. agent_sandbox_server-0.3.1a1/tests/test_server/test_app.py +691 -0
  71. agent_sandbox_server-0.3.1a1/tests/test_server/test_app_agents_transport.py +224 -0
  72. agent_sandbox_server-0.3.1a1/tests/test_server/test_cli_main.py +208 -0
  73. agent_sandbox_server-0.3.1a1/tests/test_server/test_coerce.py +140 -0
  74. agent_sandbox_server-0.3.1a1/tests/test_server/test_env_subprocess_boundary.py +309 -0
  75. agent_sandbox_server-0.3.1a1/tests/test_server/test_guards_env_url.py +87 -0
  76. agent_sandbox_server-0.3.1a1/tests/test_server/test_guards_live_routes.py +174 -0
  77. agent_sandbox_server-0.3.1a1/tests/test_server/test_guards_v2.py +327 -0
  78. agent_sandbox_server-0.3.1a1/tests/test_server/test_http_hardening.py +182 -0
  79. agent_sandbox_server-0.3.1a1/tests/test_server/test_new_endpoints.py +210 -0
  80. agent_sandbox_server-0.3.1a1/tests/test_server/test_path_guard.py +240 -0
  81. agent_sandbox_server-0.3.1a1/tests/test_server/test_policy_compat.py +56 -0
  82. agent_sandbox_server-0.3.1a1/tests/test_server/test_policy_config.py +507 -0
  83. agent_sandbox_server-0.3.1a1/tests/test_server/test_policy_exec.py +192 -0
  84. agent_sandbox_server-0.3.1a1/tests/test_server/test_policy_paths.py +417 -0
  85. agent_sandbox_server-0.3.1a1/tests/test_server/test_policy_pipeline.py +529 -0
  86. agent_sandbox_server-0.3.1a1/tests/test_server/test_policy_pty.py +119 -0
  87. agent_sandbox_server-0.3.1a1/tests/test_server/test_registry.py +360 -0
  88. agent_sandbox_server-0.3.1a1/tests/test_server/test_router.py +225 -0
  89. agent_sandbox_server-0.3.1a1/tests/test_server/test_routes_agents.py +489 -0
  90. agent_sandbox_server-0.3.1a1/tests/test_server/test_routes_agents_local.py +3087 -0
  91. agent_sandbox_server-0.3.1a1/tests/test_server/test_routes_browser.py +537 -0
  92. agent_sandbox_server-0.3.1a1/tests/test_server/test_routes_devtools.py +428 -0
  93. agent_sandbox_server-0.3.1a1/tests/test_server/test_routes_files.py +670 -0
  94. agent_sandbox_server-0.3.1a1/tests/test_server/test_routes_process.py +538 -0
  95. agent_sandbox_server-0.3.1a1/tests/test_server/test_routes_pty.py +502 -0
  96. agent_sandbox_server-0.3.1a1/tests/test_server/test_routes_system.py +381 -0
  97. agent_sandbox_server-0.3.1a1/tests/test_server/test_single_layer.py +85 -0
  98. agent_sandbox_server-0.3.1a1/tests/test_server/test_string_array.py +74 -0
  99. agent_sandbox_server-0.3.1a1/tests/test_server_only_import.py +40 -0
@@ -0,0 +1,74 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ *.egg
9
+ .eggs/
10
+
11
+ # Virtual environments
12
+ .venv/
13
+ venv/
14
+ env/
15
+
16
+ # IDE
17
+ .idea/
18
+ .vscode/
19
+ *.swp
20
+ *.swo
21
+
22
+ # Testing
23
+ .pytest_cache/
24
+ .coverage
25
+ coverage.json
26
+ htmlcov/
27
+ .tox/
28
+
29
+ # Linting / Type-checking caches
30
+ .mypy_cache/
31
+ .ruff_cache/
32
+
33
+ # Environment
34
+ .env
35
+ .env.*
36
+ !.env.example
37
+
38
+ # Secrets
39
+ *.pem
40
+ *.key
41
+ secrets.json
42
+ # NOTE: .secrets.baseline is intentionally tracked — it is referenced by the
43
+ # detect-secrets hook in .pre-commit-config.yaml and must ship with the repo.
44
+ # Do not add it back to .gitignore.
45
+
46
+ # OS
47
+ .DS_Store
48
+ Thumbs.db
49
+
50
+ # Build
51
+ *.so
52
+ *.dylib
53
+ *.whl
54
+
55
+ # Temporary diff/patch files
56
+ *.diff
57
+ current_diff.patch
58
+ diff-code.txt
59
+
60
+ # Local scratch/verification workspaces
61
+ .scratch-*/
62
+
63
+ # Sandbox config (may contain API keys)
64
+ ~/.sbox/
65
+
66
+ # Benchmarks output
67
+ client-sdk/benchmarks/*.log
68
+
69
+ # NOTE: .agents/ (notes, evidence, research) is fully tracked; do not ignore any part of it.
70
+
71
+ # awesome-templates sub-repo (has its own git)
72
+ awesome-templates/
73
+
74
+ scripts/local-paths.private
@@ -0,0 +1,200 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. Please also get an overview of
186
+ how to use the license at http://www.apache.org/foundation/license-faq.html.
187
+
188
+ Copyright 2026 Anycodes
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
@@ -0,0 +1,18 @@
1
+ Agent Sandbox
2
+ Copyright 2026 Anycodes
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ Includes MIT-licensed E2B 2.31.0 and Code Interpreter 2.8.1 protocol/client sources,
17
+ ported into the Agent Sandbox namespace. Copyright FoundryLabs, Inc. and E2B authors.
18
+ See agent_sandbox/_standard/LICENSE, code_interpreter/LICENSE and _standard/SOURCES.json.
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.5
2
+ Name: agent-sandbox-server
3
+ Version: 0.3.1a1
4
+ Summary: Agent Sandbox Server SDK — container-side runtime service for Agent Sandbox templates
5
+ Project-URL: Homepage, https://github.com/alibaba-agent-sandbox/python-sdk
6
+ Project-URL: Documentation, https://github.com/alibaba-agent-sandbox/python-sdk/tree/main/docs
7
+ Project-URL: Repository, https://github.com/alibaba-agent-sandbox/python-sdk
8
+ Project-URL: Issues, https://github.com/alibaba-agent-sandbox/python-sdk/issues
9
+ Project-URL: Changelog, https://github.com/alibaba-agent-sandbox/python-sdk/blob/main/CHANGELOG.md
10
+ Author: Anycodes
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ License-File: NOTICE
14
+ Keywords: agent,ai,cloud,e2b,easy,sandbox,server
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: websockets>=12.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: mypy>=1.0; extra == 'dev'
28
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
29
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
30
+ Requires-Dist: pytest>=7.0; extra == 'dev'
31
+ Requires-Dist: ruff>=0.4; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # agent-sandbox-server
35
+
36
+ This package is the opt-in **0.3.1a1 alpha** candidate. Use its exact PyPI version after verified publication; before that, use the [tested paired source recipe](https://github.com/Alibaba-Agent-Sandbox/python-sdk/blob/main/docs/en/guide/install-python.md). Alpha publication does not establish every provider or template as production-ready.
37
+
38
+ **Server SDK.** This package runs *inside* a sandbox image. It is the HTTP service the image starts (default port 9000). It does not create the sandbox. Creating and calling the sandbox is the [client SDK](https://github.com/alibaba-agent-sandbox/python-sdk/blob/main/client-sdk/README.md) or the `abx` CLI. Guide: [Server SDK](https://github.com/alibaba-agent-sandbox/python-sdk/blob/main/docs/en/guide/server-sdk.md).
39
+
40
+ It exposes files, processes, system info, a PTY terminal, optional dev tools / browser automation, and your own registered commands.
41
+
42
+ The HTTP server is stdlib-only. `websockets` is installed for the PTY terminal endpoint.
43
+ Import path: `agent_sandbox.server` (a namespace shared with `agent-sandbox-client`).
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ python -m pip install 'agent-sandbox-server==0.3.1a1'
49
+ python -m pip check
50
+ ```
51
+
52
+ The opt-in browser capability group imports Playwright lazily; install `playwright` in the
53
+ image yourself if you enable it (without it the browser endpoints answer `503`).
54
+
55
+ ## Use inside a template's `commands.py`
56
+
57
+ ```python
58
+ from agent_sandbox.server import command, start
59
+
60
+
61
+ @command(description="Say hello")
62
+ def hello(name: str = "world") -> dict:
63
+ return {"message": f"Hello, {name}!"}
64
+
65
+
66
+ start(9000)
67
+ ```
68
+
69
+ Every endpoint is one row of `agent_sandbox.server.endpoints.ENDPOINTS`. A capability group
70
+ (`commands`, `file_ops`, `process`, `terminal`, `system`, `dev_tools`, `browser`, `agents`) is a
71
+ name for the endpoints that declare it. `core` is always on, the groups through `terminal` and
72
+ `system` start on, and `dev_tools`, `browser` and `agents` start off. Turn one on with
73
+ `default_table().enable_group(CapabilityGroup.DEV_TOOLS)` in `commands.py`, with a policy
74
+ `groups: [dev_tools]`, or with `ABX_SERVER_ENABLED_GROUPS=dev_tools` in the environment. See the
75
+ [server API design](https://github.com/alibaba-agent-sandbox/python-sdk/blob/main/docs/en/design/server-api.md).
76
+
77
+ Command registration supports `list[str]` with strict native JSON arrays. See the [bilingual server API guide](https://github.com/Alibaba-Agent-Sandbox/python-sdk/blob/main/docs/en/guide/template-server-api.md#string-array-command-arguments).
78
+
79
+ ## Develop
80
+
81
+ ```bash
82
+ pip install -e "./server-sdk[dev]"
83
+ cd server-sdk && pytest && ruff check src tests && mypy src/agent_sandbox/server
84
+ ```
85
+
86
+ Licensed under Apache-2.0.
@@ -0,0 +1,53 @@
1
+ # agent-sandbox-server
2
+
3
+ This package is the opt-in **0.3.1a1 alpha** candidate. Use its exact PyPI version after verified publication; before that, use the [tested paired source recipe](https://github.com/Alibaba-Agent-Sandbox/python-sdk/blob/main/docs/en/guide/install-python.md). Alpha publication does not establish every provider or template as production-ready.
4
+
5
+ **Server SDK.** This package runs *inside* a sandbox image. It is the HTTP service the image starts (default port 9000). It does not create the sandbox. Creating and calling the sandbox is the [client SDK](https://github.com/alibaba-agent-sandbox/python-sdk/blob/main/client-sdk/README.md) or the `abx` CLI. Guide: [Server SDK](https://github.com/alibaba-agent-sandbox/python-sdk/blob/main/docs/en/guide/server-sdk.md).
6
+
7
+ It exposes files, processes, system info, a PTY terminal, optional dev tools / browser automation, and your own registered commands.
8
+
9
+ The HTTP server is stdlib-only. `websockets` is installed for the PTY terminal endpoint.
10
+ Import path: `agent_sandbox.server` (a namespace shared with `agent-sandbox-client`).
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ python -m pip install 'agent-sandbox-server==0.3.1a1'
16
+ python -m pip check
17
+ ```
18
+
19
+ The opt-in browser capability group imports Playwright lazily; install `playwright` in the
20
+ image yourself if you enable it (without it the browser endpoints answer `503`).
21
+
22
+ ## Use inside a template's `commands.py`
23
+
24
+ ```python
25
+ from agent_sandbox.server import command, start
26
+
27
+
28
+ @command(description="Say hello")
29
+ def hello(name: str = "world") -> dict:
30
+ return {"message": f"Hello, {name}!"}
31
+
32
+
33
+ start(9000)
34
+ ```
35
+
36
+ Every endpoint is one row of `agent_sandbox.server.endpoints.ENDPOINTS`. A capability group
37
+ (`commands`, `file_ops`, `process`, `terminal`, `system`, `dev_tools`, `browser`, `agents`) is a
38
+ name for the endpoints that declare it. `core` is always on, the groups through `terminal` and
39
+ `system` start on, and `dev_tools`, `browser` and `agents` start off. Turn one on with
40
+ `default_table().enable_group(CapabilityGroup.DEV_TOOLS)` in `commands.py`, with a policy
41
+ `groups: [dev_tools]`, or with `ABX_SERVER_ENABLED_GROUPS=dev_tools` in the environment. See the
42
+ [server API design](https://github.com/alibaba-agent-sandbox/python-sdk/blob/main/docs/en/design/server-api.md).
43
+
44
+ Command registration supports `list[str]` with strict native JSON arrays. See the [bilingual server API guide](https://github.com/Alibaba-Agent-Sandbox/python-sdk/blob/main/docs/en/guide/template-server-api.md#string-array-command-arguments).
45
+
46
+ ## Develop
47
+
48
+ ```bash
49
+ pip install -e "./server-sdk[dev]"
50
+ cd server-sdk && pytest && ruff check src tests && mypy src/agent_sandbox/server
51
+ ```
52
+
53
+ Licensed under Apache-2.0.
@@ -0,0 +1,95 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "agent-sandbox-server"
7
+ dynamic = ["version"]
8
+ description = "Agent Sandbox Server SDK — container-side runtime service for Agent Sandbox templates"
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "Anycodes" },
14
+ ]
15
+ keywords = ["sandbox", "easy", "ai", "agent", "cloud", "e2b", "server"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: Apache Software License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Software Development :: Libraries :: Python Modules",
26
+ ]
27
+
28
+ # The HTTP server itself is stdlib-only. ``websockets`` is needed only by the
29
+ # PTY terminal endpoint, which is enabled by default.
30
+ dependencies = [
31
+ "websockets>=12.0",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ dev = [
36
+ "pytest>=7.0",
37
+ "pytest-asyncio>=0.21",
38
+ "pytest-cov>=4.0",
39
+ "ruff>=0.4",
40
+ "mypy>=1.0",
41
+ ]
42
+
43
+ [project.scripts]
44
+ agent-sandbox-server = "agent_sandbox.server.__main__:main"
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/alibaba-agent-sandbox/python-sdk"
48
+ Documentation = "https://github.com/alibaba-agent-sandbox/python-sdk/tree/main/docs"
49
+ Repository = "https://github.com/alibaba-agent-sandbox/python-sdk"
50
+ Issues = "https://github.com/alibaba-agent-sandbox/python-sdk/issues"
51
+ Changelog = "https://github.com/alibaba-agent-sandbox/python-sdk/blob/main/CHANGELOG.md"
52
+
53
+ [tool.hatch.version]
54
+ path = "src/agent_sandbox/server/_version.py"
55
+
56
+ # ``agent_sandbox`` is a shared namespace with the ``agent-sandbox`` (client) distribution: this
57
+ # distribution only ships ``agent_sandbox/server`` and deliberately has no
58
+ # ``agent_sandbox/__init__.py`` of its own.
59
+ [tool.hatch.build.targets.wheel]
60
+ packages = ["src/agent_sandbox"]
61
+ artifacts = ["py.typed"]
62
+
63
+ [tool.hatch.build.targets.sdist]
64
+ include = [
65
+ "src/agent_sandbox/",
66
+ "tests/",
67
+ "README.md",
68
+ "LICENSE",
69
+ "NOTICE",
70
+ "pyproject.toml",
71
+ ]
72
+
73
+ [tool.pytest.ini_options]
74
+ testpaths = ["tests"]
75
+ asyncio_mode = "auto"
76
+ markers = [
77
+ "integration: marks tests requiring real API keys (deselect with '-m \"not integration\"')",
78
+ ]
79
+
80
+ [tool.ruff]
81
+ target-version = "py310"
82
+ line-length = 100
83
+ src = ["src", "tests"]
84
+
85
+ [tool.ruff.lint]
86
+ select = ["E", "F", "I", "N", "W", "UP", "B", "SIM", "TCH"]
87
+
88
+ [tool.mypy]
89
+ python_version = "3.10"
90
+ strict = true
91
+ warn_return_any = true
92
+ warn_unused_configs = true
93
+ namespace_packages = true
94
+ explicit_package_bases = true
95
+ mypy_path = "src"
@@ -0,0 +1,64 @@
1
+ """Container-side HTTP server — stdlib-only, zero external dependencies.
2
+
3
+ Quick start (inside a sandbox template's ``commands.py``)::
4
+
5
+ from agent_sandbox.server import start
6
+ start(9000)
7
+
8
+ Or for more control::
9
+
10
+ from agent_sandbox.server import SandboxServer, ServerPolicy, command
11
+
12
+ @command("greet")
13
+ def greet(name: str) -> str:
14
+ return f"Hello, {name}!"
15
+
16
+ server = SandboxServer(host="0.0.0.0", policy=ServerPolicy.only("transfer"))
17
+ server.serve(port=9000)
18
+ """
19
+
20
+ from __future__ import annotations
21
+
22
+ from ._version import __version__
23
+ from .app import SandboxServer, start
24
+ from .endpoints import CapabilityGroup
25
+ from .policy import PolicyDenied, ServerPolicy
26
+ from .registry import (
27
+ CommandArg,
28
+ CommandRegistry,
29
+ RegisteredCommand,
30
+ command,
31
+ default_registry,
32
+ )
33
+ from .router import RouteInfo, RouteTable, default_table
34
+ from .routes_pty import (
35
+ PtySession,
36
+ PtySessionManager,
37
+ pty_session_manager,
38
+ start_pty_server,
39
+ )
40
+ from .types import ServerRequest, ServerResponse, SSEResponse
41
+
42
+ __all__ = [
43
+ "__version__",
44
+ "SandboxServer",
45
+ "start",
46
+ "ServerPolicy",
47
+ "PolicyDenied",
48
+ "CommandArg",
49
+ "CommandRegistry",
50
+ "RegisteredCommand",
51
+ "command",
52
+ "default_registry",
53
+ "ServerRequest",
54
+ "ServerResponse",
55
+ "SSEResponse",
56
+ "RouteTable",
57
+ "RouteInfo",
58
+ "CapabilityGroup",
59
+ "default_table",
60
+ "PtySession",
61
+ "PtySessionManager",
62
+ "pty_session_manager",
63
+ "start_pty_server",
64
+ ]