Docs menu

Ship

Headless mode

midas run is the agent without the terminal UI. It takes one task, runs it to completion, and prints the result. Use it in a script, a pipeline, or CI.

Run one task

midas run "review the diff on this branch for security issues"
midas run "add tests for src/billing.ts and run them"
midas run "summarize this log and name the first failure" --file ./build.log

The task is the message. Everything the interactive agent can do is available, subject to the same permissions. Add --auto to auto-approve actions that are not explicitly denied.

If Claude Code, Codex, or another agent runs Midas for you, add the rule set so it does not pin a model or tell Midas which one to use.

Machine output

midas run "list the endpoints that lack auth" --format json

The JSON format emits structured events instead of formatted text, so a script can read the result without parsing ANSI output. Use --title to name the session and make it easier to find later.

When a permission is blocked

A headless run has nobody to answer a permission prompt, so Midas rejects the request. The run can stop without an answer and still exit 0, so do not treat exit 0 as proof the work finished. Check the output. Midas prints auto-rejecting to stderr when this happens.

Pipes and files

cat error.log | midas run "find the first exception and explain it"
midas run "compare these two configs" --file a.json --file b.json

A file is attached to the message. Piped stdin works the way it does with any other command, so you can put midas run in a pipeline.

Continue a session

midas run "now add the missing cases" --continue
midas run "finish the migration" --session SESSION_ID

A headless run is still a session. It shows up in midas session list and the dashboard, and you can continue it later.

Run against a server

midas serve
midas run --attach http://127.0.0.1:4096 "run the tests"
midas attach http://127.0.0.1:4096

Use midas serve to run the server alone, then attach a headless run or an interactive terminal to it. This is useful on a remote machine, in a container, or when two clients should share one session.

Sandboxing

On macOS and Linux, a headless run is sandboxed by default. The local OS sandbox bounds what the agent can do to the workspace and lets actions inside it run without stopping for prompts. Interactive runs are not sandboxed by default. Set MIDAS_EXPERIMENTAL_SANDBOX=false to opt out.

Windows has no local sandbox backend yet, so the same run falls back to the normal permission rules. Use a cloud sandbox when you need a clean remote machine.