Skip to content

microagent run

microagent run --image <ref> --exec "<command>" [flags]

run is the one-shot path. Microagent fetches the image, builds a rootfs, boots the VM, runs --setup then --exec, prints the result, and removes scratch state (unless --keep is set).

FlagDescription
--image <ref>OCI image reference
--exec <command>Shell command to run
--setup <command>Shell command to run before --exec. Repeatable
--entrypoint <command>Command to run on start
--env KEY=VALUEGuest environment variable. Repeatable
--disk n=p:/m:ro|rwAttach an existing ext4 disk
--bundle n=p:/m:ro|rwBuild a disk from a tar bundle
--name <name>Workspace name; generated when omitted
--kernel <path>Custom kernel path
--state-dir <dir>State directory (default ~/.microagent/)
--memory <MiB>Memory in MiB (default 512)
--cpus <n>CPU count
--size-mib <MiB>Rootfs disk size
--timeout <seconds>Maximum wall-clock time before kill
--keepKeep state after the command exits
--mke2fs <path>mke2fs binary path
--supervisor <path>Override the Apple VF supervisor path

Run a single command:

Terminal window
microagent run \
--image docker.io/library/ubuntu:24.04 \
--exec "uname -a"

Run setup commands first:

Terminal window
microagent run \
--image docker.io/library/busybox:1.36 \
--setup "mkdir -p /workspace" \
--setup "echo ready > /workspace/status" \
--exec "cat /workspace/status"

Use a custom kernel:

Terminal window
microagent run \
--image docker.io/library/ubuntu:24.04 \
--exec "uname -a" \
--kernel /tmp/Image