Skip to content

Commit d750e34

Browse files
feat: add langchain deepagents backend integration
Adds langchain-agent-sandbox package that implements the DeepAgents BackendProtocol by wrapping a SandboxClient. Features: - Execute commands in sandbox - Read/write/edit files with path virtualization under /app - Grep and glob operations - File upload/download - Async variants of all operations - Path traversal protection The package is self-contained in clients/python/langchain-agent-sandbox/ with its own tests and mypy configuration.
1 parent 1e1c435 commit d750e34

File tree

7 files changed

+922
-0
lines changed

7 files changed

+922
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# LangChain Agent Sandbox Backend
2+
3+
This package provides a LangChain DeepAgents backend that connects to the Kubernetes agent-sandbox runtime via the existing Python SDK.
4+
5+
## Install
6+
7+
```sh
8+
pip install langchain-agent-sandbox
9+
```
10+
11+
## Usage
12+
13+
```python
14+
from agentic_sandbox import SandboxClient
15+
from deepagents import create_deep_agent
16+
from langchain_agent_sandbox import AgentSandboxBackend
17+
18+
with SandboxClient(template_name="my-template", namespace="default") as client:
19+
backend = AgentSandboxBackend(client, root_dir="/app")
20+
agent = create_deep_agent(backend=backend)
21+
22+
result = agent.invoke("List files in the sandbox")
23+
print(result)
24+
```
25+
26+
## Notes
27+
- The backend wraps the `SandboxClient` methods (`run`, `read`, `write`) to implement the DeepAgents protocol.
28+
- File paths are virtualized under `root_dir` (default `/app`).
29+
- Requires POSIX utilities in the sandbox image: `sh`, `base64`, `grep`, `find`, `mkdir`, `ls`, and `test`.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .backend import AgentSandboxBackend
2+
3+
__all__ = ["AgentSandboxBackend"]

0 commit comments

Comments
 (0)