Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/images/providers/dark/leap0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/providers/leap0-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/providers/light/leap0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/oss/deepagents/sandboxes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ For provider-specific setup, authentication, and lifecycle details, see [sandbox
<img className="w-5 h-5" src="/images/brand/docs-favicon.png" alt="" />
<span className="font-semibold">LangSmith</span>
</a>

<a href="/oss/integrations/providers/leap0" className="flex items-center justify-center gap-1.5 p-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 no-underline">
<img className="block dark:hidden w-5 h-5" src="/images/providers/light/leap0.svg" alt="" />
<img className="hidden dark:block w-5 h-5" src="/images/providers/dark/leap0.svg" alt="" />
<span className="font-semibold">Leap0</span>
</a>
</div>
:::

Expand Down
122 changes: 122 additions & 0 deletions src/oss/javascript/integrations/providers/leap0.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
title: "Leap0"
sidebarTitle: "Leap0"
description: "Use Leap0 sandbox backends with Deep Agents for isolated code execution with fast cold starts"
---

[Leap0](https://leap0.dev) provides cloud sandboxes for AI agents: isolated compute, filesystem, and network boundaries, with sandboxes that start in about 200ms. See the [Leap0 docs](https://leap0.dev/docs) for signup, API keys, and platform details.

The LangChain integration is published as [`@leap0/langchain-leap0`](https://www.npmjs.com/package/@leap0/langchain-leap0). It implements the Deep Agents sandbox backend and pairs with the [`leap0`](https://www.npmjs.com/package/leap0) TypeScript SDK.

## Setup

<CodeGroup>
```bash npm
npm install @leap0/langchain-leap0 deepagents leap0
```

```bash yarn
yarn add @leap0/langchain-leap0 deepagents leap0
```

```bash pnpm
pnpm add @leap0/langchain-leap0 deepagents leap0
```
</CodeGroup>

`@leap0/langchain-leap0` declares **peer dependencies** on `deepagents` and `leap0`; install them alongside the integration package as shown above.

### Authentication

```bash
export LEAP0_API_KEY="your-key"
```

## Create a sandbox backend

Create a sandbox with the Leap0 SDK, then connect it with `Leap0Sandbox.fromConnected`.

:::js
```typescript
import { Leap0Client } from "leap0";
import { Leap0Sandbox } from "@leap0/langchain-leap0";

const client = new Leap0Client();
const sandbox = await client.sandboxes.create();
const backend = Leap0Sandbox.fromConnected(client, sandbox);

try {
const result = await backend.execute("echo 'Hello from Leap0'");
console.log(result.output);
} finally {
try {
await sandbox.delete();
} finally {
await client.close();
}
}
```
:::

### One-step create

To have the integration create a `Leap0Client`, provision a sandbox, and own teardown:

:::js
```typescript
import { Leap0Sandbox } from "@leap0/langchain-leap0";

const backend = await Leap0Sandbox.create({
leap0Config: {},
createParams: { templateName: "base" },
});

try {
const result = await backend.execute("echo hello");
console.log(result.output);
} finally {
await backend.close(); // deletes sandbox and closes the client
}
```
:::

## Usage with Deep Agents

:::js
```typescript
import { createDeepAgent } from "deepagents";
import { ChatAnthropic } from "@langchain/anthropic";
import { Leap0Sandbox } from "@leap0/langchain-leap0";
import { Leap0Client } from "leap0";

const client = new Leap0Client();
const sandbox = await client.sandboxes.create();
const backend = Leap0Sandbox.fromConnected(client, sandbox);

try {
const agent = createDeepAgent({
model: new ChatAnthropic({ model: "claude-sonnet-4-20250514" }),
systemPrompt: "You are a coding assistant with sandbox access.",
backend,
});

const result = await agent.invoke({
messages: [
{ role: "user", content: "Create a hello world Python script and run it" },
],
});
} finally {
try {
await sandbox.delete();
} finally {
await client.close();
}
}
```
:::

## Cleanup

You are responsible for managing the sandbox lifecycle via the Leap0 SDK unless you use `Leap0Sandbox.create` and `backend.close()` as above.

See also: [Sandboxes](/oss/deepagents/sandboxes).
6 changes: 6 additions & 0 deletions src/oss/javascript/integrations/sandboxes/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ Sandboxes provide isolated execution environments for running agent-generated co
<img className="w-5 h-5" src="/images/brand/docs-favicon.png" alt="" />
<span className="font-semibold">LangSmith</span>
</a>

<a href="/oss/integrations/providers/leap0" className="flex items-center justify-center gap-1.5 p-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 no-underline">
<img className="block dark:hidden w-5 h-5" src="/images/providers/light/leap0.svg" alt="" />
<img className="hidden dark:block w-5 h-5" src="/images/providers/dark/leap0.svg" alt="" />
<span className="font-semibold">Leap0</span>
</a>
</div>

If you'd like to contribute a sandbox, see [Implement a sandbox integration](/oss/contributing/implement-langchain#sandboxes).
13 changes: 13 additions & 0 deletions src/oss/python/integrations/providers/leap0.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "Leap0 integrations"
sidebarTitle: "Leap0"
description: "Integrate with Leap0 using LangChain Python."
---

[Leap0](https://leap0.dev) provides cloud sandboxes for AI agents: isolated compute, filesystem, and network boundaries, with sandboxes that start in about 200ms. See the [Leap0 docs](https://leap0.dev/docs) for signup, API keys, and platform details.

<Columns cols={2}>
<Card title="Leap0Sandbox" href="/oss/integrations/sandboxes/leap0" cta="Get started" icon="terminal" arrow>
Leap0 sandbox backend for Deep Agents.
</Card>
</Columns>
6 changes: 6 additions & 0 deletions src/oss/python/integrations/sandboxes/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ Sandboxes provide isolated execution environments for running agent-generated co
<img className="w-5 h-5" src="/images/brand/docs-favicon.png" alt="" />
<span className="font-semibold">LangSmith</span>
</a>

<a href="/oss/integrations/sandboxes/leap0" className="flex items-center justify-center gap-1.5 p-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 no-underline">
<img className="block dark:hidden w-5 h-5" src="/images/providers/light/leap0.svg" alt="" />
<img className="hidden dark:block w-5 h-5" src="/images/providers/dark/leap0.svg" alt="" />
<span className="font-semibold">Leap0</span>
</a>
</div>

If you'd like to contribute a sandbox, see [Implement a sandbox integration](/oss/contributing/implement-langchain#sandboxes).
80 changes: 80 additions & 0 deletions src/oss/python/integrations/sandboxes/leap0.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: "Leap0Sandbox integration"
description: "Integrate with the Leap0Sandbox sandbox backend using LangChain Python."
---

[Leap0](https://leap0.dev) provides cloud sandboxes for AI agents: isolated compute, filesystem, and network boundaries, with sandboxes that start in about 200ms. See the [Leap0 docs](https://leap0.dev/docs) for signup, API keys, and platform details.

Set `LEAP0_API_KEY` in your environment before running the examples below.

## Installation

<CodeGroup>
```bash pip
pip install langchain-leap0
```

```bash uv
uv add langchain-leap0
```
</CodeGroup>

## Create a sandbox backend

In Python, you create the sandbox using the provider SDK, then wrap it with the [deepagents backend](/oss/deepagents/backends).

```python
from leap0 import Leap0Client

from langchain_leap0 import Leap0Sandbox

client = Leap0Client()
sandbox = client.sandboxes.create()
backend = Leap0Sandbox(client=client, sandbox=sandbox)

try:
result = backend.execute("echo hello")
print(result.output)
finally:
client.sandboxes.delete(sandbox)
client.close()
```

## Use with Deep Agents

```python
from leap0 import Leap0Client
from langchain_anthropic import ChatAnthropic

from deepagents import create_deep_agent
from langchain_leap0 import Leap0Sandbox

client = Leap0Client()
sandbox = client.sandboxes.create()
backend = Leap0Sandbox(client=client, sandbox=sandbox)

agent = create_deep_agent(
model=ChatAnthropic(model="claude-sonnet-4-20250514"),
system_prompt="You are a coding assistant with sandbox access.",
backend=backend,
)

try:
result = agent.invoke(
{
"messages": [
{"role": "user", "content": "Create a hello world Python script and run it"}
]
}
)
finally:
client.sandboxes.delete(sandbox)
client.close()
```

## Cleanup

You are responsible for managing the sandbox lifecycle via the Leap0 SDK.
When you are done, delete the sandbox and close the client.

See also: [Sandboxes](/oss/deepagents/sandboxes).
45 changes: 45 additions & 0 deletions src/snippets/deepagents-sandbox-basic-py.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,49 @@
```

</Tab>
<Tab title="Leap0">

<CodeGroup>
```bash pip
pip install langchain-leap0
```

```bash uv
uv add langchain-leap0
```
</CodeGroup>

```python
from deepagents import create_deep_agent
from langchain_anthropic import ChatAnthropic
from langchain_leap0 import Leap0Sandbox
from leap0 import Leap0Client

client = Leap0Client()
sandbox = client.sandboxes.create()
backend = Leap0Sandbox(client=client, sandbox=sandbox)

agent = create_deep_agent(
model=ChatAnthropic(model="claude-sonnet-4-6"),
system_prompt="You are a Python coding assistant with sandbox access.",
backend=backend,
)

try:
result = agent.invoke(
{
"messages": [
{
"role": "user",
"content": "Create a small Python package and run pytest",
}
]
}
)
finally:
client.sandboxes.delete(sandbox)
client.close()
```

</Tab>
</Tabs>
Loading