mirror of
https://github.com/langchain-ai/docs.git
synced 2026-08-27 02:41:59 -04:00
205 lines
6.0 KiB
Plaintext
205 lines
6.0 KiB
Plaintext
<CodeGroup>
|
|
```ts Google
|
|
import { createDeepAgent, LangSmithSandbox } from "deepagents";
|
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
import { SandboxClient } from "langsmith/sandbox";
|
|
|
|
const client = new SandboxClient();
|
|
const lsSandbox = await client.createSandbox();
|
|
|
|
try {
|
|
const agent = createDeepAgent({
|
|
model: new ChatAnthropic({ model: "google-genai:gemini-3.6-flash" }),
|
|
systemPrompt: "You are a coding assistant with sandbox access.",
|
|
backend: new LangSmithSandbox({ sandbox: lsSandbox }),
|
|
});
|
|
|
|
const result = await agent.invoke({
|
|
messages: [
|
|
{
|
|
role: "user",
|
|
content: "Create a hello world Python script and run it",
|
|
},
|
|
],
|
|
});
|
|
void result;
|
|
} finally {
|
|
await client.deleteSandbox(lsSandbox.name);
|
|
}
|
|
```
|
|
|
|
```ts OpenAI
|
|
import { createDeepAgent, LangSmithSandbox } from "deepagents";
|
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
import { SandboxClient } from "langsmith/sandbox";
|
|
|
|
const client = new SandboxClient();
|
|
const lsSandbox = await client.createSandbox();
|
|
|
|
try {
|
|
const agent = createDeepAgent({
|
|
model: new ChatAnthropic({ model: "openai:gpt-5.5" }),
|
|
systemPrompt: "You are a coding assistant with sandbox access.",
|
|
backend: new LangSmithSandbox({ sandbox: lsSandbox }),
|
|
});
|
|
|
|
const result = await agent.invoke({
|
|
messages: [
|
|
{
|
|
role: "user",
|
|
content: "Create a hello world Python script and run it",
|
|
},
|
|
],
|
|
});
|
|
void result;
|
|
} finally {
|
|
await client.deleteSandbox(lsSandbox.name);
|
|
}
|
|
```
|
|
|
|
```ts Anthropic
|
|
import { createDeepAgent, LangSmithSandbox } from "deepagents";
|
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
import { SandboxClient } from "langsmith/sandbox";
|
|
|
|
const client = new SandboxClient();
|
|
const lsSandbox = await client.createSandbox();
|
|
|
|
try {
|
|
const agent = createDeepAgent({
|
|
model: new ChatAnthropic({ model: "anthropic:claude-sonnet-4-6" }),
|
|
systemPrompt: "You are a coding assistant with sandbox access.",
|
|
backend: new LangSmithSandbox({ sandbox: lsSandbox }),
|
|
});
|
|
|
|
const result = await agent.invoke({
|
|
messages: [
|
|
{
|
|
role: "user",
|
|
content: "Create a hello world Python script and run it",
|
|
},
|
|
],
|
|
});
|
|
void result;
|
|
} finally {
|
|
await client.deleteSandbox(lsSandbox.name);
|
|
}
|
|
```
|
|
|
|
```ts OpenRouter
|
|
import { createDeepAgent, LangSmithSandbox } from "deepagents";
|
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
import { SandboxClient } from "langsmith/sandbox";
|
|
|
|
const client = new SandboxClient();
|
|
const lsSandbox = await client.createSandbox();
|
|
|
|
try {
|
|
const agent = createDeepAgent({
|
|
model: new ChatAnthropic({ model: "openrouter:openrouter:z-ai/glm-5.2" }),
|
|
systemPrompt: "You are a coding assistant with sandbox access.",
|
|
backend: new LangSmithSandbox({ sandbox: lsSandbox }),
|
|
});
|
|
|
|
const result = await agent.invoke({
|
|
messages: [
|
|
{
|
|
role: "user",
|
|
content: "Create a hello world Python script and run it",
|
|
},
|
|
],
|
|
});
|
|
void result;
|
|
} finally {
|
|
await client.deleteSandbox(lsSandbox.name);
|
|
}
|
|
```
|
|
|
|
```ts Fireworks
|
|
import { createDeepAgent, LangSmithSandbox } from "deepagents";
|
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
import { SandboxClient } from "langsmith/sandbox";
|
|
|
|
const client = new SandboxClient();
|
|
const lsSandbox = await client.createSandbox();
|
|
|
|
try {
|
|
const agent = createDeepAgent({
|
|
model: new ChatAnthropic({ model: "fireworks:accounts/fireworks/models/glm-5p2" }),
|
|
systemPrompt: "You are a coding assistant with sandbox access.",
|
|
backend: new LangSmithSandbox({ sandbox: lsSandbox }),
|
|
});
|
|
|
|
const result = await agent.invoke({
|
|
messages: [
|
|
{
|
|
role: "user",
|
|
content: "Create a hello world Python script and run it",
|
|
},
|
|
],
|
|
});
|
|
void result;
|
|
} finally {
|
|
await client.deleteSandbox(lsSandbox.name);
|
|
}
|
|
```
|
|
|
|
```ts Baseten
|
|
import { createDeepAgent, LangSmithSandbox } from "deepagents";
|
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
import { SandboxClient } from "langsmith/sandbox";
|
|
|
|
const client = new SandboxClient();
|
|
const lsSandbox = await client.createSandbox();
|
|
|
|
try {
|
|
const agent = createDeepAgent({
|
|
model: new ChatAnthropic({ model: "baseten:zai-org/GLM-5.2" }),
|
|
systemPrompt: "You are a coding assistant with sandbox access.",
|
|
backend: new LangSmithSandbox({ sandbox: lsSandbox }),
|
|
});
|
|
|
|
const result = await agent.invoke({
|
|
messages: [
|
|
{
|
|
role: "user",
|
|
content: "Create a hello world Python script and run it",
|
|
},
|
|
],
|
|
});
|
|
void result;
|
|
} finally {
|
|
await client.deleteSandbox(lsSandbox.name);
|
|
}
|
|
```
|
|
|
|
```ts Ollama
|
|
import { createDeepAgent, LangSmithSandbox } from "deepagents";
|
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
import { SandboxClient } from "langsmith/sandbox";
|
|
|
|
const client = new SandboxClient();
|
|
const lsSandbox = await client.createSandbox();
|
|
|
|
try {
|
|
const agent = createDeepAgent({
|
|
model: new ChatAnthropic({ model: "ollama:north-mini-code-1.0" }),
|
|
systemPrompt: "You are a coding assistant with sandbox access.",
|
|
backend: new LangSmithSandbox({ sandbox: lsSandbox }),
|
|
});
|
|
|
|
const result = await agent.invoke({
|
|
messages: [
|
|
{
|
|
role: "user",
|
|
content: "Create a hello world Python script and run it",
|
|
},
|
|
],
|
|
});
|
|
void result;
|
|
} finally {
|
|
await client.deleteSandbox(lsSandbox.name);
|
|
}
|
|
```
|
|
</CodeGroup>
|