From 886fab450189d35073580a421cb20c206f05235b Mon Sep 17 00:00:00 2001 From: Ondrej Drapalik Date: Wed, 15 Jul 2026 14:52:23 +0200 Subject: [PATCH 1/8] docs: add LangChain Deep Agents and Open SWE pages --- docs.json | 2 + docs/agents/deep-agents.mdx | 111 +++++++++++++++++++++++++++++++++++ docs/agents/open-swe.mdx | 99 +++++++++++++++++++++++++++++++ images/icons/deep-agents.svg | 1 + images/icons/open-swe.svg | 9 +++ 5 files changed, 222 insertions(+) create mode 100644 docs/agents/deep-agents.mdx create mode 100644 docs/agents/open-swe.mdx create mode 100644 images/icons/deep-agents.svg create mode 100644 images/icons/open-swe.svg diff --git a/docs.json b/docs.json index e43ba751..9ba5a1ea 100644 --- a/docs.json +++ b/docs.json @@ -64,6 +64,8 @@ "docs/agents/crabbox", "docs/agents/devin", "docs/agents/grok", + "docs/agents/deep-agents", + "docs/agents/open-swe", "docs/agents/openai-agents-sdk", { "group": "OpenClaw", diff --git a/docs/agents/deep-agents.mdx b/docs/agents/deep-agents.mdx new file mode 100644 index 00000000..89320b1b --- /dev/null +++ b/docs/agents/deep-agents.mdx @@ -0,0 +1,111 @@ +--- +title: "LangChain Deep Agents" +description: "Use E2B sandboxes as the execution backend for LangChain Deep Agents." +icon: "/images/icons/deep-agents.svg" +--- + +[Deep Agents](https://docs.langchain.com/oss/python/deepagents/overview) is LangChain's agent harness for building LLM-powered agents, built on the [LangGraph](https://langchain-ai.github.io/langgraph/) runtime. In Deep Agents, a [sandbox backend](https://docs.langchain.com/oss/python/deepagents/sandboxes) defines the environment where the agent operates — E2B is a supported backend via the [`langchain-e2b`](https://pypi.org/project/langchain-e2b/) package. + +With the E2B backend, the agent's built-in tools all execute inside an isolated sandbox instead of your machine: + +- **Filesystem tools** — `ls`, `read_file`, `write_file`, `edit_file`, `glob`, and `grep` operate on the sandbox filesystem. +- **Shell tool** — `execute` runs arbitrary shell commands in the sandbox. + +## Install the dependencies + +```bash +pip install deepagents langchain-e2b e2b +``` + +You will also need API keys for E2B and your model provider: + +```bash +export E2B_API_KEY="e2b_***" # get yours at https://e2b.dev/dashboard +export ANTHROPIC_API_KEY="sk-ant-***" +``` + +## Basic example + +Create an E2B sandbox, wrap it in the `E2BSandbox` backend, and pass it to `create_deep_agent`. You manage the sandbox lifecycle yourself — create it before the agent runs and kill it when you're done. + +```python +from deepagents import create_deep_agent +from e2b import Sandbox +from langchain_e2b import E2BSandbox + +sandbox = Sandbox.create(timeout=600) + +agent = create_deep_agent( + model="anthropic:claude-sonnet-5", + system_prompt="You are a coding agent working in an isolated Linux sandbox.", + backend=E2BSandbox(sandbox=sandbox), +) + +result = agent.invoke({ + "messages": [{ + "role": "user", + "content": "Create hello.py that prints 'Hello from E2B', run it, and show the output.", + }] +}) + +print(result["messages"][-1].content) +sandbox.kill() +``` + +The agent's file operations and shell commands all run inside the sandbox — nothing touches your machine. Because the backend wraps the native E2B SDK sandbox, you can configure everything the SDK supports: [custom templates](/docs/template/quickstart), timeouts, [persistence](/docs/sandbox/persistence), or reconnecting to an existing sandbox by ID. + +## Deep Agents Code (dcode) + +[Deep Agents Code](https://docs.langchain.com/oss/python/deepagents/sandboxes#deep-agents-code) is LangChain's terminal coding agent built on Deep Agents. `langchain-e2b` ships a sandbox provider for it, so every `dcode` session can run in an E2B sandbox: + +```bash +dcode --install langchain-e2b --package +export E2B_API_KEY="e2b_***" +dcode --sandbox e2b +``` + +Requires `dcode` >= 0.1.19 and `langchain-e2b` >= 0.0.4. Unlike the library path, `dcode` manages the sandbox lifecycle for you — it creates the sandbox on start and deletes it on exit. Configure it with: + +- `E2B_TEMPLATE` — custom sandbox template to start from +- `E2B_SANDBOX_TIMEOUT` — sandbox timeout in seconds + +## Custom templates + +By default, sandboxes start from the E2B base template. To pre-install languages, frameworks, or tools your agent needs — and cut setup time per run — build a [custom template](/docs/template/quickstart) and pass it when creating the sandbox: + +```python +sandbox = Sandbox.create(template="your-template-id-or-name", timeout=600) +``` + +## Deep Agents vs. Open SWE + +[Open SWE](/docs/agents/open-swe) is LangChain's coding agent framework built on top of Deep Agents — both use the same `langchain-e2b` backend under the hood, but they sit at different layers: + +| | **Deep Agents** (this page) | **[LangChain Open SWE](/docs/agents/open-swe)** | +|---|---|---| +| What it is | A Python library you embed in your own agent | A deployable internal coding agent you fork and run | +| How you use E2B | Create the sandbox yourself and pass `E2BSandbox` to `create_deep_agent` | Set `SANDBOX_TYPE="e2b"` — sandboxes are created and managed for you | +| Sandbox lifecycle | Yours to manage (`Sandbox.create()` / `sandbox.kill()`) | Per-thread persistent sandbox, reconnect by ID, auto-recreate | +| Use it when | Building any custom agent that needs isolated code execution | You want a GitHub/Slack/Linear-driven coding agent for your org | + +Use this page's approach for custom agents; if you're deploying a coding agent for your team, start from [Open SWE](/docs/agents/open-swe) instead. + +## Learn more + +- [Deep Agents sandboxes](https://docs.langchain.com/oss/python/deepagents/sandboxes) — sandbox backends overview +- [E2B integration reference](https://docs.langchain.com/oss/python/integrations/sandboxes/e2b) — LangChain's E2B provider page +- [`langchain-e2b` on PyPI](https://pypi.org/project/langchain-e2b/) + +## Related guides + + + + Build custom sandbox templates with pre-installed dependencies + + + Auto-pause, resume, and manage sandbox lifecycle + + + LangChain's coding agent framework with E2B built in + + diff --git a/docs/agents/open-swe.mdx b/docs/agents/open-swe.mdx new file mode 100644 index 00000000..de583be9 --- /dev/null +++ b/docs/agents/open-swe.mdx @@ -0,0 +1,99 @@ +--- +title: "LangChain Open SWE" +description: "Use E2B sandboxes as the execution environment for Open SWE, LangChain's open-source coding agent framework." +icon: "/images/icons/open-swe.svg" +--- + +[Open SWE](https://github.com/langchain-ai/open-swe) is LangChain's open-source framework for building your org's internal coding agent, built on [LangGraph](https://langchain-ai.github.io/langgraph/) and [Deep Agents](https://github.com/langchain-ai/deepagents). Every task runs in an isolated cloud sandbox where the agent gets full shell access — and E2B is a supported sandbox provider out of the box. + +## Get started + + + + +```bash +git clone https://github.com/langchain-ai/open-swe.git +cd open-swe +uv venv +source .venv/bin/activate +uv sync --all-extras +``` + + + + +Get your API key from the [E2B dashboard](https://e2b.dev/dashboard?tab=keys) and create a `.env` file in the repo root — `langgraph dev` loads it automatically: + +```bash +cat >> .env <<'EOF' +SANDBOX_TYPE="e2b" +E2B_API_KEY="e2b_***" # get yours at https://e2b.dev/dashboard +E2B_TEMPLATE="my-template" # optional: custom sandbox template + +# === LLM === +OPENAI_API_KEY="" # default model is openai:gpt-5.6-sol +ANTHROPIC_API_KEY="" # when using anthropic: models +EOF +``` + +You need an API key for at least one LLM provider — the default model is `openai:gpt-5.6-sol`, and you can switch with `LLM_MODEL_ID` (e.g. `LLM_MODEL_ID="anthropic:claude-sonnet-5"`). Google and Fireworks are also supported — see the [full environment variable reference](https://github.com/langchain-ai/open-swe/blob/main/docs/INSTALLATION.md#6-environment-variables) for LangSmith tracing, GitHub App, and trigger configuration. + +No other sandbox changes are needed — Open SWE creates and manages the sandboxes for you. + + + + +Open SWE's backend is a LangGraph app served together with its webhook API: + +```bash +langgraph dev +``` + +The full deployment (GitHub App, webhooks, dashboard) is covered in the [installation guide](https://github.com/langchain-ai/open-swe/blob/main/docs/INSTALLATION.md). + + + + +As Open SWE picks up tasks, you can watch it create and reuse sandboxes with the [E2B CLI](/docs/cli): + +```bash +npm i -g @e2b/cli +e2b sandbox list --state running +``` + +Each row is one Open SWE thread's sandbox — or inspect them in the [dashboard](https://e2b.dev/dashboard). + + + + +## Using the sandbox backend directly + +Open SWE's sandbox layer is the [`langchain-e2b`](https://pypi.org/project/langchain-e2b/) adapter (see [`agent/integrations/e2b.py`](https://github.com/langchain-ai/open-swe/blob/main/agent/integrations/e2b.py)), which implements the Deep Agents sandbox backend protocol — each thread gets a persistent sandbox that Open SWE reconnects to by ID, and parallel tasks each run in their own sandbox. To use the same `E2BSandbox` backend directly in your own agent — without deploying Open SWE — see [LangChain Deep Agents](/docs/agents/deep-agents). + +## Custom templates + +By default, sandboxes start from the E2B base template. To pre-install languages, frameworks, or internal tools your repositories depend on — and cut setup time per agent run — build a [custom template](/docs/template/quickstart) and point Open SWE at it: + +```bash +E2B_TEMPLATE="your-template-id-or-name" +``` + +## Learn more + +- [Open SWE installation guide](https://github.com/langchain-ai/open-swe/blob/main/docs/INSTALLATION.md) +- [Open SWE customization guide](https://github.com/langchain-ai/open-swe/blob/main/docs/CUSTOMIZATION.md#using-a-different-sandbox-provider) — switching sandbox providers +- [Announcement blog post](https://blog.langchain.com/open-swe-an-open-source-framework-for-internal-coding-agents/) + +## Related guides + + + + Build custom sandbox templates with pre-installed dependencies + + + Auto-pause, resume, and manage sandbox lifecycle + + + Clone repos, manage branches, and push changes + + diff --git a/images/icons/deep-agents.svg b/images/icons/deep-agents.svg new file mode 100644 index 00000000..f5c1e80e --- /dev/null +++ b/images/icons/deep-agents.svg @@ -0,0 +1 @@ +LangChain diff --git a/images/icons/open-swe.svg b/images/icons/open-swe.svg new file mode 100644 index 00000000..2abc59ee --- /dev/null +++ b/images/icons/open-swe.svg @@ -0,0 +1,9 @@ + + + + From 3ca2192d823c9a7a367d0e579b238ce8810804b2 Mon Sep 17 00:00:00 2001 From: Ondrej Drapalik Date: Wed, 15 Jul 2026 15:58:57 +0200 Subject: [PATCH 2/8] docs(open-swe): use pip venv instead of uv for install consistency --- docs/agents/open-swe.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/agents/open-swe.mdx b/docs/agents/open-swe.mdx index de583be9..bca1bafc 100644 --- a/docs/agents/open-swe.mdx +++ b/docs/agents/open-swe.mdx @@ -14,9 +14,9 @@ icon: "/images/icons/open-swe.svg" ```bash git clone https://github.com/langchain-ai/open-swe.git cd open-swe -uv venv +python -m venv .venv source .venv/bin/activate -uv sync --all-extras +pip install -e ".[all]" ``` From 81e73ba16c4fa65dab36f4467650fd3412669a87 Mon Sep 17 00:00:00 2001 From: Ondrej Drapalik Date: Wed, 15 Jul 2026 15:59:02 +0200 Subject: [PATCH 3/8] docs(open-swe): show .env contents directly instead of cat heredoc --- docs/agents/open-swe.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/agents/open-swe.mdx b/docs/agents/open-swe.mdx index bca1bafc..ba5e262a 100644 --- a/docs/agents/open-swe.mdx +++ b/docs/agents/open-swe.mdx @@ -24,8 +24,7 @@ pip install -e ".[all]" Get your API key from the [E2B dashboard](https://e2b.dev/dashboard?tab=keys) and create a `.env` file in the repo root — `langgraph dev` loads it automatically: -```bash -cat >> .env <<'EOF' +```bash .env SANDBOX_TYPE="e2b" E2B_API_KEY="e2b_***" # get yours at https://e2b.dev/dashboard E2B_TEMPLATE="my-template" # optional: custom sandbox template @@ -33,7 +32,6 @@ E2B_TEMPLATE="my-template" # optional: custom sandbox template # === LLM === OPENAI_API_KEY="" # default model is openai:gpt-5.6-sol ANTHROPIC_API_KEY="" # when using anthropic: models -EOF ``` You need an API key for at least one LLM provider — the default model is `openai:gpt-5.6-sol`, and you can switch with `LLM_MODEL_ID` (e.g. `LLM_MODEL_ID="anthropic:claude-sonnet-5"`). Google and Fireworks are also supported — see the [full environment variable reference](https://github.com/langchain-ai/open-swe/blob/main/docs/INSTALLATION.md#6-environment-variables) for LangSmith tracing, GitHub App, and trigger configuration. From a21fc6b4c78881beaec844279b56e894793e2998 Mon Sep 17 00:00:00 2001 From: Ondrej Drapalik Date: Wed, 15 Jul 2026 15:59:08 +0200 Subject: [PATCH 4/8] docs(open-swe): drop CLI install step, assume E2B CLI is set up --- docs/agents/open-swe.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/agents/open-swe.mdx b/docs/agents/open-swe.mdx index ba5e262a..309c81b8 100644 --- a/docs/agents/open-swe.mdx +++ b/docs/agents/open-swe.mdx @@ -55,7 +55,6 @@ The full deployment (GitHub App, webhooks, dashboard) is covered in the [install As Open SWE picks up tasks, you can watch it create and reuse sandboxes with the [E2B CLI](/docs/cli): ```bash -npm i -g @e2b/cli e2b sandbox list --state running ``` From 51e64a289fa1cd09c0995010b144267d6fb75db4 Mon Sep 17 00:00:00 2001 From: Ondrej Drapalik Date: Wed, 15 Jul 2026 15:59:13 +0200 Subject: [PATCH 5/8] docs(open-swe): remove redundant sandbox-row explainer line --- docs/agents/open-swe.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/agents/open-swe.mdx b/docs/agents/open-swe.mdx index 309c81b8..fa88618a 100644 --- a/docs/agents/open-swe.mdx +++ b/docs/agents/open-swe.mdx @@ -58,8 +58,6 @@ As Open SWE picks up tasks, you can watch it create and reuse sandboxes with the e2b sandbox list --state running ``` -Each row is one Open SWE thread's sandbox — or inspect them in the [dashboard](https://e2b.dev/dashboard). - From 108ed6c4e29f1926d5c10b95747f3cdc7a53c7f4 Mon Sep 17 00:00:00 2001 From: Ondrej Drapalik Date: Wed, 15 Jul 2026 15:59:38 +0200 Subject: [PATCH 6/8] docs(deep-agents): put API key exports before install command --- docs/agents/deep-agents.mdx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/agents/deep-agents.mdx b/docs/agents/deep-agents.mdx index 89320b1b..0fa7ebe5 100644 --- a/docs/agents/deep-agents.mdx +++ b/docs/agents/deep-agents.mdx @@ -13,15 +13,17 @@ With the E2B backend, the agent's built-in tools all execute inside an isolated ## Install the dependencies +Set API keys for E2B and your model provider: + ```bash -pip install deepagents langchain-e2b e2b +export E2B_API_KEY="e2b_***" # get yours at https://e2b.dev/dashboard +export ANTHROPIC_API_KEY="sk-ant-***" ``` -You will also need API keys for E2B and your model provider: +Then install the packages: ```bash -export E2B_API_KEY="e2b_***" # get yours at https://e2b.dev/dashboard -export ANTHROPIC_API_KEY="sk-ant-***" +pip install deepagents langchain-e2b e2b ``` ## Basic example From 541ee745c018b62fe158d280a40c54321a672935 Mon Sep 17 00:00:00 2001 From: Ondrej Drapalik Date: Wed, 15 Jul 2026 16:01:25 +0200 Subject: [PATCH 7/8] =?UTF-8?q?docs(open-swe):=20revert=20to=20uv=20instal?= =?UTF-8?q?l=20=E2=80=94=20pip=20cannot=20resolve=20uv=20override-dependen?= =?UTF-8?q?cies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/agents/open-swe.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/agents/open-swe.mdx b/docs/agents/open-swe.mdx index fa88618a..cfad9117 100644 --- a/docs/agents/open-swe.mdx +++ b/docs/agents/open-swe.mdx @@ -14,9 +14,9 @@ icon: "/images/icons/open-swe.svg" ```bash git clone https://github.com/langchain-ai/open-swe.git cd open-swe -python -m venv .venv +uv venv source .venv/bin/activate -pip install -e ".[all]" +uv sync --all-extras ``` From ea783b52d7d50c5a5a972ae26031a082d418abcf Mon Sep 17 00:00:00 2001 From: Ondrej Drapalik Date: Wed, 15 Jul 2026 16:03:25 +0200 Subject: [PATCH 8/8] docs(open-swe): drop 'Using the sandbox backend directly' section --- docs/agents/open-swe.mdx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/agents/open-swe.mdx b/docs/agents/open-swe.mdx index cfad9117..a7bbf9d6 100644 --- a/docs/agents/open-swe.mdx +++ b/docs/agents/open-swe.mdx @@ -61,10 +61,6 @@ e2b sandbox list --state running -## Using the sandbox backend directly - -Open SWE's sandbox layer is the [`langchain-e2b`](https://pypi.org/project/langchain-e2b/) adapter (see [`agent/integrations/e2b.py`](https://github.com/langchain-ai/open-swe/blob/main/agent/integrations/e2b.py)), which implements the Deep Agents sandbox backend protocol — each thread gets a persistent sandbox that Open SWE reconnects to by ID, and parallel tasks each run in their own sandbox. To use the same `E2BSandbox` backend directly in your own agent — without deploying Open SWE — see [LangChain Deep Agents](/docs/agents/deep-agents). - ## Custom templates By default, sandboxes start from the E2B base template. To pre-install languages, frameworks, or internal tools your repositories depend on — and cut setup time per agent run — build a [custom template](/docs/template/quickstart) and point Open SWE at it: