Integrations
LangChain
Use Isorun sandboxes as LangChain.js tools.
The isorun/langchain entry point returns LangChain.js tools backed by a
single shared Isorun sandbox: a Python code_interpreter and a shell. Both
run in one Firecracker microVM, so state persists across agent turns.
Install
npm install isorun @langchain/core zodWith LangGraph
import { ChatOpenAI } from '@langchain/openai'
import { createReactAgent } from '@langchain/langgraph/prebuilt'
import { isorunTools } from 'isorun/langchain'
const { tools, close } = await isorunTools()
try {
const agent = createReactAgent({
llm: new ChatOpenAI({ model: 'gpt-4o' }),
tools,
})
const res = await agent.invoke({
messages: [{ role: 'user', content: 'Compute the first 100 primes and print them.' }],
})
console.log(res.messages.at(-1)?.content)
} finally {
await close()
}isorunTools() returns { tools, close }. The tools share one sandbox and
refresh its idle timer on every call, so it stays alive across turns. Call
close() when you're done to destroy it.
What gets exposed
| Tool | What it does |
|---|---|
code_interpreter(code) | Runs Python in a Firecracker microVM with internet, pip, and a full Python environment. |
shell(command) | Runs a shell command in the same sandbox. |
Options
const { tools, close } = await isorunTools({
image: 'python:3.12-slim', // any OCI image
timeoutSec: 600, // idle auto-destroy
})apiKey defaults to ISORUN_API_KEY. The underlying sandbox supports the full
SDK surface (fork, url, hibernate, snapshots); reach for the
TypeScript SDK directly when you need it.
Next steps
- OpenAI Agents for the same tools in the OpenAI Agents SDK.
- MCP server to drive sandboxes from an MCP client.
- Any OCI image to use a custom base image.