deepagents-microsandbox 1.0.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.
- deepagents_microsandbox-1.0.0/.github/workflows/publish-to-pypi.yml +73 -0
- deepagents_microsandbox-1.0.0/.gitignore +112 -0
- deepagents_microsandbox-1.0.0/AGENTS.md +73 -0
- deepagents_microsandbox-1.0.0/LICENSE +21 -0
- deepagents_microsandbox-1.0.0/PKG-INFO +82 -0
- deepagents_microsandbox-1.0.0/README.md +72 -0
- deepagents_microsandbox-1.0.0/deepagents_microsandbox/__init__.py +21 -0
- deepagents_microsandbox-1.0.0/deepagents_microsandbox/backend.py +250 -0
- deepagents_microsandbox-1.0.0/deepagents_microsandbox/provider.py +356 -0
- deepagents_microsandbox-1.0.0/pyproject.toml +64 -0
- deepagents_microsandbox-1.0.0/uv.lock +1959 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- '*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
package-test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.11"
|
|
21
|
+
|
|
22
|
+
- name: Install uv
|
|
23
|
+
run: python -m pip install uv
|
|
24
|
+
|
|
25
|
+
- name: Run tests
|
|
26
|
+
run: |
|
|
27
|
+
uv sync
|
|
28
|
+
uv run --group dev pytest
|
|
29
|
+
|
|
30
|
+
release-build:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
|
|
36
|
+
- uses: actions/setup-python@v5
|
|
37
|
+
with:
|
|
38
|
+
python-version: "3.11"
|
|
39
|
+
|
|
40
|
+
- name: Build release distributions
|
|
41
|
+
run: |
|
|
42
|
+
# NOTE: put your own distribution build steps here.
|
|
43
|
+
python -m pip install build
|
|
44
|
+
python -m build
|
|
45
|
+
|
|
46
|
+
- name: Upload distributions
|
|
47
|
+
uses: actions/upload-artifact@v4
|
|
48
|
+
with:
|
|
49
|
+
name: release-dists
|
|
50
|
+
path: dist/
|
|
51
|
+
|
|
52
|
+
pypi-publish:
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
needs:
|
|
55
|
+
- release-build
|
|
56
|
+
permissions:
|
|
57
|
+
id-token: write
|
|
58
|
+
|
|
59
|
+
environment:
|
|
60
|
+
name: pypi
|
|
61
|
+
url: https://pypi.org/p/b24api
|
|
62
|
+
|
|
63
|
+
steps:
|
|
64
|
+
- name: Retrieve release distributions
|
|
65
|
+
uses: actions/download-artifact@v4
|
|
66
|
+
with:
|
|
67
|
+
name: release-dists
|
|
68
|
+
path: dist/
|
|
69
|
+
|
|
70
|
+
- name: Publish release distributions to PyPI
|
|
71
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
72
|
+
with:
|
|
73
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
env/
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
# Usually these files are written by a python script from a template
|
|
29
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*.cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
|
|
48
|
+
# Translations
|
|
49
|
+
*.mo
|
|
50
|
+
*.pot
|
|
51
|
+
|
|
52
|
+
# Django stuff:
|
|
53
|
+
*.log
|
|
54
|
+
local_settings.py
|
|
55
|
+
|
|
56
|
+
# Flask stuff:
|
|
57
|
+
instance/
|
|
58
|
+
.webassets-cache
|
|
59
|
+
|
|
60
|
+
# Scrapy stuff:
|
|
61
|
+
.scrapy
|
|
62
|
+
|
|
63
|
+
# Sphinx documentation
|
|
64
|
+
docs/_build/
|
|
65
|
+
|
|
66
|
+
# PyBuilder
|
|
67
|
+
target/
|
|
68
|
+
|
|
69
|
+
# Jupyter Notebook
|
|
70
|
+
.ipynb_checkpoints
|
|
71
|
+
|
|
72
|
+
# pyenv
|
|
73
|
+
.python-version
|
|
74
|
+
|
|
75
|
+
# celery beat schedule file
|
|
76
|
+
celerybeat-schedule
|
|
77
|
+
|
|
78
|
+
# SageMath parsed files
|
|
79
|
+
*.sage.py
|
|
80
|
+
|
|
81
|
+
# dotenv
|
|
82
|
+
.env
|
|
83
|
+
|
|
84
|
+
# virtualenv
|
|
85
|
+
.venv
|
|
86
|
+
venv/
|
|
87
|
+
ENV/
|
|
88
|
+
|
|
89
|
+
# Spyder project settings
|
|
90
|
+
.spyderproject
|
|
91
|
+
.spyproject
|
|
92
|
+
|
|
93
|
+
# Rope project settings
|
|
94
|
+
.ropeproject
|
|
95
|
+
|
|
96
|
+
# mkdocs documentation
|
|
97
|
+
/site
|
|
98
|
+
|
|
99
|
+
# mypy
|
|
100
|
+
.mypy_cache/
|
|
101
|
+
|
|
102
|
+
# this package
|
|
103
|
+
.idea/
|
|
104
|
+
.vscode/
|
|
105
|
+
.cursor/
|
|
106
|
+
.claude/
|
|
107
|
+
.codex/
|
|
108
|
+
.pytest_cache/
|
|
109
|
+
.DS_Store
|
|
110
|
+
*.pyc
|
|
111
|
+
*.swp
|
|
112
|
+
*.whl
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
`deepagents-microsandbox` is a Python package that implements a sandbox backend for the [DeepAgents](https://github.com/shkarupa-alex/deepagents) framework using [Microsandbox](https://github.com/shkarupa-alex/microsandbox). It allows DeepAgents to execute code and commands in isolated microsandbox environments.
|
|
5
|
+
|
|
6
|
+
- **Repository**: [deepagents-microsandbox](https://github.com/shkarupa-alex/deepagents-microsandbox)
|
|
7
|
+
- **Language**: Python 3.11+
|
|
8
|
+
- **Dependency Manager**: `uv`
|
|
9
|
+
|
|
10
|
+
## Project Structure
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
deepagents-microsandbox/
|
|
14
|
+
├── deepagents_microsandbox/
|
|
15
|
+
│ ├── backend.py # MicrosandboxBackend implementation
|
|
16
|
+
│ ├── provider.py # MicrosandboxProvider implementation
|
|
17
|
+
│ ├── backend_test.py # Backend unit and integration tests
|
|
18
|
+
│ └── provider_test.py # Provider unit and integration tests
|
|
19
|
+
├── pyproject.toml # Project configuration and dependencies
|
|
20
|
+
├── uv.lock # Dependency lock file
|
|
21
|
+
└── AGENTS.md # Documentation for AI coding agents
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Architecture
|
|
25
|
+
|
|
26
|
+
This package provides two main components in the `deepagents_microsandbox` package:
|
|
27
|
+
|
|
28
|
+
### 1. `MicrosandboxProvider` (`provider.py`)
|
|
29
|
+
- Implements `SandboxProvider` from `deepagents`.
|
|
30
|
+
- Responsible for the lifecycle of sandboxes (create, get, list, delete).
|
|
31
|
+
- Interacts with the Microsandbox API server to provision environments.
|
|
32
|
+
|
|
33
|
+
### 2. `MicrosandboxBackend` (`backend.py`)
|
|
34
|
+
- Implements `SandboxBackend` from `deepagents`.
|
|
35
|
+
- Represents a single active sandbox instance.
|
|
36
|
+
- Handles file operations (`read_file`, `write_file`, `list_dir`) and command execution (`execute`).
|
|
37
|
+
- Connects to a specific microsandbox instance via HTTP.
|
|
38
|
+
|
|
39
|
+
## Development Standards
|
|
40
|
+
|
|
41
|
+
### Dependency Management
|
|
42
|
+
This project uses `uv` for all dependency management and running commands.
|
|
43
|
+
- **Install dependencies**: `uv sync`
|
|
44
|
+
- **Add dependency**: `uv add <package>`
|
|
45
|
+
- **Add dev dependency**: `uv add --dev <package>`
|
|
46
|
+
|
|
47
|
+
### Code Style
|
|
48
|
+
- **Formatter/Linter**: `ruff` is used for linting and formatting. configuration is in `pyproject.toml`.
|
|
49
|
+
- **Type Hints**: strict typing is enforced. usage of `mypy` is recommended.
|
|
50
|
+
- **Docstrings**: Google-style docstrings are required for public APIs.
|
|
51
|
+
|
|
52
|
+
### Testing
|
|
53
|
+
Tests are located in `*_test.py` files alongside the source code.
|
|
54
|
+
|
|
55
|
+
#### Unit Tests (Mocked)
|
|
56
|
+
Tests that do not require a running microsandbox server. These mock network requests.
|
|
57
|
+
```bash
|
|
58
|
+
uv run pytest
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Integration Tests (Real Server)
|
|
62
|
+
Tests that run against a live microsandbox server.
|
|
63
|
+
To run these, you must have a microsandbox server running (e.g., `msb server start --dev`).
|
|
64
|
+
```bash
|
|
65
|
+
MICROSANDBOX_DEV_SERVER=http://127.0.0.1:5555 uv run pytest
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Key Files
|
|
69
|
+
- `pyproject.toml`: Project configuration, dependencies, and tool settings.
|
|
70
|
+
- `deepagents_microsandbox/provider.py`: Provider implementation.
|
|
71
|
+
- `deepagents_microsandbox/backend.py`: Backend implementation.
|
|
72
|
+
- `deepagents_microsandbox/backend_test.py`: Tests for the backend.
|
|
73
|
+
- `deepagents_microsandbox/provider_test.py`: Tests for the provider.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shkarupa Alex
|
|
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,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepagents-microsandbox
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Microsandbox backend for DeepAgents
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: deepagents>=0.3.10
|
|
8
|
+
Requires-Dist: microsandbox>=0.1.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# deepagents-microsandbox
|
|
12
|
+
|
|
13
|
+
Microsandbox backend for the [DeepAgents](https://github.com/shkarupa-alex/deepagents) framework. This package enables DeepAgents to launch and control isolated sandbox environments using [Microsandbox](https://github.com/shkarupa-alex/microsandbox).
|
|
14
|
+
|
|
15
|
+
## Key Features
|
|
16
|
+
|
|
17
|
+
- **Sandbox Provider**: Manages the lifecycle of microsandbox instances (create, list, delete).
|
|
18
|
+
- **Sandbox Backend**: Provides a standard interface for file operations and command execution within a sandbox.
|
|
19
|
+
- **DeepAgents Integration**: Fully compatible with the DeepAgents `SandboxProvider` and `SandboxBackend` interfaces.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install deepagents-microsandbox
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from deepagents_microsandbox import MicrosandboxProvider
|
|
31
|
+
|
|
32
|
+
# Initialize the provider connecting to a microsandbox server
|
|
33
|
+
provider = MicrosandboxProvider(server_url="http://localhost:5555")
|
|
34
|
+
|
|
35
|
+
# Create or get a sandbox
|
|
36
|
+
sandbox = provider.get_or_create(sandbox_id=None)
|
|
37
|
+
|
|
38
|
+
# Execute a command
|
|
39
|
+
result = sandbox.execute("echo 'Hello World'")
|
|
40
|
+
print(result.stdout)
|
|
41
|
+
|
|
42
|
+
# Clean up
|
|
43
|
+
provider.delete(sandbox_id=sandbox.id)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
This project uses `uv` for dependency management.
|
|
49
|
+
|
|
50
|
+
### Prerequisites
|
|
51
|
+
|
|
52
|
+
- [uv](https://github.com/astral-sh/uv) installed.
|
|
53
|
+
- Python 3.11 or higher.
|
|
54
|
+
|
|
55
|
+
### Setup
|
|
56
|
+
|
|
57
|
+
Install dependencies:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
uv sync
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Testing
|
|
64
|
+
|
|
65
|
+
Tests are split into unit tests (mocked) and integration tests (requiring a real server).
|
|
66
|
+
|
|
67
|
+
**Run Unit Tests (Mocked)**
|
|
68
|
+
These tests mock the HTTP interactions and do not require a running server.
|
|
69
|
+
```bash
|
|
70
|
+
uv run pytest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Run Integration Tests**
|
|
74
|
+
These tests verify behavior against a real microsandbox server.
|
|
75
|
+
1. Start a microsandbox server in dev mode:
|
|
76
|
+
```bash
|
|
77
|
+
msb server start --dev
|
|
78
|
+
```
|
|
79
|
+
2. Run the tests with the environment variable:
|
|
80
|
+
```bash
|
|
81
|
+
MICROSANDBOX_DEV_SERVER=http://127.0.0.1:5555 uv run pytest
|
|
82
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# deepagents-microsandbox
|
|
2
|
+
|
|
3
|
+
Microsandbox backend for the [DeepAgents](https://github.com/shkarupa-alex/deepagents) framework. This package enables DeepAgents to launch and control isolated sandbox environments using [Microsandbox](https://github.com/shkarupa-alex/microsandbox).
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Sandbox Provider**: Manages the lifecycle of microsandbox instances (create, list, delete).
|
|
8
|
+
- **Sandbox Backend**: Provides a standard interface for file operations and command execution within a sandbox.
|
|
9
|
+
- **DeepAgents Integration**: Fully compatible with the DeepAgents `SandboxProvider` and `SandboxBackend` interfaces.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install deepagents-microsandbox
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from deepagents_microsandbox import MicrosandboxProvider
|
|
21
|
+
|
|
22
|
+
# Initialize the provider connecting to a microsandbox server
|
|
23
|
+
provider = MicrosandboxProvider(server_url="http://localhost:5555")
|
|
24
|
+
|
|
25
|
+
# Create or get a sandbox
|
|
26
|
+
sandbox = provider.get_or_create(sandbox_id=None)
|
|
27
|
+
|
|
28
|
+
# Execute a command
|
|
29
|
+
result = sandbox.execute("echo 'Hello World'")
|
|
30
|
+
print(result.stdout)
|
|
31
|
+
|
|
32
|
+
# Clean up
|
|
33
|
+
provider.delete(sandbox_id=sandbox.id)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Development
|
|
37
|
+
|
|
38
|
+
This project uses `uv` for dependency management.
|
|
39
|
+
|
|
40
|
+
### Prerequisites
|
|
41
|
+
|
|
42
|
+
- [uv](https://github.com/astral-sh/uv) installed.
|
|
43
|
+
- Python 3.11 or higher.
|
|
44
|
+
|
|
45
|
+
### Setup
|
|
46
|
+
|
|
47
|
+
Install dependencies:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uv sync
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Testing
|
|
54
|
+
|
|
55
|
+
Tests are split into unit tests (mocked) and integration tests (requiring a real server).
|
|
56
|
+
|
|
57
|
+
**Run Unit Tests (Mocked)**
|
|
58
|
+
These tests mock the HTTP interactions and do not require a running server.
|
|
59
|
+
```bash
|
|
60
|
+
uv run pytest
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Run Integration Tests**
|
|
64
|
+
These tests verify behavior against a real microsandbox server.
|
|
65
|
+
1. Start a microsandbox server in dev mode:
|
|
66
|
+
```bash
|
|
67
|
+
msb server start --dev
|
|
68
|
+
```
|
|
69
|
+
2. Run the tests with the environment variable:
|
|
70
|
+
```bash
|
|
71
|
+
MICROSANDBOX_DEV_SERVER=http://127.0.0.1:5555 uv run pytest
|
|
72
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Microsandbox integration for DeepAgents.
|
|
2
|
+
|
|
3
|
+
This package provides:
|
|
4
|
+
- MicrosandboxBackend: Sandbox backend for executing commands in Microsandbox containers
|
|
5
|
+
- MicrosandboxProvider: Provider for managing Microsandbox lifecycle
|
|
6
|
+
|
|
7
|
+
Example usage:
|
|
8
|
+
```python
|
|
9
|
+
from deepagents_microsandbox import MicrosandboxBackend, MicrosandboxProvider
|
|
10
|
+
|
|
11
|
+
provider = MicrosandboxProvider(server_url="http://localhost:5555")
|
|
12
|
+
sandbox = provider.get_or_create(sandbox_id=None)
|
|
13
|
+
result = sandbox.execute("echo 'Hello'")
|
|
14
|
+
provider.delete(sandbox_id=sandbox.id)
|
|
15
|
+
```
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from deepagents_microsandbox.backend import MicrosandboxBackend
|
|
19
|
+
from deepagents_microsandbox.provider import MicrosandboxProvider
|
|
20
|
+
|
|
21
|
+
__all__ = ["MicrosandboxBackend", "MicrosandboxProvider"]
|