Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt

Use this file to discover all available pages before exploring further.

The OpenAI Agents SDK (@openai/agents) ships shellTool and applyPatchTool primitives that take pluggable Shell and Editor backends. Mirage provides MirageShell and MirageEditor implementations that route every command and patch through your Workspace instead of the host shell.

Install

@struktoai/mirage-agents/openai is runtime-agnostic. Pair it with @struktoai/mirage-node for Node or @struktoai/mirage-browser for the browser.
pnpm add @struktoai/mirage-agents @struktoai/mirage-node @openai/agents

Usage

import { MountMode, OpsRegistry, RAMResource, Workspace } from '@struktoai/mirage-node'
import { Agent, applyPatchTool, run, shellTool } from '@openai/agents'
import { MirageEditor, MirageShell, buildSystemPrompt } from '@struktoai/mirage-agents/openai'

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 = new Agent({
  name: 'Mirage RAM Agent',
  model: 'gpt-5.5-mini',
  instructions: buildSystemPrompt({
    mountInfo: { '/': 'In-memory filesystem (read/write)' },
  }),
  tools: [
    shellTool({ shell: new MirageShell(ws) }),
    applyPatchTool({ editor: new MirageEditor(ws) }),
  ],
})

await run(agent, "Create /hello.txt with 'hi from mirage' and cat it.")

Exports

SymbolPurpose
MirageShellShell implementation; pass to shellTool({ shell }).
MirageEditorEditor implementation; pass to applyPatchTool({ editor }).
buildSystemPromptGenerates a system prompt that describes mounted paths to the model.
MIRAGE_SYSTEM_PROMPTThe default system prompt template (used by buildSystemPrompt).

Examples