Skip to content
E2B Docs
Agents

LangChain Open SWE

Use E2B sandboxes as the execution environment for Open SWE, LangChain's open-source coding agent framework.

Open SWE is LangChain’s open-source framework for building your org’s internal coding agent, built on LangGraph and Deep Agents. 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

Clone and install Open SWE

git clone https://github.com/langchain-ai/open-swe.git
cd open-swe
uv venv
source .venv/bin/activate
uv sync --all-extras

Set the sandbox provider to E2B

Get your API key from the E2B dashboard and create a .env file in the repo root — langgraph dev loads it automatically:

.env
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

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 for LangSmith tracing, GitHub App, and trigger configuration.

No other sandbox changes are needed — Open SWE creates and manages the sandboxes for you.

Run the backend

Open SWE’s backend is a LangGraph app served together with its webhook API:

langgraph dev

The full deployment (GitHub App, webhooks, dashboard) is covered in the installation guide.

Watch the sandboxes

As Open SWE picks up tasks, you can watch it create and reuse sandboxes with the E2B CLI:

e2b sandbox list --state running

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 and point Open SWE at it:

E2B_TEMPLATE="your-template-id-or-name"

Learn more

Was this page helpful?Suggest editsRaise issue