Execute Mode
Use -x or --execute to start the CLI in execute mode. In this mode, it sends the message
provided to -x to the agent, waits until the agent ends its turn, prints its final message, and
exits:
$ amp -x "what files in this folder are markdown files? Print only the filenames."
README.md
AGENTS.md You can also pipe input when using -x:
$ echo "what package manager is used here?" | amp -x
cargo Interactive CLI threads remember whether the last thread used Fast mode. Execute mode and other
noninteractive thread creation default to Standard mode each time. Pass --fast to enable Fast
mode for one invocation. It is an alias for --features fast and works with -x and piped input.
Execute mode is automatically turned on when you redirect stdout:
$ echo "what is 2+2?" | amp > response.txt When you pipe input and provide a prompt with -x, the agent can see both:
$ cat ~/.vimrc | amp -x "which colorscheme is used?"
The colorscheme used is **gruvbox** with dark background and hard contrast.
```vim
set background=dark
let g:gruvbox_contrast_dark = "hard"
colorscheme gruvbox
``` You can use the --mcp-config flag with -x commands to specify an MCP server without changing
your settings file:
$ amp --mcp-config '{"everything": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"]}}' -x "What tools are available to you?" If your plugins rely on the agent.start and agent.end lifecycle
events, use the --plugin-ready-timeout flag to make execute mode wait for plugins to become ready
before running the turn. Without it, the turn can start before plugins finish loading, and those
events are skipped. The bare flag waits up to 10 seconds. Pass a number of seconds for a different
limit. The maximum is 300, and 0 disables the wait. The turn starts as soon as plugins are ready.
$ amp -x "summarize this repo" --plugin-ready-timeout
$ amp -x "summarize this repo" --plugin-ready-timeout 30 Non-Interactive Environments
For non-interactive environments, such as scripts and CI/CD pipelines, set your access token in an environment variable:
export AMP_API_KEY=your-access-token-here