Skip to main content
Claude Managed Agents runs the agent loop on Anthropic’s servers. In a self-hosted environment, a worker on private infrastructure runs the agent’s tool calls. mirage_tools(ws) gives that worker Mirage’s bash, read, write, edit, glob and grep, so every call runs in the workspace, under its profile, mounts and policies. The worker only connects out to Anthropic.

Install

Usage

Create a self-hosted environment, generate its environment key, and create an agent with the agent_toolset_20260401 toolset, as Anthropic’s guide shows. Then serve the environment’s sessions from a workspace:
The worker authenticates with the environment key alone, so the Claude API key stays off the worker’s machine. Create sessions that target the environment from anywhere else; the worker claims each one and answers its tool calls.

Tools

  • The tools keep the toolset’s names. One the session’s profile would always refuse is left out: a read-only workspace gets no write or edit.
  • bash runs Mirage’s shell, so a line sees the workspace’s mounts and commands, not the worker’s machine. A restart is refused, since the session keeps its directory and variables. A relative path resolves against the session’s working directory, which cd moves.
  • write overwrites a file only after the agent read all of it, and write and edit refuse a file that changed since the agent read it. stale_write_protection=False turns that off.
  • session_id= runs the tools as another session, with its profile.
  • web_search and web_fetch still run on Anthropic’s servers. Turn them off in the agent’s toolset to keep the agent to the workspace.

Exports

Examples

  • redis_report.py creates the agent and a session, serves the session from a RAM and Redis workspace, asks the agent to total /workspace/orders.csv into /redis/report.md, and prints the report from Redis.