Use this file to discover all available pages before exploring further.
The shell is how agents act on the workspace. execute() parses a bash-style command, looks up the target session, resolves mounts, runs the executor, applies I/O side effects, and records history.
Per-call cwd / env / cancel are SDK-only as named flags. From the CLI, use bash subshell syntax inside the command string for per-call scoping (see below) and mirage job cancel to stop background work.
Providing cwd or env runs the command in an ephemeral session clone, like a bash subshell (cd /data && cmd). Mutations like cd or export inside the call do NOT persist back to the workspace’s session. To change persistent state, run the command without these options.
Python
TypeScript
CLI
# Persistent mutation (no options): like `cd /data; cmd`await ws.execute("cd /data")await ws.execute("ls") # sees /data# One-shot subshell (with cwd): like `(cd /data && cmd)`await ws.execute("ls", cwd="/data")# ws.cwd is unchanged; mutations inside don't leak
# Use a real bash subshell inside the command stringmirage execute -w demo -c "(cd /data && ls)"mirage execute -w demo -c "(export FOO=bar; printenv FOO)"
The CLI doesn’t have --cwd / --env flags, but bash subshell syntax (cd ... && cmd) and (export FOO=bar; cmd) give the same per-call isolation. Mutations inside the parens don’t leak.
This makes per-call overrides safe under concurrent calls on the same session. Two parallel execute() calls with different cwd see their own cwd without cross-contamination, even on the same session.
Both bindings support cooperative cancellation observed at recursion boundaries (LIST, PIPELINE, FOR/WHILE/UNTIL iterations, COMMAND, subshells, command substitution) and inside sleep. On cancel, the call raises an abort error.
Agent harnesses commonly fan out tool calls in parallel, each with its own cwd/env/cancel. The clone semantics make this race-free without per-call boilerplate.