Skip to main content

Mirage: A Virtual Terminal for AI Agents AgentVFS: the open, vendor-neutral virtual filesystem interface for AI agents

Status: preview DOI 10.5281/zenodo.23504502
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: one shell over data, CLIs and runtimes. Unix tools reach every service, and grep runs on each service's own search, such as Gmail's or Slack's. Mirage routes each command to the runtime that fits it, so most lines run in-process and only heavy work reaches a sandbox, which cuts infrastructure cost and tokens. The terminal itself is light: a workspace takes about 100 KB of memory and each new session about 10 KB, so one process serves many agents at once. Profiles decide what an agent can run and even what it can see, and scriptable policies refuse anything those rules cannot express.

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 alongside

Here is an example of launching Mirage inside an application:

ws = Workspace(
    {
        "/s3":    (S3VFS(S3Config(bucket="my-bucket")), MountMode.WRITE),
        "/slack": (SlackVFS(SlackConfig(token=slack_bot_token)), MountMode.EXEC),
        "/gmail": (GmailVFS(GmailConfig(**google_credentials)), MountMode.READ),
    },
    # Install the Slack CLI, run by name and listed by `man` and `which` like any program
    clis={"slack": (SLACK, {"token": slack_bot_token})},
    # the analyst profile hides /s3/secrets and denies posting to Slack and curl
    profiles={
        "analyst": {
            "paths": {"hide": ["/s3/secrets"]},
            "commands": {"deny": ["slack send-message", "curl"]},
        },
    },
    runtimes=[
        MontyRuntime(captures=["python", "python3"]),
        E2BRuntime(
            captures=["python", "python3"],
            config={"sandbox_id": sandbox_id, "mount_type": "ssh"},
        ),
    ],
    # route the underlying computation: numpy lines run in the e2b sandbox, the rest on monty
    route_policy=lambda ctx: "e2b" if "numpy" in ctx.line else None,
)

# Add an agent using the analyst profile
alice = await ws.session("alice", profile="analyst")

# one grep sweeps S3, Slack and Gmail, on each service's own search where it has one
await alice.shell("grep -rlw invoice /s3 /slack /gmail")

# run a script that lives in Slack on monty, file the report into S3
await alice.shell("python3 /slack/channels/general__C0123/2026-10-21/files/report__F0456.py > /s3/report.txt")

# numpy is not in monty, so the route policy sends this line to e2b
await alice.shell("python3 -c 'import numpy; print(numpy.arange(10).sum())'")

And what alice sees in the shell:

$ grep -rlw invoice /s3 /slack /gmail
/s3/billing/2026-10.csv
/gmail/INBOX/2026-10-21/Invoice_1042__18f3a9c2b7d1e0f4.gmail.json
$ ls /s3
billing
report.txt
$ cat /s3/secrets/aws.txt
cat: /s3/secrets/aws.txt: No such file or directory
$ slack send-message --channel general --text "report is up"
slack: Permission denied

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.
  • Lightweight by design. A workspace, the virtual terminal itself, takes about 100 KB of memory and each new session about 10 KB, so one process serves many agents without a container or VM per agent.
  • 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.

VFS
Object Storage Amazon 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 Documents Google Drive  Google Docs  Google Sheets  Google Slides  OneDrive  SharePoint  Box  Dropbox  Nextcloud
Messaging and Work Slack  Discord  Gmail  IMAP / SMTP email  GitHub  Linear  Notion  Trello  Google Calendar
Databases and Data Platforms PostgreSQL  MongoDB  Redis Upstash Redis  LanceDB  Qdrant  Chroma  Mem0  Hugging Face Datasets  Hugging Face Models  Hugging Face Spaces  Databricks Volumes  Dify
Observability Langfuse  Jaeger
Local and Remote RAM  Disk  OPFS  SSH

Agents reach it through the Python and TypeScript SDKs, the mirage CLI, or a real mountpoint over FUSE and FSKit, then work it with the unix tools they already know, like ls, grep, find and jq.

Virtual Command Line Tool

These command line tools are virtualized: Mirage answers git, slack or ntn itself, so an agent drives the service without that program being installed on the machine. Each one mimics the real tool, so an agent that knows the CLI needs nothing new. Because they are virtual, the same tool can be installed more than once under different names, each with its own credentials, so every agent gets exactly the accounts it is given.

CLIs
Code git  gh
Communication slack  discord  himalaya
Work and Data linear  ntn  gws  hf

Virtual Runtime

Runtimes are virtualized the same way, and not only for coding languages. Any command on the line can be redirected to a configured runtime, so Python might run in-process with Monty while another command, say kubectl, is sent to a remote machine over SSH. Which runtime serves a given line can be decided by a scripted runtime router.

Runtimes
Python Monty  WASI CPython on wasmtime  Pyodide  sandlock  Host CPython
JavaScript QuickJS, serving node and js JavaScript TypeScript
Sandboxes Docker  E2B  Daytona  smolVM Apple Container  SSH

Security

A profile decides what a session may run and what it may see. Commands are governed by customizable allow, ask and deny rules, and paths by hide and show, so a hidden file is not merely unreadable but absent from the filesystem the agent sees. For anything those rules cannot express, a profile can name a policy script that runs at the gate on every command and answers allow, deny or ask itself, though like every rule it can only restrict and never grant. Separately, a host can register its own policies on the policy engine, an ordered stack the workspace consults on every command, VFS op and session write. See the policy docs.

Authentication

Credentials and authentication integrate with the stores secrets already live in, including AWS Secrets Manager, 1Password, Auth0 and dotenv, so an environment variable in Mirage can resolve straight to a credential held in one of them.

Sources
Built in Environment dotenv AWS Secrets Manager
Custom 1Password Auth0

Installation

  • Python ≥ 3.12 for the mirage-ai package and the mirage CLI
  • Node.js 22.20+ on Node 22, 24.12+ on Node 24, or 25+ for the TypeScript SDK

Python

uv add mirage-ai              # installs the `mirage` library and the `mirage` CLI binary
uv add 'mirage-ai[openai]'    # OpenAI Agents adapter; each agent framework is an extra

TypeScript

npm install @struktoai/mirage-node      # Node.js servers and CLIs
npm install @struktoai/mirage-browser   # browser / edge runtimes
npm install @struktoai/mirage-vercel    # Vercel AI adapter; each agent framework has its own package

Both runtime packages pull in @struktoai/mirage-core automatically.

CLI

npm install -g @struktoai/mirage-cli
# or
uvx --from mirage-ai mirage
# or
npx @struktoai/mirage-cli

To get started, see the quickstarts for Python, TypeScript and the CLI.

Scriptable Policy

A profile can name policy scripts for what its rules cannot express. A script reads the command as JSON, can open the files it names, and prints a deny, an ask or nothing. This one disables rm, and a Python script whose code deletes files:

import json, os

ctx = json.loads(os.environ["MIRAGE_POLICY_CTX"])


def deletes(path):
    try:
        code = open(path).read()
    except OSError:
        return False
    return any(call in code for call in ("os.remove", "os.unlink", "shutil.rmtree"))


if ctx["command"] == "rm" or (
    ctx["command"].startswith("python") and any(deletes(p) for p in ctx["paths"])
):
    print(json.dumps({"kind": "deny", "reason": "deleting files is disabled"}))

Register it in a profile, here to run on Monty before every command:

ws = Workspace(
    {"/s3": (S3VFS(S3Config(bucket="my-bucket")), MountMode.WRITE)},
    profiles={
        "analyst": {
            "policy": {
                "pre_command": [{"script": ScriptSource(Path("guard.py").read_text()), "runtime": "monty"}],
            },
        },
    },
    profile="analyst",
)
$ cat /s3/clean.py
import os
os.remove("/s3/report.txt")
$ rm /s3/report.txt
rm: Permission denied
$ python3 /s3/clean.py
python3: Permission denied

See policy scripts for the other stages a script can answer at.

Embedded Terminal

Most of the time an agent does not need a sandbox, only a terminal-like interface, and Mirage embeds one in an application server. Each terminal is a Mirage session with its own working directory, environment and history, and Python runs in-process on Monty, so a terminal starts with no container or VM. Here it is in Express; the FastAPI version is in the docs.

npm install @struktoai/mirage-node @pydantic/monty express
import express from 'express'
import { MontyRuntime, MountMode, RAMVFS, Workspace } from '@struktoai/mirage-node'

const ws = new Workspace(
  { '/work': new RAMVFS() },
  { mode: MountMode.EXEC, runtimes: [new MontyRuntime({ captures: ['python', 'python3'] })] },
)
const app = express()
app.use(express.json())

app.post('/sessions/:id', (req, res) => {
  ws.createSession(req.params.id)
  res.sendStatus(201)
})

app.post('/sessions/:id/run', async (req, res) => {
  const r = await ws.shell(req.body.command, { sessionId: req.params.id })
  res.json({ stdout: r.stdoutText, stderr: r.stderrText, exitCode: r.exitCode })
})

app.listen(3000, '127.0.0.1')

Contributors

Thanks to everyone who has contributed to Mirage.

Mirage contributors

Metadata

Release files for mirage-ai 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mirage-ai 0.0.8
File Size Uploaded Provenance Actions
mirage_ai-0.0.8.tar.gz 4.4 MB Without provenance Details for mirage_ai-0.0.8.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mirage-ai 0.0.8
File Actions
mirage_ai-0.0.8-cp312-abi3-win_arm64.whl CPython 3.12 abi3 Windows ARM64 Details for mirage_ai-0.0.8-cp312-abi3-win_arm64.whl
mirage_ai-0.0.8-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for mirage_ai-0.0.8-cp312-abi3-win_amd64.whl
mirage_ai-0.0.8-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details for mirage_ai-0.0.8-cp312-abi3-musllinux_1_2_x86_64.whl
mirage_ai-0.0.8-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details for mirage_ai-0.0.8-cp312-abi3-musllinux_1_2_aarch64.whl
mirage_ai-0.0.8-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for mirage_ai-0.0.8-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
mirage_ai-0.0.8-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for mirage_ai-0.0.8-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
mirage_ai-0.0.8-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for mirage_ai-0.0.8-cp312-abi3-macosx_11_0_arm64.whl
mirage_ai-0.0.8-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for mirage_ai-0.0.8-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 77.4 MB

Release files / mirage_ai-0.0.8.tar.gz

Download URL mirage_ai-0.0.8.tar.gz
Size 4.4 MB
Tags Source
SHA-256 checksum
How to use checksums
76ec7c766ea2cddfc7182bcf9a18409058a5c5dd95d89862a46de9b8c6cc5b14
BLAKE2b-256 checksum
How to use checksums
5600c8374fc09ae368cc22c5d94f2e1a92be99932601e8629dba5834193068d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mirage_ai-0.0.8-cp312-abi3-win_arm64.whl

Download URL mirage_ai-0.0.8-cp312-abi3-win_arm64.whl
Size 9.1 MB
Tags CPython 3.12 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
a126d80a15347b5b0142db8cc4eb7994ded63ddf7fc69bb08879d42f5e0e3aa4
BLAKE2b-256 checksum
How to use checksums
c8c09fa9ff358af9861eb1a5ea22258b587c30152947adff4529891b475d42cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mirage_ai-0.0.8-cp312-abi3-win_amd64.whl

Download URL mirage_ai-0.0.8-cp312-abi3-win_amd64.whl
Size 9.3 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b0ece22b5115161cb74af322b29d769f47ca0985ca2c2bfcbaea1a41c877ac2c
BLAKE2b-256 checksum
How to use checksums
25766cdbbf5f780ea22e0b5b9b17347c6d0da37d2d40f5ba66ac825c709e9f45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mirage_ai-0.0.8-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL mirage_ai-0.0.8-cp312-abi3-musllinux_1_2_x86_64.whl
Size 9.4 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
0a782a8de43ffa647a32f062bbf2fcb503e9326c67bb961c0950e7e49c76816f
BLAKE2b-256 checksum
How to use checksums
42d38c5d19d8cd7445d1712854242ba8bec27c7aa007138f086512782cfdf696
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mirage_ai-0.0.8-cp312-abi3-musllinux_1_2_aarch64.whl

Download URL mirage_ai-0.0.8-cp312-abi3-musllinux_1_2_aarch64.whl
Size 9.1 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
ce4c93ea80d9ea829138229f659b1e5aaf134ef3e3e4f65ae23bcf8b1299a1ee
BLAKE2b-256 checksum
How to use checksums
e47ca607a9e54bd30e10c3ce534987448a9daa73e9cb0756a871171ddd52c16b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mirage_ai-0.0.8-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL mirage_ai-0.0.8-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 9.2 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c43677f6003dde5a0d944acfb80470c792111ce3312b621acc09ca4cb2caa9ce
BLAKE2b-256 checksum
How to use checksums
743560b1e56b93110eba1f476824de1a4cd6d0b13bee04a7254143b5496bf215
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mirage_ai-0.0.8-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL mirage_ai-0.0.8-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 8.9 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
c40781486bcfc2f7bc654f307fede517fc2df35d189c89f129e2a8d37034a663
BLAKE2b-256 checksum
How to use checksums
bf41d0bc46f7193681db3538fd514f8437fdd6afe6d39eb400cbbfc429646d13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mirage_ai-0.0.8-cp312-abi3-macosx_11_0_arm64.whl

Download URL mirage_ai-0.0.8-cp312-abi3-macosx_11_0_arm64.whl
Size 8.8 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5daf9911b09d71964b1602d303c3b6896652d620941bb5d63fb99b90000267b2
BLAKE2b-256 checksum
How to use checksums
a984a1ee04dd5353d5c92bfdc64d3860bb697729e2e1673ea9ce2c0651b6a4ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mirage_ai-0.0.8-cp312-abi3-macosx_10_12_x86_64.whl

Download URL mirage_ai-0.0.8-cp312-abi3-macosx_10_12_x86_64.whl
Size 9.1 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c53787c25f9bd4da79e83a3d72a487d7e748ddbc1ce98eabf1f2b0b826e80c3e
BLAKE2b-256 checksum
How to use checksums
1cef83c603fbb40096af927d1c167f4be8b322281313569b42f9a411d2809da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for mirage-ai 0.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page