Sandbox
@strukto-ai/mirage

Virtual terminal for AI agents

Mirage gives agents one terminal that ties together a virtual filesystem, virtual command-line tools, and routed runtimes. That means files from services like Slack, Redis, or cloud storage can appear under one root and be handled with normal shell commands. It also adds profiles, allow/ask/deny rules, hidden files, and a policy engine so agent actions can be controlled before they run. The repo ships TypeScript and Python SDKs plus examples, docs, and conformance tests.

3,617 stars262 forksTypeScriptUpdated 6d ago
Who it's for

Builders who want their agent to work inside a controlled shell with mounted data sources and virtual tools.

What it delivers

You can let an agent inspect files, run commands, and touch external systems through one sandboxed terminal instead of stitching together separate tools.

What it does

Virtual filesystem mounts

Mount sources like S3, Google Drive, Slack, Gmail, Redis, and databases under one root so agents use POSIX-style commands on all of them.

Virtual CLIs

Answer commands like `git`, `slack`, or `ntn` inside Mirage, with tools dispatched by name and routed to the right backend.

Routed runtimes

Send Python, JavaScript, or other commands to in-process, sandboxed, or remote runtimes without changing the workspace layout.

Agent shell

Combine filesystem access, CLIs, pipes, redirection, variables, jobs, and history into one shell experience for agents.

Profiles and file visibility controls

Use `allow`, `ask`, `deny`, `hide`, and `show` rules to control what commands run and what files an agent can see.

Policy engine

Block dangerous actions before they run and gate filesystem operations and session writes through the same policy layer.

Notifications from mounted services

Turn external changes into filesystem events so agents can react to new messages or updates without rescanning.

TypeScript and Python SDKs

Use the SDKs and examples to embed Mirage into applications and define workspaces, resources, mounts, and runtimes.

How to get it

  1. 1Run
    uv add mirage-ai    # installs the `mirage` library and the `mirage` CLI binary
  2. 2Run
    npm install @struktoai/mirage-node      # Node.js servers and CLIs
    npm install @struktoai/mirage-browser   # browser / edge runtimes
    npm install @struktoai/mirage-agents    # OpenAI / Vercel AI / LangChain / Mastra adapters
  3. 3Run
    curl -fsSL https://strukto.ai/mirage/install.sh | sh
    # or
    npm install -g @struktoai/mirage-cli
    # or
    uvx mirage-ai
    # or
    npx @struktoai/mirage-cli
  4. 4Run
    mirage workspace create ws.yaml --id demo
    mirage execute   --workspace_id demo --command "cp /s3/report.csv /data/report.csv"
    mirage provision --workspace_id demo --command "cat /s3/data/large.jsonl"
    mirage workspace snapshot demo demo.tar
    mirage workspace load demo.tar --id demo-restored

README

Mirage: A Virtual Terminal for AI AgentsMirage: A Virtual Terminal for AI Agents

Status: preview
Python docs
TypeScript docs

README in English 简体中文 README 繁體中文 README README en Français README auf Deutsch README Tiếng Việt README 한국어

Mirage is a Virtual Terminal for AI Agents. The virtual filesystem delivers broad data context, virtualized CLIs give an agent more flexibility on tool use, dynamic runtimes save underlying infrastructure cost and are more token efficient, and fine-grained control over an agent's actions and even over what it can see gives the best security. Together these parts form one virtualized terminal, giving the best agent performance, cost efficiency and security.

Mirage architecture: agents and harness reach profiles and the Mirage shell, which resolve Unix-like commands, virtual CLIs and programming languages onto runtimes and the virtual filesystem, with authentication, the policy engine and notifications alongsideMirage architecture: agents and harness reach profiles and the Mirage shell, which resolve Unix-like commands, virtual CLIs and programming languages onto runtimes and the virtual filesystem, with authentication, the policy engine and notifications alongside

Here is an example of launching Mirage inside an application:

ws = Workspace(
    {
        "/tmp":   (RAMResource(), MountMode.EXEC),
        "/redis": (RedisResource(url=redis_url), MountMode.WRITE),
        "/slack": (SlackResource(SlackConfig(token=slack_bot_token)), MountMode.EXEC),
    },
    # monty captures python, so scripts run sandboxed inside the workspace
    runtimes=[MontyRuntime(captures=["python", "python3"]), "vfs"],
)

# one grep sweeps every source
await ws.execute("grep -rln session /redis /tmp")

# run a script that lives in Slack, file the report into Redis
await ws.execute("python3 /slack/channels/general_.../files/example__F....py > /redis/report.txt")

# install a typed CLI under a head word: dispatched by name, not by path,
# and discoverable through `man`, `type` and `which` like any other program
ws.register_cli("slack", SLACK, {"token": slack_bot_token})
await ws.execute('slack send-message --channel general --text "report is up"')

About

  • Unified virtual terminal interface, not N SDKs and M MCPs. Every backend speaks the same filesystem semantics, so pipelines compose across services.
  • A virtual filesystem over every source. S3, Google Drive, Slack, Gmail, Redis and the rest mount side by side under one root, so an agent reaches all of them through a unified interface with the unix tools it already knows, like ls, grep, find and jq.
  • Virtual command line tools (CLIs). git, slack and ntn are answered by Mirage itself, so an agent drives the service with nothing installed, across different runtimes and machines, and one tool can be virtualized into two or more, each under its own name with its own credentials.
  • Routed, dynamic runtimes. Python, JavaScript and any other command can be sent to a configured runtime, in process, sandboxed or remote, which decouples computation from storage and lets either change without touching the other.
  • The virtualized Mirage shell. It binds the filesystem, the CLIs and the runtimes into one command line, so pipes, redirection, variables, jobs and history work across all three.
  • Profiles designed for agents. allow, ask and deny govern commands and CLIs, while hide and show govern files and folders, so a hidden path is not merely unreadable but absent from the filesystem the agent sees.
  • A scriptable policy engine. A policy script can prohibit any dangerous action before it runs, and the same stack gates every VFS op and session write, so neither a file nor an environment variable leaks.
  • Notifications wired into the VFS and agents. External changes become an event stream on the mount, so a new Slack reply surfaces as a change to the chat file in the virtual filesystem, and the agent reacts to it instead of rescanning the tree.

Virtual Filesystem

Everything Mirage "mounts" as one unified virtual filesystem for AI agents. Each service sits side-by-side under a single root and answers the same POSIX semantics.

Resources
Object StorageAmazon S3  Cloudflare R2  Google Cloud Storage  Oracle OCI  Supabase Storage  MinIO  Ceph  SeaweedFS  Wasabi  Backblaze B2  DigitalOcean Spaces  Alibaba Cloud OSS  Tencent Cloud COS  Scaleway  QingStor  Hugging Face Buckets  GridFS
Files and DocumentsGoogle Drive  Google Docs  Google Sheets  Google Slides  OneDrive  SharePoint  Box  Dropbox  Nextcloud
Messaging and WorkSlack  Discord  Gmail  IMAP / SMTP email  GitHub  Linear  Notion  Trello  Google Calendar
Databases and Data PlatformsPostgreSQL  MongoDB  Redis Upstash Redis  LanceDB  Qdrant  Chroma  Mem0  Hugging Face Datasets  Hugging Face Models  Hugging Face Spaces  Databricks Volumes  Dify

Files in the repo

Repository payload29 top-level entries
  • .agents
  • .github
  • assets
  • conformance
  • data
  • docker
  • docs
  • examples
  • integ
  • licenses
  • plugins
  • python
  • readme
  • scripts
  • spec
  • typescript
  • .dockerignore
  • .env.example
  • .gitignore
  • .isort.cfg
  • .pre-commit-config.yaml
  • AGENTS.md
  • CITATION.cff
  • CLAUDE.md
  • CONTRIBUTING.md
  • LICENSE
  • README.md
  • ruff.toml
  • SECURITY.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More frameworks & sdks

HKUDS/nanobotFrameworks & SDKs

Ultra-lightweight, open-source, self-hosted personal AI agent framework in Python with WebUI, tools, memory, MCP, multi-agent workflows, automation, and chat apps

48k
microsoft/
SkillOpt
microsoft/SkillOptFrameworks & SDKs

SkillOpt is a text-space optimizer that trains reusable natural-language skills for frozen LLM agents through trajectory-driven edits, validation-gated updates, and deployable best_skill.md artifacts.

17k
omnigent-ai/omnigentFrameworks & SDKs

Omnigent is an open-source AI agent framework and meta-harness: orchestrate Claude Code, Codex, Cursor, Pi, and custom agents — swap harnesses without rewriting, enforce policies and sandboxing, and collaborate in real time from any device.

9.8k
kyegomez/
OpenMythos
kyegomez/OpenMythosFrameworks & SDKs

A theoretical reconstruction of the Claude Mythos architecture, built from first principles using the available research literature.

15k
D4Vinci/ScraplingFrameworks & SDKs

🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!

80k