deepagents is LangChain’s framework for long-horizon coding agents. It accepts a pluggable backend for filesystem and shell operations, Mirage ships one.
Node only. The Mirage adapter is runtime-agnostic, but deepagents and the LangChain runtime depend on Node APIs.
Install
pnpm add @struktoai/mirage-agents @struktoai/mirage-node deepagents @langchain/anthropic
Usage
import { MountMode, OpsRegistry, RAMResource, Workspace } from '@struktoai/mirage-node'
import { ChatAnthropic } from '@langchain/anthropic'
import { createDeepAgent } from 'deepagents'
import {
LangchainWorkspace,
buildSystemPrompt,
extractText,
} from '@struktoai/mirage-agents/langchain'
const ram = new RAMResource()
const ops = new OpsRegistry()
for (const op of ram.ops()) ops.register(op)
const ws = new Workspace({ '/': ram }, { mode: MountMode.WRITE, ops })
const agent = createDeepAgent({
model: new ChatAnthropic({ model: 'claude-sonnet-4-6' }),
systemPrompt: buildSystemPrompt({
mountInfo: { '/': 'In-memory filesystem (read/write)' },
}),
backend: new LangchainWorkspace(ws),
})
const result = await agent.invoke({
messages: [{ role: 'user', content: 'Create /report.md and summarize.' }],
})
for (const text of extractText(result.messages)) {
console.log(text)
}
Exports
| Symbol | Purpose |
|---|
LangchainWorkspace | Backend implementation for deepagents, wires reads, writes, edits, and shell. |
extractText | Returns string[] of text blocks from an array of LangChain messages. |
buildSystemPrompt | Generates a system prompt that describes mounted paths to the model. |
Examples