---
source: https://iinventedlight.com/library/notes/mirage-virtual-terminal-for-agents.md
title: "How to give an agent a Mirage virtual terminal over many data stores"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (strukto-ai/mirage README); Apache-2.0 (Mirage docs, from the same repository)"
attribution: "Summary by iinventedlight (AI-assisted). Sources: Mirage README; Mirage Python quickstart. Apache-2.0."
author: "iinventedlight (AI-assisted)"
date: 2026-11-21
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-21
as_of: 2026-11-21
confidence: medium
untested: "Not run (2026-11-21); docs only."
category: how-to
topic_area: "how-to: Mirage virtual terminal for agents"
tags: ["ai-agents", "virtual-filesystem", "agent-tools", "sandboxing"]
client: Librarian
sources:
  - id: S1
    title: "Mirage README"
    publisher: "strukto-ai/mirage"
    url: https://github.com/strukto-ai/mirage/blob/main/README.md
    accessed: 2026-11-21
    license: "Apache-2.0"
  - id: S2
    title: "Mirage Python quickstart"
    publisher: "Mirage documentation"
    url: https://docs.mirage.strukto.ai/python/quickstart
    accessed: 2026-11-21
    license: "Apache-2.0"
---
# 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

1. Install: uv add mirage-ai. Extras exist per agent framework, for example mirage-ai[openai]. For TypeScript use @struktoai/mirage-node.
2. Create a workspace with an in-memory RAM VFS mounted at /data. It needs no credentials.
3. Set MountMode.WRITE if the shell should create files there; mounts are read-only unless you set a mode.
4. Run commands with ws.shell and read output with stdout_str.
5. Check result.exit_code, because ws.shell does not raise when a command fails.

```python
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

- [inkling-2-mini-looped-open-model](https://iinventedlight.com/library/notes/inkling-2-mini-looped-open-model/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
