mem-sandbox 0.1.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 (216) hide show
  1. mem_sandbox-0.1.0/.gitignore +219 -0
  2. mem_sandbox-0.1.0/CODE_OF_CONDUCT.md +31 -0
  3. mem_sandbox-0.1.0/CONTRIBUTING.md +89 -0
  4. mem_sandbox-0.1.0/LICENSE +21 -0
  5. mem_sandbox-0.1.0/PKG-INFO +228 -0
  6. mem_sandbox-0.1.0/README.md +204 -0
  7. mem_sandbox-0.1.0/SECURITY.md +30 -0
  8. mem_sandbox-0.1.0/docs/AGENT_SANDBOX_INTEGRATION_RESEARCH.md +1069 -0
  9. mem_sandbox-0.1.0/docs/HIGH_LEVEL_DESIGN.md +568 -0
  10. mem_sandbox-0.1.0/docs/OPENAI_SANDBOX_AGENT_ADAPTER.md +687 -0
  11. mem_sandbox-0.1.0/docs/PLAN.md +1841 -0
  12. mem_sandbox-0.1.0/docs/Python/POSIX_PARSER_EVALUATION.md +209 -0
  13. mem_sandbox-0.1.0/docs/README.md +74 -0
  14. mem_sandbox-0.1.0/docs/components/README.md +30 -0
  15. mem_sandbox-0.1.0/docs/components/command-executor/PIPELINE_EVALUATION.md +238 -0
  16. mem_sandbox-0.1.0/docs/components/command-executor/README.md +805 -0
  17. mem_sandbox-0.1.0/docs/components/event-sink/README.md +423 -0
  18. mem_sandbox-0.1.0/docs/components/external-execution/README.md +654 -0
  19. mem_sandbox-0.1.0/docs/components/network-egress/README.md +556 -0
  20. mem_sandbox-0.1.0/docs/components/policy-engine/README.md +231 -0
  21. mem_sandbox-0.1.0/docs/components/sandbox-service/README.md +547 -0
  22. mem_sandbox-0.1.0/docs/components/sandbox-session/README.md +844 -0
  23. mem_sandbox-0.1.0/docs/components/secret-broker/README.md +464 -0
  24. mem_sandbox-0.1.0/docs/components/snapshot-store/README.md +391 -0
  25. mem_sandbox-0.1.0/docs/components/workspace/README.md +631 -0
  26. mem_sandbox-0.1.0/docs/components/workspace/content-offload/README.md +620 -0
  27. mem_sandbox-0.1.0/docs/components/workspace/scalability-decision.md +244 -0
  28. mem_sandbox-0.1.0/docs/integrations/README.md +73 -0
  29. mem_sandbox-0.1.0/docs/integrations/tool-capability/README.md +339 -0
  30. mem_sandbox-0.1.0/docs/integrations/workspace-backend/README.md +273 -0
  31. mem_sandbox-0.1.0/docs/product-validation/README.md +590 -0
  32. mem_sandbox-0.1.0/docs/product-validation/workspace-scalability.md +168 -0
  33. mem_sandbox-0.1.0/pyproject.toml +112 -0
  34. mem_sandbox-0.1.0/samples/README.md +17 -0
  35. mem_sandbox-0.1.0/samples/__init__.py +1 -0
  36. mem_sandbox-0.1.0/samples/openai_agents_sdk/README.md +81 -0
  37. mem_sandbox-0.1.0/samples/openai_agents_sdk/__init__.py +37 -0
  38. mem_sandbox-0.1.0/samples/openai_agents_sdk/application.py +151 -0
  39. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/__init__.py +1 -0
  40. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/azure_openai/README.md +188 -0
  41. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/azure_openai/__init__.py +9 -0
  42. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/azure_openai/__main__.py +40 -0
  43. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/azure_openai/config.py +92 -0
  44. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/azure_openai/model.py +23 -0
  45. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/openai/README.md +84 -0
  46. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/openai/__init__.py +9 -0
  47. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/openai/__main__.py +42 -0
  48. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/openai/config.py +40 -0
  49. mem_sandbox-0.1.0/samples/openai_agents_sdk/providers/openai/model.py +23 -0
  50. mem_sandbox-0.1.0/samples/openai_agents_sdk/runner.py +364 -0
  51. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/README.md +37 -0
  52. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/__init__.py +25 -0
  53. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/config_migration.py +57 -0
  54. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/data_pipeline.py +43 -0
  55. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/incident_triage.py +61 -0
  56. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/multi_agent_handoff.py +60 -0
  57. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/policy_recovery.py +75 -0
  58. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/quota_recovery.py +56 -0
  59. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/registry.py +51 -0
  60. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/snapshot_branching.py +79 -0
  61. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/types.py +82 -0
  62. mem_sandbox-0.1.0/samples/openai_agents_sdk/scenarios/workspace_edit.py +41 -0
  63. mem_sandbox-0.1.0/samples/shared/README.md +38 -0
  64. mem_sandbox-0.1.0/samples/shared/__init__.py +15 -0
  65. mem_sandbox-0.1.0/samples/shared/__main__.py +51 -0
  66. mem_sandbox-0.1.0/samples/shared/cli.py +68 -0
  67. mem_sandbox-0.1.0/samples/shared/service.py +77 -0
  68. mem_sandbox-0.1.0/src/mem_sandbox/README.md +9 -0
  69. mem_sandbox-0.1.0/src/mem_sandbox/__init__.py +3 -0
  70. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/README.md +29 -0
  71. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/__init__.py +158 -0
  72. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/commands.py +1159 -0
  73. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/errors.py +51 -0
  74. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/executor.py +659 -0
  75. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/models.py +601 -0
  76. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/output.py +79 -0
  77. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/parser.py +356 -0
  78. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/ports.py +46 -0
  79. mem_sandbox-0.1.0/src/mem_sandbox/command_executor/registry.py +53 -0
  80. mem_sandbox-0.1.0/src/mem_sandbox/core/README.md +25 -0
  81. mem_sandbox-0.1.0/src/mem_sandbox/core/__init__.py +52 -0
  82. mem_sandbox-0.1.0/src/mem_sandbox/core/clock.py +22 -0
  83. mem_sandbox-0.1.0/src/mem_sandbox/core/errors.py +99 -0
  84. mem_sandbox-0.1.0/src/mem_sandbox/core/identifiers.py +100 -0
  85. mem_sandbox-0.1.0/src/mem_sandbox/core/models.py +44 -0
  86. mem_sandbox-0.1.0/src/mem_sandbox/core/operations.py +50 -0
  87. mem_sandbox-0.1.0/src/mem_sandbox/events/__init__.py +65 -0
  88. mem_sandbox-0.1.0/src/mem_sandbox/events/delivery.py +275 -0
  89. mem_sandbox-0.1.0/src/mem_sandbox/events/errors.py +28 -0
  90. mem_sandbox-0.1.0/src/mem_sandbox/events/models.py +317 -0
  91. mem_sandbox-0.1.0/src/mem_sandbox/events/redaction.py +214 -0
  92. mem_sandbox-0.1.0/src/mem_sandbox/events/sink.py +104 -0
  93. mem_sandbox-0.1.0/src/mem_sandbox/integrations/README.md +20 -0
  94. mem_sandbox-0.1.0/src/mem_sandbox/integrations/__init__.py +1 -0
  95. mem_sandbox-0.1.0/src/mem_sandbox/integrations/openai_agents/README.md +604 -0
  96. mem_sandbox-0.1.0/src/mem_sandbox/integrations/openai_agents/__init__.py +23 -0
  97. mem_sandbox-0.1.0/src/mem_sandbox/integrations/openai_agents/adapter.py +1260 -0
  98. mem_sandbox-0.1.0/src/mem_sandbox/integrations/openai_agents/capability.py +461 -0
  99. mem_sandbox-0.1.0/src/mem_sandbox/integrations/openai_agents/snapshot.py +297 -0
  100. mem_sandbox-0.1.0/src/mem_sandbox/policy/__init__.py +15 -0
  101. mem_sandbox-0.1.0/src/mem_sandbox/policy/engine.py +16 -0
  102. mem_sandbox-0.1.0/src/mem_sandbox/policy/models.py +72 -0
  103. mem_sandbox-0.1.0/src/mem_sandbox/py.typed +0 -0
  104. mem_sandbox-0.1.0/src/mem_sandbox/secrets/__init__.py +64 -0
  105. mem_sandbox-0.1.0/src/mem_sandbox/secrets/broker.py +237 -0
  106. mem_sandbox-0.1.0/src/mem_sandbox/secrets/errors.py +76 -0
  107. mem_sandbox-0.1.0/src/mem_sandbox/secrets/models.py +104 -0
  108. mem_sandbox-0.1.0/src/mem_sandbox/secrets/source.py +36 -0
  109. mem_sandbox-0.1.0/src/mem_sandbox/service/__init__.py +69 -0
  110. mem_sandbox-0.1.0/src/mem_sandbox/service/errors.py +44 -0
  111. mem_sandbox-0.1.0/src/mem_sandbox/service/factory.py +134 -0
  112. mem_sandbox-0.1.0/src/mem_sandbox/service/models.py +152 -0
  113. mem_sandbox-0.1.0/src/mem_sandbox/service/ports.py +58 -0
  114. mem_sandbox-0.1.0/src/mem_sandbox/service/resources.py +123 -0
  115. mem_sandbox-0.1.0/src/mem_sandbox/service/service.py +370 -0
  116. mem_sandbox-0.1.0/src/mem_sandbox/service/snapshots.py +36 -0
  117. mem_sandbox-0.1.0/src/mem_sandbox/session/README.md +15 -0
  118. mem_sandbox-0.1.0/src/mem_sandbox/session/__init__.py +117 -0
  119. mem_sandbox-0.1.0/src/mem_sandbox/session/errors.py +97 -0
  120. mem_sandbox-0.1.0/src/mem_sandbox/session/models.py +353 -0
  121. mem_sandbox-0.1.0/src/mem_sandbox/session/ports.py +107 -0
  122. mem_sandbox-0.1.0/src/mem_sandbox/session/resources.py +10 -0
  123. mem_sandbox-0.1.0/src/mem_sandbox/session/session.py +1756 -0
  124. mem_sandbox-0.1.0/src/mem_sandbox/snapshots/README.md +12 -0
  125. mem_sandbox-0.1.0/src/mem_sandbox/snapshots/__init__.py +59 -0
  126. mem_sandbox-0.1.0/src/mem_sandbox/snapshots/codec.py +268 -0
  127. mem_sandbox-0.1.0/src/mem_sandbox/snapshots/errors.py +53 -0
  128. mem_sandbox-0.1.0/src/mem_sandbox/snapshots/models.py +218 -0
  129. mem_sandbox-0.1.0/src/mem_sandbox/snapshots/store.py +155 -0
  130. mem_sandbox-0.1.0/src/mem_sandbox/workspace/README.md +35 -0
  131. mem_sandbox-0.1.0/src/mem_sandbox/workspace/__init__.py +135 -0
  132. mem_sandbox-0.1.0/src/mem_sandbox/workspace/archive_codec.py +795 -0
  133. mem_sandbox-0.1.0/src/mem_sandbox/workspace/errors.py +163 -0
  134. mem_sandbox-0.1.0/src/mem_sandbox/workspace/hashing.py +21 -0
  135. mem_sandbox-0.1.0/src/mem_sandbox/workspace/memory.py +1026 -0
  136. mem_sandbox-0.1.0/src/mem_sandbox/workspace/models.py +494 -0
  137. mem_sandbox-0.1.0/src/mem_sandbox/workspace/patching.py +215 -0
  138. mem_sandbox-0.1.0/src/mem_sandbox/workspace/paths.py +174 -0
  139. mem_sandbox-0.1.0/src/mem_sandbox/workspace/ports.py +24 -0
  140. mem_sandbox-0.1.0/src/mem_sandbox/workspace/snapshot_codec.py +316 -0
  141. mem_sandbox-0.1.0/src/mem_sandbox/workspace/snapshot_tree.py +78 -0
  142. mem_sandbox-0.1.0/src/mem_sandbox/workspace/text.py +19 -0
  143. mem_sandbox-0.1.0/tests/__init__.py +1 -0
  144. mem_sandbox-0.1.0/tests/benchmarks/test_benchmark_smoke.py +235 -0
  145. mem_sandbox-0.1.0/tests/benchmarks/test_workspace_scalability.py +207 -0
  146. mem_sandbox-0.1.0/tests/conformance/README.md +168 -0
  147. mem_sandbox-0.1.0/tests/conformance/product/__init__.py +1 -0
  148. mem_sandbox-0.1.0/tests/conformance/product/test_equivalence.py +73 -0
  149. mem_sandbox-0.1.0/tests/conformance/test_direct_session.py +395 -0
  150. mem_sandbox-0.1.0/tests/conftest.py +30 -0
  151. mem_sandbox-0.1.0/tests/evaluation/test_command_usability.py +63 -0
  152. mem_sandbox-0.1.0/tests/integration/README.md +4 -0
  153. mem_sandbox-0.1.0/tests/integration/command_executor/test_first_command_wave.py +99 -0
  154. mem_sandbox-0.1.0/tests/integration/service/test_default_factory.py +99 -0
  155. mem_sandbox-0.1.0/tests/integration/service/test_service_lifecycle.py +99 -0
  156. mem_sandbox-0.1.0/tests/integration/session/test_minimal_vertical_slice.py +160 -0
  157. mem_sandbox-0.1.0/tests/integration/session/test_secret_canary.py +178 -0
  158. mem_sandbox-0.1.0/tests/integration/session/test_snapshot_restore_atomicity.py +219 -0
  159. mem_sandbox-0.1.0/tests/integration/workspace/test_workspace_round_trip.py +83 -0
  160. mem_sandbox-0.1.0/tests/integrations/openai_agents/__init__.py +1 -0
  161. mem_sandbox-0.1.0/tests/integrations/openai_agents/support.py +100 -0
  162. mem_sandbox-0.1.0/tests/integrations/openai_agents/test_capability.py +726 -0
  163. mem_sandbox-0.1.0/tests/integrations/openai_agents/test_manifest_profile.py +517 -0
  164. mem_sandbox-0.1.0/tests/integrations/openai_agents/test_package_boundary.py +243 -0
  165. mem_sandbox-0.1.0/tests/integrations/openai_agents/test_sdk_contract.py +579 -0
  166. mem_sandbox-0.1.0/tests/integrations/openai_agents/test_session_adapter.py +1958 -0
  167. mem_sandbox-0.1.0/tests/property/README.md +250 -0
  168. mem_sandbox-0.1.0/tests/property/__init__.py +1 -0
  169. mem_sandbox-0.1.0/tests/property/async_machine.py +49 -0
  170. mem_sandbox-0.1.0/tests/property/command_executor/test_parser_stateful.py +69 -0
  171. mem_sandbox-0.1.0/tests/property/command_executor/test_pipeline_stateful.py +304 -0
  172. mem_sandbox-0.1.0/tests/property/snapshots/test_session_codec_properties.py +287 -0
  173. mem_sandbox-0.1.0/tests/property/snapshots/test_store_stateful.py +231 -0
  174. mem_sandbox-0.1.0/tests/property/strategies.py +312 -0
  175. mem_sandbox-0.1.0/tests/property/workspace/test_mutations_stateful.py +588 -0
  176. mem_sandbox-0.1.0/tests/property/workspace/test_paths_stateful.py +147 -0
  177. mem_sandbox-0.1.0/tests/property/workspace/test_portable_archive_properties.py +77 -0
  178. mem_sandbox-0.1.0/tests/property/workspace/test_snapshots_stateful.py +69 -0
  179. mem_sandbox-0.1.0/tests/samples/test_openai_agents_sdk_azure_openai.py +915 -0
  180. mem_sandbox-0.1.0/tests/samples/test_openai_agents_sdk_openai.py +94 -0
  181. mem_sandbox-0.1.0/tests/samples/test_sample_package_boundaries.py +30 -0
  182. mem_sandbox-0.1.0/tests/samples/test_shared_sample.py +24 -0
  183. mem_sandbox-0.1.0/tests/unit/command_executor/test_commands.py +236 -0
  184. mem_sandbox-0.1.0/tests/unit/command_executor/test_executor.py +1170 -0
  185. mem_sandbox-0.1.0/tests/unit/command_executor/test_parser_registry.py +130 -0
  186. mem_sandbox-0.1.0/tests/unit/command_executor/test_secret_models.py +134 -0
  187. mem_sandbox-0.1.0/tests/unit/events/test_event_system.py +626 -0
  188. mem_sandbox-0.1.0/tests/unit/foundation/test_clock.py +32 -0
  189. mem_sandbox-0.1.0/tests/unit/foundation/test_dependency_boundary.py +118 -0
  190. mem_sandbox-0.1.0/tests/unit/foundation/test_errors.py +49 -0
  191. mem_sandbox-0.1.0/tests/unit/foundation/test_identifiers.py +84 -0
  192. mem_sandbox-0.1.0/tests/unit/foundation/test_models.py +69 -0
  193. mem_sandbox-0.1.0/tests/unit/foundation/test_operations.py +57 -0
  194. mem_sandbox-0.1.0/tests/unit/secrets/test_broker.py +336 -0
  195. mem_sandbox-0.1.0/tests/unit/secrets/test_models_and_source.py +100 -0
  196. mem_sandbox-0.1.0/tests/unit/service/conftest.py +41 -0
  197. mem_sandbox-0.1.0/tests/unit/service/test_resources.py +115 -0
  198. mem_sandbox-0.1.0/tests/unit/service/test_service.py +412 -0
  199. mem_sandbox-0.1.0/tests/unit/service/test_service_models.py +72 -0
  200. mem_sandbox-0.1.0/tests/unit/session/test_minimal_collaborators.py +107 -0
  201. mem_sandbox-0.1.0/tests/unit/session/test_native_path_operations.py +906 -0
  202. mem_sandbox-0.1.0/tests/unit/session/test_secret_execution.py +45 -0
  203. mem_sandbox-0.1.0/tests/unit/session/test_session_operations.py +1760 -0
  204. mem_sandbox-0.1.0/tests/unit/session/test_snapshots.py +219 -0
  205. mem_sandbox-0.1.0/tests/unit/snapshots/test_store_lifecycle.py +269 -0
  206. mem_sandbox-0.1.0/tests/unit/workspace/test_boundaries_and_concurrency.py +146 -0
  207. mem_sandbox-0.1.0/tests/unit/workspace/test_copy_move.py +127 -0
  208. mem_sandbox-0.1.0/tests/unit/workspace/test_mutations.py +347 -0
  209. mem_sandbox-0.1.0/tests/unit/workspace/test_patching.py +233 -0
  210. mem_sandbox-0.1.0/tests/unit/workspace/test_paths.py +88 -0
  211. mem_sandbox-0.1.0/tests/unit/workspace/test_portable_archive_codec.py +949 -0
  212. mem_sandbox-0.1.0/tests/unit/workspace/test_portable_archive_restore.py +545 -0
  213. mem_sandbox-0.1.0/tests/unit/workspace/test_prepared_restore.py +70 -0
  214. mem_sandbox-0.1.0/tests/unit/workspace/test_reads.py +197 -0
  215. mem_sandbox-0.1.0/tests/unit/workspace/test_snapshot_codec.py +253 -0
  216. mem_sandbox-0.1.0/tests/unit/workspace/test_workspace_models.py +116 -0
@@ -0,0 +1,219 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+ benchmark-results/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi
127
+
128
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
129
+ __pypackages__/
130
+
131
+ # Celery stuff
132
+ celerybeat-schedule
133
+ celerybeat.pid
134
+
135
+ # Redis
136
+ *.rdb
137
+ *.aof
138
+ *.pid
139
+
140
+ # RabbitMQ
141
+ mnesia/
142
+ rabbitmq/
143
+ rabbitmq-data/
144
+
145
+ # ActiveMQ
146
+ activemq-data/
147
+
148
+ # SageMath parsed files
149
+ *.sage.py
150
+
151
+ # Environments
152
+ .env
153
+ .envrc
154
+ .venv
155
+ env/
156
+ venv/
157
+ ENV/
158
+ env.bak/
159
+ venv.bak/
160
+
161
+ # Spyder project settings
162
+ .spyderproject
163
+ .spyproject
164
+
165
+ # Rope project settings
166
+ .ropeproject
167
+
168
+ # mkdocs documentation
169
+ /site
170
+
171
+ # mypy
172
+ .mypy_cache/
173
+ .dmypy.json
174
+ dmypy.json
175
+
176
+ # Pyre type checker
177
+ .pyre/
178
+
179
+ # pytype static type analyzer
180
+ .pytype/
181
+
182
+ # Cython debug symbols
183
+ cython_debug/
184
+
185
+ # PyCharm
186
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
187
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
188
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
189
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
190
+ # .idea/
191
+
192
+ # Abstra
193
+ # Abstra is an AI-powered process automation framework.
194
+ # Ignore directories containing user credentials, local state, and settings.
195
+ # Learn more at https://abstra.io/docs
196
+ .abstra/
197
+
198
+ # Visual Studio Code
199
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
200
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
201
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
202
+ # you could uncomment the following to ignore the entire vscode folder
203
+ # .vscode/
204
+ # Temporary file for partial code execution
205
+ tempCodeRunnerFile.py
206
+
207
+ # Ruff stuff:
208
+ .ruff_cache/
209
+
210
+ # PyPI configuration file
211
+ .pypirc
212
+
213
+ # Marimo
214
+ marimo/_static/
215
+ marimo/_lsp/
216
+ __marimo__/
217
+
218
+ # Streamlit
219
+ .streamlit/secrets.toml
@@ -0,0 +1,31 @@
1
+ # Code of Conduct
2
+
3
+ MemSandbox contributors are expected to maintain a welcoming, respectful, and
4
+ professional environment.
5
+
6
+ ## Expected behavior
7
+
8
+ - Discuss ideas and code constructively.
9
+ - Respect different experience levels, backgrounds, and viewpoints.
10
+ - Give actionable feedback focused on the work.
11
+ - Accept correction gracefully and help repair misunderstandings.
12
+ - Protect private information shared during security or conduct reports.
13
+
14
+ ## Unacceptable behavior
15
+
16
+ - Harassment, discrimination, threats, or personal attacks.
17
+ - Sexualized language or unwanted attention.
18
+ - Deliberate intimidation, stalking, or disclosure of private information.
19
+ - Sustained disruption of project discussions or review processes.
20
+ - Retaliation against someone who raises a concern in good faith.
21
+
22
+ ## Enforcement
23
+
24
+ Project maintainers may edit or remove contributions, comments, or other participation
25
+ that violates these expectations. Repeated or severe violations may result in a temporary
26
+ or permanent ban from project spaces.
27
+
28
+ Report conduct concerns privately to a project maintainer using a private contact method
29
+ listed on the maintainer's GitHub profile. Do not open a public issue containing sensitive
30
+ or identifying information. Maintainers will review reports confidentially, avoid
31
+ conflicts of interest, and respond proportionately.
@@ -0,0 +1,89 @@
1
+ # Contributing to MemSandbox
2
+
3
+ Thank you for helping build MemSandbox.
4
+
5
+ ## Before starting
6
+
7
+ 1. Open or select a GitHub issue describing the behavior and acceptance criteria.
8
+ 2. Keep the main checkout on `main`.
9
+ 3. Create a short-lived issue branch in a separate worktree:
10
+
11
+ ```console
12
+ git fetch origin
13
+ git worktree add ../mem-sandbox-<short-name> -b feature/<issue>-<short-name> main
14
+ ```
15
+
16
+ Use `fix/<issue>-<short-name>` for bug fixes. Do not implement directly in the main
17
+ checkout.
18
+
19
+ ## Development setup
20
+
21
+ Install Python 3.12 or later and [uv](https://docs.astral.sh/uv/), then run:
22
+
23
+ ```console
24
+ uv sync --all-groups
25
+ ```
26
+
27
+ ## Implementation expectations
28
+
29
+ - Write or update behavior tests before implementation.
30
+ - Keep core modules independent of agent frameworks.
31
+ - Express collaborators through narrow constructor-injected interfaces.
32
+ - Use immutable domain request and result types at boundaries.
33
+ - Reject unsupported behavior explicitly; never fall back to the host filesystem or shell.
34
+ - Update the owning module `README.md` when behavior, interfaces, invariants, or
35
+ dependencies change.
36
+
37
+ ## Required checks
38
+
39
+ Run the same checks used by CI:
40
+
41
+ ```console
42
+ uv run pytest
43
+ uv run ruff format --check src tests
44
+ uv run ruff check src tests
45
+ uv run pyright src tests
46
+ uv build
47
+ ```
48
+
49
+ ## Pull requests
50
+
51
+ Keep each pull request focused on one issue or behavior seam. Explain the behavior change,
52
+ important design decisions, and any deferred work. Link the issue and ensure all required
53
+ checks pass before merge.
54
+
55
+ ## Publishing a release
56
+
57
+ Publishing is maintainer-only and uses
58
+ [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/) rather than a
59
+ long-lived repository token. The PyPI publisher must match:
60
+
61
+ | Setting | Value |
62
+ |---|---|
63
+ | Project | `mem-sandbox` |
64
+ | Repository owner | `hahahahahaiyiwen` |
65
+ | Repository | `mem-sandbox` |
66
+ | Workflow | `publish.yml` |
67
+ | GitHub environment | `pypi` |
68
+
69
+ The protected `pypi` environment should require approval. Its publish job receives only
70
+ `contents: read` and `id-token: write`; the separate build job cannot request an OIDC
71
+ token.
72
+
73
+ To publish:
74
+
75
+ 1. Merge the release changes and a unique semantic version in `pyproject.toml` to
76
+ `main`.
77
+ 2. Confirm the required `main` checks pass.
78
+ 3. Create and push an annotated `v<version>` tag at the intended `main` commit.
79
+ 4. Publish a GitHub release for that tag.
80
+ 5. Approve the `pypi` environment deployment after reviewing the workflow's built
81
+ distributions.
82
+ 6. Install the exact version from PyPI in a clean environment and verify its public
83
+ imports.
84
+
85
+ The release workflow rejects a tag that does not exactly match
86
+ `v<project.version>`, builds the wheel and source distribution once, validates their
87
+ metadata, and publishes those same artifacts. PyPI versions and uploaded files are
88
+ immutable; correct a failed release with a new version rather than attempting to replace
89
+ an existing one.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MemSandbox contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.5
2
+ Name: mem-sandbox
3
+ Version: 0.1.0
4
+ Summary: A deterministic in-memory workspace and command sandbox for AI agents
5
+ Project-URL: Documentation, https://github.com/hahahahahaiyiwen/mem-sandbox/tree/main/docs
6
+ Project-URL: Issues, https://github.com/hahahahahaiyiwen/mem-sandbox/issues
7
+ Project-URL: Repository, https://github.com/hahahahahaiyiwen/mem-sandbox
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: agents,ai,filesystem,sandbox,workspace
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.12
21
+ Provides-Extra: openai-agents
22
+ Requires-Dist: openai-agents<0.23,>=0.22; extra == 'openai-agents'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # MemSandbox
26
+
27
+ A deterministic in-memory workspace and constrained command environment for AI agents.
28
+
29
+ MemSandbox lets an application give an agent stateful files, familiar POSIX-shaped
30
+ commands, snapshots, policy enforcement, and explicit lifecycle management without
31
+ giving the model direct access to the host filesystem or shell.
32
+
33
+ > **Status:** The framework-neutral core and first native OpenAI Agents SDK
34
+ > integration are implemented and tested on Python 3.12 and 3.14 for Linux and Windows.
35
+ > APIs may still change before the first stable release.
36
+
37
+ ## Quick start
38
+
39
+ Prerequisites:
40
+
41
+ - Python 3.12 or later (3.12 and 3.14 are tested in CI)
42
+ - [uv](https://docs.astral.sh/uv/)
43
+
44
+ Clone the repository and install its optional integration dependencies:
45
+
46
+ ```console
47
+ git clone https://github.com/hahahahahaiyiwen/mem-sandbox.git
48
+ cd mem-sandbox
49
+ uv sync --all-groups
50
+ ```
51
+
52
+ ### 1. Explore MemSandbox without a model
53
+
54
+ ```console
55
+ uv run python -m samples.shared
56
+ ```
57
+
58
+ This opens an empty, process-local sandbox with no credentials, model, or network
59
+ request:
60
+
61
+ ```text
62
+ mem-sandbox:/workspace> pwd
63
+ /workspace
64
+ mem-sandbox:/workspace> mkdir demo
65
+ mem-sandbox:/workspace> echo hello > demo/message.txt
66
+ mem-sandbox:/workspace> cat demo/message.txt
67
+ hello
68
+ mem-sandbox:/workspace> exit
69
+ ```
70
+
71
+ Commands run in MemSandbox's constrained virtual command language, not a host shell.
72
+ The in-memory session is deleted when the CLI exits.
73
+
74
+ ### 2. Run the `workspace-edit` agent scenario
75
+
76
+ Choose one inference provider.
77
+
78
+ **Official OpenAI**
79
+
80
+ ```sh
81
+ export OPENAI_API_KEY="<api-key>"
82
+ export OPENAI_MODEL="<model>"
83
+
84
+ uv run python -m samples.openai_agents_sdk.providers.openai \
85
+ --scenario workspace-edit \
86
+ --inspect
87
+ ```
88
+
89
+ **Azure OpenAI**
90
+
91
+ ```sh
92
+ export AZURE_OPENAI_ENDPOINT="https://<resource>.openai.azure.com"
93
+ export AZURE_OPENAI_API_KEY="<api-key>"
94
+ export AZURE_OPENAI_API_VERSION="<api-version>"
95
+ export AZURE_OPENAI_DEPLOYMENT="<deployment-name>"
96
+
97
+ uv run python -m samples.openai_agents_sdk.providers.azure_openai \
98
+ --scenario workspace-edit \
99
+ --inspect
100
+ ```
101
+
102
+ The scenario asks the agent to create a file, read its content hash, apply a guarded
103
+ patch from `status=pending` to `status=complete`, and read the result. Host code verifies
104
+ the exact final bytes before `--inspect` attaches the constrained CLI to the same live
105
+ session:
106
+
107
+ ```text
108
+ mem-sandbox:/workspace> cat /workspace/demo/report.txt
109
+ status=complete
110
+ mem-sandbox:/workspace> exit
111
+ ```
112
+
113
+ Live runs are billable and require network access. Credentials are read from the process
114
+ environment and are never placed in the sandbox. For provider requirements, see the
115
+ [official OpenAI guide](./samples/openai_agents_sdk/providers/openai/README.md) or
116
+ [Azure OpenAI guide](./samples/openai_agents_sdk/providers/azure_openai/README.md).
117
+ To embed the integration in an application instead of running the repository scenario,
118
+ follow the complete
119
+ [`SandboxAgent` usage path](./src/mem_sandbox/integrations/openai_agents/README.md#use-with-sandboxagent).
120
+
121
+ List the other available scenarios without credentials or a network request:
122
+
123
+ ```console
124
+ uv run python -m samples.openai_agents_sdk.providers.openai --list-scenarios
125
+ ```
126
+
127
+ ## How the agent integration works
128
+
129
+ ```text
130
+ Official OpenAI or Azure OpenAI
131
+ |
132
+ v
133
+ OpenAI Agents SDK SandboxAgent
134
+ |
135
+ v
136
+ InMemorySandboxCapability
137
+ |
138
+ v
139
+ MemSandbox session
140
+ +-- in-memory POSIX workspace
141
+ +-- constrained command executor
142
+ +-- policy, quotas, events, and snapshots
143
+ |
144
+ +-- host verification and optional inspection CLI
145
+ ```
146
+
147
+ The model receives exactly four tools: `execute`, `read_file`, `write_file`, and
148
+ `apply_patch`. It does not receive a sandbox handle, lifecycle controls, snapshot
149
+ authority, secrets, mounts, ports, network access, a host shell, or arbitrary process
150
+ execution.
151
+
152
+ Choose the documentation path that matches the task:
153
+
154
+ - **Run a maintained live example:** use the
155
+ [OpenAI Agents SDK samples](./samples/openai_agents_sdk/README.md).
156
+ - **Embed the public interfaces:** use the
157
+ [reader-first OpenAI integration guide](./src/mem_sandbox/integrations/openai_agents/README.md#use-with-sandboxagent).
158
+ - **Review adapter invariants:** use the integration guide's
159
+ [engineering reference](./src/mem_sandbox/integrations/openai_agents/README.md#engineering-reference).
160
+
161
+ ## What MemSandbox provides
162
+
163
+ - **Stateful virtual workspace:** byte-oriented files and directories with canonical
164
+ POSIX paths, atomic mutations, content hashes, and configurable quotas.
165
+ - **Constrained command environment:** deterministic implementations of selected
166
+ familiar commands, including pipelines, conditionals, environment changes, and
167
+ redirection.
168
+ - **Lifecycle service:** create, look up, resume, and delete isolated process-local
169
+ sessions through opaque host-owned handles.
170
+ - **Portable state:** bounded workspace archives, snapshots, resume, and isolated forks.
171
+ - **Host-owned controls:** policy, secrets, events, limits, manifests, and capability
172
+ selection remain application responsibilities.
173
+ - **Framework-neutral core:** agent SDK packages are optional adapters over the same
174
+ domain API.
175
+
176
+ The implemented command profile includes `pwd`, `cd`, `ls`, `cat`, `echo`, `mkdir`,
177
+ `touch`, `rm`, `head`, `tail`, `grep`, `find`, `wc`, `sort`, `uniq`, `cp`, `mv`, `env`,
178
+ `export`, and `unset`. This is an explicit virtual command language, not a complete shell.
179
+
180
+ ## Security boundary
181
+
182
+ MemSandbox is a **logical and API sandbox**, not an operating-system isolation boundary.
183
+ Supported operations do not fall through to the host filesystem or shell, but arbitrary
184
+ Python or native code running in the same process is outside its containment model.
185
+
186
+ Use a process, container, VM, microVM, or WASM boundary when executing untrusted
187
+ arbitrary code. Network access, host subprocesses, mounts, PTYs, and full POSIX shell
188
+ compatibility are not part of the current profile.
189
+
190
+ Read the [high-level design](./docs/HIGH_LEVEL_DESIGN.md) and
191
+ [OpenAI integration boundary](./src/mem_sandbox/integrations/openai_agents/README.md)
192
+ before embedding MemSandbox in a security-sensitive application.
193
+
194
+ ## Project status and documentation
195
+
196
+ Milestone 5 delivered the first native integration through
197
+ `openai-agents>=0.22,<0.23`, tested exactly with `0.22.0`. Other framework and transport
198
+ integrations remain non-gating follow-ups.
199
+
200
+ - [Design and research index](./docs/README.md)
201
+ - [High-level design](./docs/HIGH_LEVEL_DESIGN.md)
202
+ - [Implementation plan](./docs/PLAN.md)
203
+ - [Run samples and configure providers](./samples/README.md)
204
+ - [Embed or maintain the OpenAI Agents SDK integration](./src/mem_sandbox/integrations/openai_agents/README.md)
205
+ - [Workspace design](./docs/components/workspace/README.md)
206
+ - [Command executor design](./docs/components/command-executor/README.md)
207
+ - [Product validation and benchmarks](./docs/product-validation/README.md)
208
+
209
+ ## Development
210
+
211
+ ```console
212
+ uv sync --all-groups
213
+ uv run pytest
214
+ uv run ruff format --check benchmarks evaluations samples src tests
215
+ uv run ruff check benchmarks evaluations samples src tests
216
+ uv run pyright benchmarks evaluations samples src tests
217
+ uv build
218
+ ```
219
+
220
+ Development uses short-lived issue branches in separate Git worktrees. The main checkout
221
+ stays on `main`, and changes reach it through pull requests.
222
+
223
+ ## Contributing, security, and license
224
+
225
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) before starting a change. Report security issues
226
+ using the private process in [SECURITY.md](./SECURITY.md), not a public issue.
227
+
228
+ MemSandbox is licensed under the [MIT License](./LICENSE).