ctx.workspace. Mirage’s MirageWorkspace capability supplies a Mirage session as that workspace, so workspace tools read, write and run commands across every mount.
Install
pydantic-ai-backend’s console tools without a model provider. Add the provider the agent uses (anthropic, openai, …).
Usage
ConsoleCapability’s default ruleset asks before every write and command. Mirage already judges each call through the session’s mount modes and profile, so the example allows them in the console and leaves the policy to Mirage.
Tools
MirageWorkspace adds no tools of its own. Any tool that works in ctx.workspace runs in Mirage: ConsoleCapability gives the agent ls, read_file, write_file, edit_file, glob, grep and execute, and Pydantic AI Harness capabilities such as Shell and FileSystem work the same way.
Sessions
MirageWorkspace(ws, session_id="agent") acts as a session made with ws.session, so its profile judges every call. Without session_id it acts as the workspace’s default session.
Commands run in Mirage’s shell, each in a clone of the session at its working directory, as a subshell does: a cd or an export in one command does not reach the next. Files go through the session’s ws.vfs, and symlinks resolve through the namespace. The run’s WorkspaceRef names the session; a ref in message history that names any other session is declined.
The backend passes Pydantic AI’s workspace conformance suite, except the rules that need POSIX processes (mkfifo) or mode bits: Mirage’s permissions are the session profile, not chmod.
Exports
Examples
examples/python/agents/pydantic_ai/s3_agent.py, read-only S3 exploration.examples/python/agents/pydantic_ai/s3_pdf_agent.py, native PDF input from S3.examples/python/agents/pydantic_ai/slack_pdf_agent.py, native image and PDF reads from Slack.