How to give an agent a Mirage virtual terminal over many data stores
Answer: Mirage (strukto-ai, Apache-2.0, experimental) is a virtual terminal for AI agents. It mounts services such as S3, Slack and Gmail as folders in one virtual filesystem, so an agent uses ls, grep and jq across them. Each agent gets only the files, commands, credentials and machines its profile allows. Install it with uv add mirage-ai on Python 3.12 or newer.
Why a virtual terminal
LLMs are post-trained in terminal environments, so AI agents are most familiar with that interface. Mirage separates that interface from storage and compute. It virtualizes the shell, the filesystem, the CLIs and the machines. Per the README, one process serves many agents, with no container per agent: a workspace needs about 100 KB of memory and each new session about 10 KB.
Steps
- Install: uv add mirage-ai. Extras exist per agent framework, for example mirage-ai[openai]. For TypeScript use @struktoai/mirage-node.
- Create a workspace with an in-memory RAM VFS mounted at /data. It needs no credentials.
- Set MountMode.WRITE if the shell should create files there; mounts are read-only unless you set a mode.
- Run commands with ws.shell and read output with stdout_str.
- Check result.exit_code, because ws.shell does not raise when a command fails.
import asyncio
from mirage import MountMode, Workspace
from mirage.vfs.ram import RAMVFS
async def main() -> None:
ws = Workspace({"/data": RAMVFS()}, mode=MountMode.WRITE)
await ws.shell('echo \'{"name": "alice"}\' > /data/user.json')
name = await ws.shell('jq -r ".name" /data/user.json')
print(await name.stdout_str(), end="")
await ws.close()
asyncio.run(main())
Mount real services and limit an agent
An example workspace uses S3, Slack and Gmail with an analyst profile. That profile hides /s3/secrets and denies slack send-message and curl. One grep then sweeps S3, Slack and Gmail for the alice session using that profile. A hidden path is absent from what the agent sees, not merely unreadable. Each command is recorded and can be exported as an OpenTelemetry trace.
Virtual CLIs and machines
Mirage itself answers tools such as git, slack and ntn, with nothing installed. Python and other commands can be routed to a configured machine, in process, sandboxed or remote. A policy script with a pre_command hook can return a deny or an ask before a command runs.
See also
Claims
- id: C1 claim: Mirage describes itself as a virtual terminal for AI agents. source: S1 evidence: "Mirage is a virtual terminal for AI agents"
- id: C2 claim: The quickstart requires a recent Python version. source: S2 evidence: "Use Python 3.12 or newer."
- id: C3 claim: Mounts default to read-only. source: S2 evidence: "Mounts are read-only unless you set a mode."
Sources
- [S1] https://github.com/strukto-ai/mirage/blob/main/README.md (Apache-2.0)
- [S2] https://docs.mirage.strukto.ai/python/quickstart (Apache-2.0)
License: CC BY 4.0. Summary by iinventedlight (AI-assisted). Sources: Mirage README; Mirage Python quickstart. Apache-2.0.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Mirage README; Mirage Python quickstart. Apache-2.0.
Cite this
iinventedlight. 2026. "How to give an agent a Mirage virtual terminal over many data stores." iinventedlight Library, iil:note:x7f01wqe, version of 2026-11-21. https://iinventedlight.com/library/notes/mirage-virtual-terminal-for-agents/. License: CC-BY-4.0.
@misc{iil_note_x7f01wqe,
author = {{iinventedlight}},
title = {{How to give an agent a Mirage virtual terminal over many data stores}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-21},
url = {https://iinventedlight.com/library/notes/mirage-virtual-terminal-for-agents/},
note = {Permanent ID iil:note:x7f01wqe. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/mirage-virtual-terminal-for-agents.md.