LangChain Deep Agents
Make an E2B sandbox the environment for a LangChain Deep Agent. With the langchain-e2b backend, the agent's file tools and shell commands run in the sandbox instead of on your machine.
- E2B
- Sandbox backend for Deep Agents
- langchain-e2b
- Python
Get started
Paste the prompt into your coding agent, or follow the steps yourself.
Paste this into your coding agent
Add E2B sandboxes to this LangChain Deep Agents project.
- 1.Install deepagents, langchain-e2b and e2b using the project's package manager.
- 2.The sandbox needs the E2B_API_KEY environment variable. If it isn't set, ask me for my API key from https://console.e2b.dev/?tab=keys. Never hardcode it.
- 3.Follow the Deep Agents guide at https://docs.e2b.dev/agents/deep-agents. Create a sandbox with Sandbox.create(), pass E2BSandbox(sandbox=sandbox) as the backend to create_deep_agent, and kill the sandbox when the agent is done.
- 4.Run one task and show me the output that came from the sandbox.
Or set it up yourself
1. Install the packages
2. Set your API keys
3. Create the agent on a sandbox
4. Run a task
What runs in the sandbox
The agent's built-in tools all run in an isolated sandbox, away from your machine.
- ls, read_file, write_file, edit_file, glob and grep work on the sandbox filesystem.
- The execute tool runs shell commands inside the sandbox.
- You create the sandbox and kill it when done. In dcode, the sandbox is created on start and deleted on exit.
- Pass a custom template to Sandbox.create() to preinstall the languages and tools your agent needs.
More agent frameworks
Other frameworks that run their tools on E2B.
