CLI Reference
On Sun, 04 Oct 2026, by @lucasdicioccio, 2181 words, 81 code snippets, 11 links, 0images.
Generated from documentation/cli-commands.md, the repository is the canonical source and may be ahead of this page.
CLI Reference
Complete reference for the Agents CLI commands and options.
Global Options
These options apply to all commands:
agents-exe [GLOBAL_OPTS] COMMAND [COMMAND_OPTS]| Option | Default | Description |
|---|---|---|
--api-keys FILE | ~/.config/agents-exe/secret-keys | Path to API keys JSON file |
--agent-file FILE | (from config) | Agent configuration file(s) |
--agent SLUG | - | Select agent by slug instead of file path |
--log-file FILE | agents-logfile | Raw log output file |
--log-http URL | - | HTTP endpoint for JSON logs |
--log-json-file FILE | - | Local JSON log file |
Commands
check
Validate agent configuration and display loaded tools.
agents-exe check [--tools MODE] [--show-config]Options:
| Option | Description |
|---|---|
--tools MODE | Tool display mode: none, list, agents-exe, openai (default: none) |
--show-config | Print each agent file's JSON before its check line; for a .tramaj [template](/docs-agent-templates.html), the JSON it evaluates to |
Output:
my-agent: A helpful file assistant (12 tools)
Exit codes:
0- All agents loaded successfully1- Configuration errors found
Example:
# Check default agents
agents-exe check
# Check specific agent
agents-exe check --agent-file ./custom-agent.json
# List tools in agents-exe format
agents-exe check --tools agents-exerun
Execute a one-shot agent conversation.
agents-exe run [OPTIONS]Options:
| Option | Description |
|---|---|
--session-file FILE | Resume from existing session |
--thinking TARGET | Output thinking: none, stdout, stderr (default: none) |
-m, --media MEDIA | Attach media file (can be specified multiple times) |
--prompt TEXT | Initial prompt text |
--file FILE | Read prompt from file |
--shell COMMAND | Use shell command output as prompt |
--alias NAME | Use predefined prompt alias |
--sep4 TEXT | Short separator (4 chars) |
--sep40 TEXT | Long separator (40 chars) |
--session-xs FILE | Inject session at minimal verbosity |
--session-s FILE | Inject session at low verbosity |
--session-m FILE | Inject session at medium verbosity |
--session-l FILE | Inject session at high verbosity |
--session-xl FILE | Inject session at maximum verbosity |
Asynchronous tool calls:
If the agent file enables asynchronous execution (see
async-tool-calls.md), tool calls run concurrently and
the model can be answered while they run. run still waits for them, since
they cannot outlive the process.
It stops early only when a turn waits on deferred calls, which an external worker completes. It then prints a JSON report and stores the session:
{"status": "paused",
"reason": "waiting for deferred tool calls",
"session_id": "…",
"deferred_calls": [{"tool": "approve_deploy", "tool_call_id": "call_9", "continuation_token": "…"}]}Continue it with session complete and session resume.
Media Attachment Format:
The -m, --media option accepts file paths with optional MIME type:
# Auto-detect MIME type from extension
agents-exe run -m /path/to/image.png --prompt "Describe this image"
# Explicit MIME type (semicolon separator)
agents-exe run -m "image/jpeg;/path/to/photo.jpg" --prompt "Analyze this photo"Supported Media Types:
| Category | Extensions | MIME Types |
|---|---|---|
| Images | .png, .jpg, .jpeg, .gif, .webp, .svg | image/png, image/jpeg, image/gif, image/webp, image/svg+xml |
| Documents | .pdf, .txt, .md, .json, .xml | application/pdf, text/plain, text/markdown, application/json, application/xml |
| Audio | .mp3, .wav, .ogg, .aac, .flac | audio/mp3, audio/wav, audio/ogg, audio/aac, audio/flac |
| Video | .mp4, .webm, .mov, .avi | video/mp4, video/webm, video/quicktime, video/avi |
Size Limit: 50MB per file
Examples:
# Simple prompt
agents-exe run --agent-file agent.json --prompt "Hello!"
# Read from file
agents-exe run --agent-file agent.json --file prompt.txt
# Shell command output as prompt
agents-exe run --agent-file agent.json --shell "git diff"
# Resume session
agents-exe run --agent-file agent.json --session-file session.json
# Use alias
agents-exe run --agent-file agent.json --alias code-review --file changes.patch
# Multi-part prompt with separators
agents-exe run \
--prompt "Review this code:" \
--sep4 "----" \
--file code.py \
--sep40 "========================================" \
--prompt "What improvements can be made?"
# Inject previous session at medium verbosity
agents-exe run \
--agent-file agent.json \
--session-m previous-session.json \
--prompt "Continue from where we left off"
# Attach single image
agents-exe run \
--agent-file vision-agent.json \
-m ./screenshot.png \
--prompt "What do you see in this image?"
# Attach multiple images
agents-exe run \
--agent-file vision-agent.json \
-m ./image1.png \
-m ./image2.jpg \
-m "image/gif;./animation.gif" \
--prompt "Compare these images"
# Attach document for analysis
agents-exe run \
--agent-file document-agent.json \
-m ./report.pdf \
--prompt "Summarize the key findings"
# Combine media with text from file
agents-exe run \
--agent-file multimodal-agent.json \
--prompt "Analyze this diagram and code:" \
-m ./diagram.png \
--sep4 "----" \
--file ./source-code.pytui
Start the interactive Terminal UI.
agents-exe tui [--agent-file FILE...] [--keymap FILE] [--db PATH]
agents-exe tui --attach URL|PATH [--token TOKEN | --token-file FILE] [--keymap FILE]The TUI is a client of an in-process SessionRunner it starts over the
same Host config agents-exe serve uses, or, with --attach, of a
running agents-exe serve/agents-server (see
tui.md and
agents-server.md).
Options:
| Option | Default | Description |
|---|---|---|
--keymap FILE, -k FILE | none | Path to a keymap configuration JSON file |
--db PATH | next to the resolved sessions directory | SQLite database for the TUI's embedded session runner. Old conv.<uuid>.json history under the resolved sessions directories stays readable as a read-only fallback. Not with --attach. |
--attach URL\|PATH | none | Drive a running server instead of an embedded runner. http://HOST:PORT (or https://, optionally with a path prefix), unix:///path/to.sock for serve --socket, or a bare socket path (anything containing a / or ending in .sock). Nothing is loaded locally: agents, API keys and sessions are the server's. |
--token TOKEN | none | Bearer token for --attach, when the server runs with --auth-tokens. |
--token-file FILE | none | The same, read from a file (surrounding whitespace ignored); keeps the token out of the process list. |
Features:
- Real-time streaming responses
- Multiple agent support (Tab to switch)
- Tool call visualization
- Session persistence
- Turn navigation and forking
- Message queue management
- File attachments (Ctrl+F)
- Clipboard paste support (Ctrl+V)
Keyboard Shortcuts:
Tab/Shift+Tab- Switch between agentsEnter- Send messageCtrl+C- QuitUp/Down- Scroll historyCtrl+[/Ctrl+]- Previous/Next tabCtrl+E- Pause/unpause conversationCtrl+D(when paused) - Clear queued messagesCtrl+F- Attach fileCtrl+Shift+F- Clear all attachmentsCtrl+V- Paste from clipboard
Examples:
# Single agent TUI
agents-exe tui --agent-file agent.json
# Multi-agent TUI
agents-exe tui \
--agent-file coder.json \
--agent-file reviewer.json \
--agent-file tester.json
# Attach to a server started elsewhere with `agents-exe serve`
agents-exe tui --attach http://127.0.0.1:8080
agents-exe tui --attach unix:///run/agents/agents.sock
agents-exe tui --attach https://agents.example --token-file ~/.agents-tokenspectate
Watch a running server: a read-only, live dashboard.
agents-exe spectate --attach URL|PATH [--token TOKEN | --token-file FILE]
[--panels SPEC] [--refresh SECONDS] [--layout-file FILE]spectate is one more client of a running agents-exe serve/agents-server,
like tui --attach, except that it only reads: it follows the server’s
event feed and changes nothing. It is made for watching one long run, in
three panels:
- agents (
tree; top left by default): the tree of sessions and of the sub-agent calls they make, indented by depth, each with its state and for how long. - tool calls (
tools; bottom left): the calls running now, with elapsed time and the latest progress a background call reported, then the ones that finished recently. - text (
text; right): what the model writes in one session, with the user queries it answers. By default the panel follows the session that wrote last; selecting a row of the tree pins it to that session.
Which panels show, where, how large, and how often the screen refreshes can
be chosen on the command line and changed while running, as in top: see
Layout below.
The events carry no timestamp, so every duration is measured by
spectate from the moment it received the event; a run that started
before spectate attached counts from the attach. Text arrives as the
model writes it when the server runs with --stream-tokens, and turn by
turn otherwise. A sub-agent call that runs inside its caller’s tool call
(rather than as a session of its own) is in the tree, but has no event
stream and so no text; and a session already running when spectate
attaches shows its text from its next turn on.
Options:
| Option | Default | Description |
|---|---|---|
--attach URL\|PATH | required | The server to watch. Same forms as tui --attach: http://HOST:PORT, https://..., unix:///path/to.sock, or a bare socket path. |
--token TOKEN | none | Bearer token, when the server runs with --auth-tokens. spectate then sees that owner's sessions only. |
--token-file FILE | none | The same, read from a file. |
--panels SPEC | tree:60+tools:40/45,text/55 | The panels shown, their places and sizes (see below). |
--refresh SECONDS | 1 | Time between two refreshes of the screen, from 0.1 to 60; decimals are accepted (0.5). |
--layout-file FILE | ~/.config/agents-exe/spectate-layout | The saved layout: read at start when the file exists, written by the W key. |
The screen is columns, left to right, each a stack of panels, top to
bottom. --panels describes it in one string:
,separates columns, and+the panels stacked in one column;- a panel is
tree(oragents),toolsortext; one that is not named is hidden, and none can be named twice; :Nafter a panel is its share of its column’s height, and/Nafter a column its share of the screen’s width. Shares go from 1 to 100, count relative to their neighbours, and are 50 when left out.
--panels tree,tools,text # three equal columns
--panels text # only the text
--panels tree+tools+text # one stack
--panels text/70,tree:30+tools:70/30 # text on the left, wideBetween two refreshes the events received wait, and the durations stand still: a longer interval makes a busy run calmer to read, a shorter one more live. Durations are still counted from when each event was received.
The layout is remembered only when asked, as top does with W: the W
key writes it to the layout file, and the next spectate starts from that
file. --panels and --refresh each go over what the file says, so a
scripted layout (for a screenshot, say) is the same whatever was saved. A
layout file that cannot be read is an error, not a layout silently dropped.
The file holds what the flags take:
panels tree:60+tools:40/45,text/55
refresh 1
Keyboard Shortcuts:
Up/Down(ork/j) - Select a session in the tree; the text panel shows itf- Follow the session that writes, againPgUp/PgDn- Scroll the text1/2/3- Show or hide the agents, tool calls, text panel (the last one shown stays); a panel that comes back is a new last columnTab/Shift+Tab- Choose the panel the next keys act on; its title is in brackets</>- Exchange it with the panel before or after[/]- Narrow or widen its column-/+- Shorten or heighten it in its columns- Stack it under the column before, or give it a column of its own0- Back to the layout at startd/D- Longer or shorter refresh interval (0.1, 0.25, 0.5, 1, 2, 5, 10, 30, 60 seconds)W- Save the layout to the layout file?orh- Show the keys, and the--panels/--refreshflags that reproduce the layout on screenq,EscorCtrl+C- Quit (the runs go on)
No key sends anything to the server or to the agents.
Examples:
# In one terminal: a server, and a TUI or any other client driving it
agents-exe serve --socket /run/agents/agents.sock --stream-tokens
agents-exe tui --attach /run/agents/agents.sock
# In another: watch
agents-exe spectate --attach /run/agents/agents.sock
# The same, as three columns refreshed twice a second
agents-exe spectate --attach /run/agents/agents.sock --panels tree,tools,text --refresh 0.5A TUI started without --attach runs its agents in its own process and
exposes no endpoint, so there is nothing for spectate to attach to: run
agents-exe serve and attach both.
mcp-server
Start an MCP (Model Context Protocol) server.
agents-exe mcp-server [--agent-file FILE...]Description: Exposes loaded agents as MCP tools for integration with MCP clients like Claude Desktop.
Examples:
# Single agent MCP server
agents-exe mcp-server --agent-file agent.json
# Multi-agent MCP server
agents-exe mcp-server \
--agent-file research-agent.json \
--agent-file writing-agent.jsonecho-prompt
Process and echo the prompt without calling the LLM.
agents-exe echo-prompt [OPTIONS]Options: Same as run command.
Use case: Verify prompt construction before sending to LLM.
Example:
agents-exe echo-prompt \
--prompt "Context:" \
--file context.txt \
--prompt "Question:" \
--file question.txtsession-print
Display a session file in markdown format.
agents-exe session-print [OPTIONS] SESSIONFILEOptions:
| Option | Description |
|---|---|
--show-tool-call-results MODE | Display mode: hidden, shown, elided (default: hidden) |
--show-tool-call-arguments MODE | Display mode: hidden, shown, elided (default: hidden) |
--n-turns N | Limit to last N turns |
--repeat-system-prompt | Show system prompt each turn |
--repeat-tools | Show available tools each turn |
--antichronological | Newest first (default: oldest first) |
--no-funny-stamp | Skip the ASCII art logo |
Examples:
# Print full session
agents-exe session-print session.json
# Print with tool results visible
agents-exe session-print --show-tool-call-results shown session.json
# Elide long outputs (show first/last 10 lines)
agents-exe session-print --show-tool-call-results elided session.json
# Last 5 turns only
agents-exe session-print --n-turns 5 session.json
# Reverse order
agents-exe session-print --antichronological session.jsonsession-edit
Edit a session file (reads JSON from STDIN, writes JSON to STDOUT).
agents-exe session-edit [OPTIONS] < input.json > output.jsonOptions:
| Option | Description |
|---|---|
--take | Take first N turns (use with --count) |
--take-tail | Take last N turns (use with --count) |
--drop | Drop first N turns (use with --count) |
--drop-tail | Drop last N turns (use with --count) |
--count N, -n N | Number of turns for take/drop operations |
--censor-tool-calls | Remove all tool calls |
--censor-thinking | Remove all thinking content |
Examples:
# Keep only first 10 turns
agents-exe session-edit --take --count 10 < session.json > trimmed.json
# Keep only last 5 turns
agents-exe session-edit --take-tail --count 5 < session.json > recent.json
# Remove first 2 turns
agents-exe session-edit --drop --count 2 < session.json > dropped.json
# Remove all tool calls
agents-exe session-edit --censor-tool-calls < session.json > no-tools.json
# Remove thinking content
agents-exe session-edit --censor-thinking < session.json > no-thinking.jsonsession-index
Manage the SQLite FTS5 search index for session files.
agents-exe session-index [OPTIONS]Options:
| Option | Description |
|---|---|
--build | Build the search index from scratch |
--update | Incrementally update the search index |
--status | Show index status (default) |
--clean | Remove the search index |
--db-path PATH | Path to search index database (default: .agents-search.db) |
--include-tool-outputs | Include tool outputs in the index |
Description:
The session-index command manages a SQLite FTS5-based search index for fast fuzzy text search across session files. The index uses trigram tokenization to enable fuzzy matching (e.g., “error” matches “errors”, “erroring”).
Index Schema:
session_index- Session metadata cache (path, mtime, agent, turn count)search_content- FTS5 virtual table with trigram tokenizertool_index- Tool call index for filtering by tool name
Examples:
# Build the search index
agents-exe session-index --build
# Check index status
agents-exe session-index --status
# Update index incrementally
agents-exe session-index --update
# Remove the index
agents-exe session-index --clean
# Build with tool outputs included
agents-exe session-index --build --include-tool-outputs
# Custom database location
agents-exe session-index --build --db-path ~/.config/agents-exe/search.dbsession-search
Search session files with fuzzy text matching and filtering.
agents-exe session-search [OPTIONS] "QUERY"Arguments:
| Argument | Description |
|---|---|
QUERY | Search query text (supports fuzzy matching) |
Options:
| Option | Description |
|---|---|
--db-path PATH | Path to search index database |
--after DATE | Filter sessions after date (YYYY-MM-DD) |
--before DATE | Filter sessions before date (YYYY-MM-DD) |
--tool TOOLNAME | Filter by tool name (can specify multiple) |
--agent SLUG | Filter by agent slug |
--include-tool-outputs | Include tool outputs in search |
--json | Output results as JSON |
--preview N | Show N lines of context around matches |
--limit N | Limit to N results |
--auto | Auto-update index if stale before searching |
Description: Performs fast fuzzy text search across session files using an SQLite FTS5 index. The search supports trigram-based fuzzy matching, allowing queries like “error” to match “errors”, “erroring”, “terror”, etc.
Search Features:
- Fuzzy matching: Trigram tokenizer handles typos and variations
- Metadata filtering: Filter by date, tool usage, or agent
- Incremental indexing: Only re-indexes changed sessions
- JSON output: Machine-readable format for scripting
Examples:
# Basic fuzzy search
agents-exe session-search "database error"
# Search with auto-update
agents-exe session-search "migration" --auto
# Include tool outputs in search
agents-exe session-search "config.yaml" --include-tool-outputs
# Filter by date and tool
agents-exe session-search "auth" --after 2024-01-01 --tool write-file
# Filter by agent
agents-exe session-search "refactor" --agent my-coder
# JSON output for scripting
agents-exe session-search "TODO" --json
# Show context lines
agents-exe session-search "deploy" --preview 5
# Combined filters
agents-exe session-search "fix" --after 2024-01-01 --before 2024-12-31 --tool bash_write-file --jsonJSON Output Format:
{
"resultItems": [
{
"resultMetadata": {
"resultSessionId": "550e8400-e29b-41d4-a716-446655440000",
"resultFilePath": "/path/to/session.json",
"resultAgentSlug": "my-agent",
"resultTurnCount": 15,
"resultRank": 0.5
},
"resultPreview": "...context around match...",
"resultMatchedTerms": ["error", "database"]
}
],
"resultTotalMatches": 42,
"resultQueryTimeMs": 15.3,
"resultIndexWasUpdated": false
}list-tool-calls
Extract and list all tool calls from a session file.
agents-exe list-tool-calls [OPTIONS] SESSIONFILEOptions:
| Option | Description |
|---|---|
-f, --format FORMAT | Output format: human, json, brief (default: human) |
Description: Parses a session file and extracts all tool calls made during the conversation. Useful for debugging, auditing, and replaying specific tool calls.
Output formats:
human- Detailed human-readable format with indices, turn numbers, and argumentsjson- JSON array for machine processingbrief- Compact tabular format (index, name, arguments preview)
Examples:
# List tool calls in human-readable format
agents-exe list-tool-calls session.json
# Output as JSON
agents-exe list-tool-calls session.json --format json
# Brief format for quick overview
agents-exe list-tool-calls session.json --format briefExample output (human format):
Found 3 tool call(s):
[0] bash_read-file
Turn: 1
Arguments:
{"filepath":"./src/Main.hs"}
[1] bash_grep-files
Turn: 2
Arguments:
{"pattern":"TODO","filepath":"./src"}
[2] bash_write-file
Turn: 2
Arguments:
{"filepath":"./src/Main.hs","content":"..."}
To replay a tool call:
agents-exe replay-tool-call --session <file> --tool-call <index> --tool <tool-path>
replay-tool-call
Replay a specific tool call from a session file, with validation.
agents-exe replay-tool-call --session FILE --tool-call INDEX --tool TOOLPATH [OPTIONS]Options:
| Option | Description |
|---|---|
-s, --session FILE | Path to the session file containing the tool call |
-i, --tool-call INDEX | Index of the tool call to replay (0-based) |
-t, --tool TOOLPATH | Path to the tool script to execute |
--validate-only | Only validate arguments, don't execute |
--raw | Show raw output instead of formatted |
Description: Extracts a tool call from a session file, validates its arguments against the tool’s schema, and optionally executes the tool with the same arguments. This is useful for:
- Debugging failed tool calls
- Reproducing tool execution for testing
- Validating historical tool calls against updated schemas
Exit codes:
0- Validation passed (and tool executed if not –validate-only)1- Validation failed or tool execution failed
Examples:
# First, list tool calls to find the index
agents-exe list-tool-calls session.json
# Validate and execute a tool call
agents-exe replay-tool-call \
--session session.json \
--tool-call 0 \
--tool ./tools/read-file.sh
# Only validate without executing
agents-exe replay-tool-call \
--session session.json \
--tool-call 1 \
--tool ./tools/grep-files.sh \
--validate-only
# Execute and show raw output
agents-exe replay-tool-call \
--session session.json \
--tool-call 2 \
--tool ./tools/write-file.sh \
--rawExample output:
✓ Tool call validation passed
Tool: read-file
Arguments: {"filepath":"./src/Main.hs"}
Executing tool...
=== Tool Output ===
module Main where
main :: IO ()
main = putStrLn "Hello, World!"
===================
tool-call
Call a tool from the first loaded agent with JSON payload from stdin.
echo '{}' | agents-exe tool-call TOOLNAME [OPTIONS]Arguments:
| Argument | Description |
|---|---|
TOOLNAME | Name of the tool to call |
Options:
| Option | Description |
|---|---|
-l, --log-file FILE | Optional log file for tracing tool execution |
Description: Executes a single tool directly without involving the LLM. Useful for:
- Testing tool implementations
- Scripting tool usage
- Debugging tool behavior
Examples:
# Call a tool with arguments
echo '{"filepath": "./README.md"}' | \
agents-exe tool-call read-file --agent-file ./agent.json
# Call with logging
echo '{"command": "ls -la"}' | \
agents-exe tool-call bash --log-file ./tool-debug.logserve
Run agents over HTTP, like agents-server, loading agents-exe.cfg.json like the TUI does.
agents-exe serve [--agent-file FILE...] [--agent SLUG] [OPTIONS]Description:
agents-exe serve is agents-server’s code (sessions in SQLite or Postgres,
the HTTP API and SSE stream, MCP over HTTP, the chat page) run behind
agents-exe’s own config loading, so it resolves agent files the same way
every other agents-exe command does: --agent-file (repeatable), else
agents-exe.cfg.json’s agentsFiles plus every .json and .tramaj file under
agentsDirectories, else ~/.config/agents-exe/default; --agent SLUG
narrows to one agent by slug, failing with the list of available slugs if it
does not match. It shares agents-exe’s global --api-keys,
--set/--set-json/--pin/--pin-json and --params-file, so those are
not repeated below.
Options:
| Option | Default | Description |
|---|---|---|
--db FILE\|URL | next to the resolved sessions directory | SQLite file, or postgresql:// URL, for sessions and continuations |
--bind HOST | 127.0.0.1 | Address to listen on |
--port PORT | 8080 | Port to listen on |
--live-session-ttl SECONDS | 900 | Idle time before a session's in-memory state is dropped |
--shutdown-grace SECONDS | 10 | Time open requests get to finish on shutdown |
--auth-tokens FILE | (none) | Bearer tokens and their owners; without, no authentication |
--stream-tokens | off | Stream LLM answers as text.delta events |
--admin-owners OWNER,… | (none) | Owners allowed to store and delete agents over the API (needs --auth-tokens) |
--no-ui | off | Do not serve the chat page at / |
--cors-origin ORIGIN | (none) | Allow this origin to call the server cross-origin; repeatable, or * for any (needs no --auth-tokens) |
--socket PATH | (none) | Also listen on this Unix domain socket, in addition to --bind/--port; created 0600, a stale file removed at start, closed and unlinked on shutdown. The socket is the local trust boundary: no Origin, no bearer token beyond --auth-tokens. |
--owner-api-keys OWNER=FILE | (none) | This owner's sessions call the LLM with the keys in FILE instead of the shared ones; repeatable (needs --auth-tokens) |
--isolate-tools docker:IMAGE\|process:PATH | (none) | Run bash and MCP tool calls outside the server, in a worker you provide |
See agents-server.md for everything the running server does (the HTTP API, sessions, deferred calls, CORS, authentication, running it as a service).
Examples:
# Explicit agent files, like agents-server
agents-exe serve --agent-file ./weather.json --api-keys ./keys.json --port 8080
# From a directory with an agents-exe.cfg.json
agents-exe serve --port 8080
# One agent from a multi-agent config, over a local socket only auth-tokens gate
agents-exe serve --agent architect --socket /run/agents-exe/agents.sock --auth-tokens ./tokens.jsoncheck-tool-call
Validate a tool call payload against a tool schema (reads JSON from stdin).
cat payload.json | agents-exe check-tool-call --tool TOOLPATHOptions:
| Option | Description |
|---|---|
-t, --tool TOOLPATH | Path to the tool script to validate against |
Description: Validates that a JSON payload from stdin matches the tool’s declared schema. Returns exit code 0 if valid, 1 if invalid with detailed error messages.
Example:
# Create a test payload
echo '{"filepath": "/path/to/file"}' | agents-exe check-tool-call --tool ./tools/read-file.sh
# Validate from file
cat payload.json | agents-exe check-tool-call --tool ./tools/my-tool.shExample output (valid):
✓ Tool call payload is valid
Example output (invalid):
Tool call validation failed for './tools/my-tool.sh (my-tool)' with 2 errors:
1. filepath: Required property missing
2. content: Required property missing
Please correct these issues and try again.
init
Initialize a new agent configuration.
agents-exe init [--agent-file FILE]Creates:
agent.json- Agent configurationtools/- Tool directorysecret-keys- API keys file (if doesn’t exist)
Example:
agents-exe init --agent-file ./my-agent.jsonnew
Create scaffolding for new agents or tools.
agents-exe new (agent|tool) [OPTIONS]new agent
Create a new agent configuration file from a template.
agents-exe new agent SLUG FILE [MODEL] [OPTIONS]Arguments:
| Argument | Description |
|---|---|
SLUG | Unique identifier for the agent |
FILE | Output file path |
MODEL | Model name (e.g., gpt-4o, mistral-large). The provider preset is inferred from the model catalog. |
Options:
| Option | Description |
|---|---|
--add-to-config | Add the agent to the agentsFiles of agents-exe.cfg.json when it is not listed there, without asking |
--no-add-to-config | Never modify agents-exe.cfg.json |
-f, --force | Overwrite existing file (given before the subcommand: agents-exe new --force agent ...) |
Provider presets (URL, default model, API key ID) are selected automatically
based on the model name. Use agents-exe new models list to see the built-in
model patterns and agents-exe new models init to customize them locally.
Examples:
# Create agent with the default OpenAI preset
agents-exe new agent my-assistant ./my-assistant.json
# Create agent with custom model (preset inferred from the catalog)
agents-exe new agent coder ./coder.json gpt-4o
# Create agent in a subdirectory and list it in agents-exe.cfg.json
agents-exe new agent my-assistant ./agents/assistant.json --add-to-config
# Overwrite existing
agents-exe new --force agent my-assistant ./my-assistant.jsonWhat a new agent can do:
A new agent works on the directory it is started from:
| Toolbox | Gives the agent |
|---|---|
developer (DeveloperToolbox) | Reading and editing files (read-file-range, write-file-range, patch-file), and the agent/tool scaffolding helpers |
system (SystemToolbox) | The working directory and directory listings (working-directory, list-directory) |
memory (SqliteToolbox) | A read-write SQLite database, ./{slug}-memory.sqlite, created on first use |
File access is limited by one file sandbox, workspace, declared in the
agent’s fileSandboxes and shared by the developer and system toolboxes.
It allows reading and writing ./ and everything below it, where ./ is the
directory the agent runs in (not the directory of the agent file). Edit its
fsbPredicate to narrow or widen what the agent may touch; see
Tools for the predicates.
Generated agent file:
{
"tag": "OpenAIAgentDescription",
"contents": {
"slug": "my-assistant",
"apiKeyId": "main-key",
"flavor": "OpenAIv1",
"modelUrl": "https://api.openai.com/v1",
"modelName": "gpt-4-turbo-preview",
"announce": "a helpful assistant powered by gpt-4-turbo-preview",
"systemPrompt": [
"You are my-assistant, a helpful AI assistant.",
"You provide clear, accurate, and concise responses.",
"When using tools, you explain your actions to the user."
],
"toolDirectory": "tools",
"mcpServers": [],
"fileSandboxes": {
"workspace": {
"fsbPredicate": {"tag": "DirectoryRecursive", "contents": "./"},
"fsbMaxFileSize": 52428800,
"fsbName": null
}
},
"builtinToolboxes": [
{
"tag": "DeveloperToolbox",
"contents": {
"Name": "developer",
"Description": "Tools for developing agents and tools",
"Capabilities": ["show-spec", "validate-agent", "create-agent", "create-tool", "read-file-range", "write-file-range", "patch-file"],
"FileSandbox": {"ref": "workspace"}
}
},
{
"tag": "SystemToolbox",
"contents": {
"Name": "system",
"Description": "Working directory and directory listings",
"Capabilities": ["working-directory", "list-directory"],
"FileSandbox": {"ref": "workspace"}
}
},
{
"tag": "SqliteToolbox",
"contents": {
"Name": "memory",
"Description": "Notes and facts to remember across conversations",
"Versioning": {"tag": "SqliteReadWrite", "path": "./my-assistant-memory.sqlite"}
}
}
]
}
}Listing the agent in agents-exe.cfg.json:
After writing the file, new agent looks for an agents-exe.cfg.json (in the
current directory, then upward) and reports whether the new agent is loaded by
it, that is, named in agentsFiles or sitting directly in one of the
agentsDirectories:
- listed: nothing else to do;
- not listed, on an interactive terminal: it asks whether to add the file to
agentsFiles(default: no); - not listed, not interactive: it prints the entry to add. Pass
--add-to-configto add it without being asked,--no-add-to-configto never be asked.
Adding the entry rewrites the config file as formatted JSON; every other field
is kept. Without any agents-exe.cfg.json, pass the file with --agent-file
or create a config with agents-exe config local init.
new tool
Create a new tool script from a template.
agents-exe new tool SLUG LANGUAGE FILE [OPTIONS]Arguments:
| Argument | Description |
|---|---|
SLUG | Unique identifier for the tool |
LANGUAGE | Programming language: bash, python, haskell, node |
FILE | Output file path (without extension) |
Options:
| Option | Description |
|---|---|
-f, --force | Overwrite existing file |
Examples:
# Create bash tool (default)
agents-exe new tool my-tool bash ./tools/my-tool
# Create Python tool
agents-exe new tool my-tool python ./scripts/my-tool
# Create Haskell tool
agents-exe new tool my-tool haskell ./tools/my-tool
# Create Node.js tool
agents-exe new tool my-tool node ./scripts/my-toolGenerated bash tool:
#!/bin/bash
# my-tool - A bash tool for agents-exe
set -euo pipefail
# Agents-exe tool protocol: describe|run
# Environment variables available during 'run':
# AGENT_SESSION_ID - UUID of the current session
# AGENT_CONVERSATION_ID - UUID of the conversation
# AGENT_TURN_ID - UUID of the current turn
# AGENT_AGENT_ID - UUID of the executing agent (if available)
case "${1:-}" in
describe)
cat <<'DESCRIBE_EOF'
{
"slug": "my-tool",
"description": "Tool my-tool - describe what this tool does",
"args": [],
"empty-result": {
"tag": "AddMessage",
"contents": "--no output--"
}
}
DESCRIBE_EOF
;;
run)
# TODO: Implement tool logic
# Access arguments via environment or command line
echo "Tool my-tool executed"
;;
*)
echo "Usage: my-tool <describe|run>" >&2
exit 1
;;
esacNext steps after creating a tool:
- Edit the
argsarray in the describe function - Implement the
runfunction logic - Test with:
agents-exe describe-tool ./tools/my-tool
config
Configure agents-exe itself: the project config file, the TUI keymap and the API keys file, without writing their JSON by hand.
agents-exe config [-f|--force] (local|keymap|api-key) ...Options:
| Option | Description |
|---|---|
-f, --force | Overwrite an existing file or API key entry. It belongs to config, so it goes last: agents-exe config local init --force |
config local init
Create an agents-exe.cfg.json in the current directory.
agents-exe config local initThe file is minimal: agentsConfigDir pointing at ~/.config/agents-exe and
an empty agentsFiles. Add agents to agentsFiles or agentsDirectories
(see Configuration File); agents-exe new agent offers
to do it for the agents it creates. Only the current directory is checked for
an existing file, not its parents; an existing file is kept unless --force
is given.
config keymap init
Write a keymap file holding the default TUI key bindings and input settings, as a starting point for customization.
agents-exe config keymap init FILE| Argument | Description |
|---|---|
FILE | Path where the keymap file is created (parent directories are created as needed) |
Point the keymap field of agents-exe.cfg.json at the file to use it. An
existing file is kept unless --force is given.
config api-key list
List the names of the configured API keys (never their values).
agents-exe config api-key listconfig api-key create
Add an entry to the API keys file with a placeholder value, to be replaced by the real key in an editor.
agents-exe config api-key create NAME| Argument | Description |
|---|---|
NAME | Name of the key, as referenced by an agent's apiKeyId |
An existing entry of that name is kept unless --force is given, in which
case it is reset to the placeholder.
Both api-key subcommands work on the secret-keys file of the config
directory (~/.config/agents-exe/secret-keys by default), and create it empty
if it does not exist. The global --api-keys option does not redirect them.
Examples:
# Start a project: config file, then an agent listed in it
agents-exe config local init
agents-exe new agent helper ./helper.json --add-to-config
# Declare the key the agent's preset refers to, then fill in its value
agents-exe config api-key create main-key
agents-exe config api-key list
# Customize the TUI key bindings
agents-exe config keymap init ./keymap.jsonspec
Display embedded specification documentation.
agents-exe spec TOPICTopics:
| Topic | Description |
|---|---|
bash-tools | Binary tool protocol specification |
Examples:
# Display bash-tools specification
agents-exe spec bash-toolsUse case: Learn the protocol for writing bash tools without leaving the CLI.
describe-tool
Display information about a tool script.
agents-exe describe-tool TOOL_PATH [OPTIONS]Options:
| Option | Description |
|---|---|
-f, --format FORMAT | Output format: json or pretty (default: json) |
--check-only | Only check validity, don't output full description |
Description:
Loads and displays the tool’s description (the output of tool describe).
Example:
agents-exe describe-tool ./tools/my-tool.sh
# Pretty format
agents-exe describe-tool ./tools/my-tool.sh --format pretty
# Only check validity
agents-exe describe-tool ./tools/my-tool.sh --check-onlyOutput:
{
"slug": "my-tool",
"description": "What this tool does",
"args": [...],
"empty-result": {...}
}paths
Show important configuration paths.
agents-exe paths [OPTIONS]Options:
| Option | Description |
|---|---|
--json | Output in JSON format |
Description: Displays configuration paths including config directory, agent files, API keys file, and session storage configuration.
Session Storage: The session storage configuration supports multiple read locations:
- Write location: Where new sessions are saved
- Read locations: Directories searched for existing sessions (includes write location by default)
Examples:
# Human-readable output
agents-exe paths
# JSON output
agents-exe paths --jsonExample output:
Configuration:
File: /home/user/project/agents-exe.cfg.json
Directory: /home/user/project
Default: /home/user/.config/agents-exe
Agent Files:
- ./main-agent.json
- ./secondary-agent.json
API Keys:
/home/user/.config/agents-exe/secret-keys
Session Storage:
Write location: ./sessions/
Read locations:
1. ./sessions/
2. ./.agents-sessions/
3. ~/.config/agents-exe/sessions/
export
Export agent/tool configurations to archive or git.
agents-exe export [OPTIONS]Source Options:
| Option | Description |
|---|---|
--all | Export all loaded agents |
--agent-slug SLUG | Export specific agent by slug |
--tools-only | Export only tools, not agent config |
--tool TOOLNAME | Export specific tool |
Destination Options:
| Option | Description |
|---|---|
-o, --output FILE | Output file path |
--git-url URL | Git remote URL |
--git-branch BRANCH | Git branch |
--git-message MESSAGE | Commit message |
--git-push | Push after commit |
--git-tag TAG | Create git tag |
Format Options:
| Option | Description |
|---|---|
--format FORMAT | Archive format: tar, tar.gz, zip |
--namespace NAMESPACE | Namespace for export (e.g., "team.project") |
--no-tools | Exclude tools from export |
--no-mcp | Exclude MCP servers from export |
Examples:
# Export to tar.gz
agents-exe export --output ./my-agent.tar.gz
# Export to git
agents-exe export \
--git-url https://github.com/user/agents-repo \
--git-branch main \
--git-message "Update agent" \
--git-push
# Export tools only
agents-exe export --tools-only --output ./tools.tar.gz
# Export specific agent
agents-exe export --agent-slug my-agent --output ./agent.tar.gz
# With namespace
agents-exe export --namespace team-a.project-1 --output ./export.tar.gzimport
Import agent/tool configurations from archive or git.
agents-exe import [OPTIONS]Source Options:
| Option | Description |
|---|---|
-f, --from-file FILE | Import from archive file |
--git-url URL | Import from git URL |
--git-ref REF | Git ref (branch, tag, commit) |
--namespace NAMESPACE | Namespace to import from |
Destination Options:
| Option | Description |
|---|---|
--to-current | Import to current directory |
--to PATH | Import to specific path |
--to-config-dir | Import to config directory |
--install-to-agent FILE | Install tools to agent's tool directory |
--install-to-tooldir DIR | Install tools to specific directory |
Mode Options:
| Option | Description |
|---|---|
--overwrite | Overwrite existing files |
--merge | Merge with existing files |
| (default) | Fail on conflict |
List Options:
| Option | Description |
|---|---|
--list-namespaces | List available namespaces (git only) |
--list-tools | List available tools (git only) |
Examples:
# Import from archive
agents-exe import --from-file ./agent.tar.gz
# Import from git
agents-exe import \
--git-url https://github.com/user/agents-repo \
--git-ref main
# Import tools to agent
agents-exe import \
--from-file ./tools.tar.gz \
--install-to-agent ./my-agent.json
# Import with overwrite
agents-exe import --from-file ./agent.tar.gz --overwrite
# List namespaces
agents-exe import --git-url https://github.com/user/repo --list-namespaces
# Import specific namespace
agents-exe import \
--git-url https://github.com/user/repo \
--namespace team-a.tools \
--to ./tools/cowsay
Display a fun message with the agents-exe mascot.
agents-exe cowsay [MESSAGE] [OPTIONS]Options:
| Option | Description |
|---|---|
-W, --width WIDTH | Maximum width of speech bubble (default: 40) |
Description: If no message is provided, reads from stdin.
Example:
agents-exe cowsay "Hello, agents!"
# With custom width
agents-exe cowsay "A much longer message that needs more space" --width 60
# Pipe from another command
echo "System ready" | agents-exe cowsaydescribe
Output self-describing schema for the agent.
agents-exe describe [OPTIONS]Options:
| Option | Description |
|---|---|
--self-describe-slug NAME | Override the slug field |
--self-describe-description DESC | Override the description |
Output: JSON schema for tool calling.
Use case: Integration with external systems that need to understand the agent’s interface.
self-describe
Output information about the agents-exe binary itself.
agents-exe self-describeOutput: Version, build info, and available commands.
Configuration File
Project-level configuration in agents-exe.cfg.json:
{
"agentsConfigDir": "/custom/config/path",
"agentsDirectories": [
"./agents",
"./more-agents"
],
"agentsFiles": [
"./main-agent.json"
],
"promptAliases": {
"translate": {
"systemPrompt": ["You are a translator..."],
"userPromptPrefix": "Translate to English:"
}
},
"selfDescribeSlug": "my-agent",
"selfDescribeDescription": "A custom agent",
"agentsLogs": {
"logJsonHttpEndpoint": "http://localhost:8080/log",
"logJsonPath": "./logs/agents.json",
"logRawPath": "./logs/agents.log"
},
"sessions": {
"writeLocation": "./sessions/",
"readLocations": [
"./sessions/",
"./.agents-sessions/",
"~/.config/agents-exe/sessions/"
]
}
}Search order:
- Current directory
- Parent directories (upward search)
Sessions Configuration
The sessions section configures multi-location session storage:
| Field | Type | Description |
|---|---|---|
writeLocation | FilePath | Directory where new sessions are written |
readLocations | [FilePath] | Directories to search for existing sessions |
Key behaviors:
- Deduplication: First location in
readLocationshas highest priority for duplicate session IDs - Auto-prepending: If
writeLocationis not inreadLocations, it’s automatically prepended - Tilde expansion: Paths like
~/.config/agents-exe/sessions/are resolved to the user’s home directory - Backwards compatibility: If
sessionsis not present, falls back toagentsLogs.logSessionsJsonPrefix(deprecated)
Environment Variables
| Variable | Description |
|---|---|
AGENTS_API_KEY | Default API key (overrides file) |
AGENTS_CONFIG_DIR | Config directory path |
AGENTS_LOG_LEVEL | Logging verbosity |
AGENT_MD_VIEWER | External markdown viewer for TUI session viewing |
Exit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | General error |
2 | Invalid arguments |
3 | Configuration error |
4 | Agent loading error |
5 | Tool execution error |
10 | Export error |
11 | Import error |
Examples
Complete Workflow
# 1. Initialize new agent
agents-exe new agent my-assistant
# 2. Create a custom tool
agents-exe new tool file-reader python ./tools/file-reader
# 3. Edit tool and agent configurations
# (edit files as needed)
# 4. Check configuration
agents-exe check --agent-file ./my-assistant.json
# 5. Test with one-shot
agents-exe run --agent-file ./my-assistant.json --prompt "Test"
# 6. Start interactive session
agents-exe tui --agent-file ./my-assistant.json
# 7. Export for sharing
agents-exe export --agent-file ./my-assistant.json --output ./my-assistant.tar.gz
# 8. Import elsewhere
agents-exe import --from-file ./my-assistant.tar.gz --to ./new-location/Multi-Agent Setup
# Start multi-agent TUI
agents-exe tui \
--agent-file ./router.json \
--agent-file ./coder.json \
--agent-file ./reviewer.json
# Start multi-agent MCP server
agents-exe mcp-server \
--agent-file ./router.json \
--agent-file ./coder.jsonSession Management Workflow
# Run an agent session
agents-exe run \
--agent-file ./my-agent.json \
--session-file ./session.json \
--prompt "Let's work on a project"
# Later, inspect the session
agents-exe session-print ./session.json
# List all tool calls from the session
agents-exe list-tool-calls ~/.config/agents-exe/sessions/session-*.json
# Replay a specific tool call for debugging
agents-exe replay-tool-call \
--session ./session.json \
--tool-call 0 \
--tool ./tools/read-file.sh \
--validate-only
# Trim to last 20 turns
agents-exe session-edit --take-tail --count 20 < ./session.json > ./trimmed.json
mv ./trimmed.json ./session.json
# Continue the session
agents-exe run \
--agent-file ./my-agent.json \
--session-file ./session.json \
--prompt "Where were we?"Session Search Workflow
# Build the search index
agents-exe session-index --build
# Search for error-related sessions
agents-exe session-search "error" --json
# Find sessions using specific tool after a date
agents-exe session-search "config" --after 2024-01-01 --tool write-file
# Search with context preview
agents-exe session-search "TODO" --preview 3
# Auto-update index before searching
agents-exe session-search "refactor" --auto --limit 10Multi-Modal Workflow
# Analyze a screenshot with a vision-capable agent
agents-exe run \
--agent-file ./vision-agent.json \
-m ./screenshot.png \
--prompt "What UI issues do you see in this screenshot?"
# Analyze multiple images
agents-exe run \
--agent-file ./design-agent.json \
-m ./mockup-v1.png \
-m ./mockup-v2.png \
--prompt "Compare these two design mockups and recommend which to use"
# Analyze a PDF document
agents-exe run \
--agent-file ./document-agent.json \
-m ./report.pdf \
--prompt "Summarize the key findings and recommendations"
# Combine image with code for debugging
agents-exe run \
--agent-file ./debug-agent.json \
--prompt "This error appears in the UI:" \
-m ./error-screenshot.png \
--sep4 "----" \
--prompt "Here's the relevant code:" \
--file ./src/Main.hsAutomation
# Process all files in directory
for file in *.txt; do
agents-exe run \
--agent-file ./processor.json \
--prompt "Process this file:" \
--file "$file" \
--prompt "End of file."
done
# Git pre-commit hook
agents-exe run \
--agent-file ./reviewer.json \
--shell "git diff --cached" \
--prompt "Review these changes."
# Daily summary from logs
agents-exe run \
--agent-file ./summarizer.json \
--shell "cat /var/log/app.log | tail -100" \
--prompt "Summarize any errors or warnings"
# Automated image analysis with timestamp
agents-exe run \
--agent-file ./monitor-agent.json \
-m ./screenshots/$(date +%Y%m%d-%H%M%S).png \
--prompt "Check for any alerts or errors in this status dashboard"Developer Workflow
# Learn the tool protocol
agents-exe spec bash-tools
# Create and validate a tool
agents-exe new tool my-validator bash ./tools/my-validator
# (edit the tool)
agents-exe describe-tool ./tools/my-validator --format pretty
# Validate a payload
echo '{"input": "test"}' | agents-exe check-tool-call --tool ./tools/my-validator
# Test the tool directly
echo '{"input": "test"}' | agents-exe tool-call my-validator
# Create agent with dev tools
agents-exe new agent dev-assistant
# (add DeveloperToolbox to builtinToolboxes)
# Now the agent can use developer file-editing tools and show specs!
# Create a tool that outputs media
agents-exe new tool chart-generator bash ./tools/chart-gen
# Add to describe output:
# "output-media-type": "image/png"
# Now the tool's output is treated as a PNG imageDebugging Tool Calls
# Run an agent session
agents-exe run --agent-file ./my-agent.json --prompt "Read the README"
# Find the session file
agents-exe paths
# List all tool calls
agents-exe list-tool-calls ~/.config/agents-exe/sessions/session-*.json
# Replay with validation only
agents-exe replay-tool-call \
--session ~/.config/agents-exe/sessions/session-xxx.json \
--tool-call 0 \
--tool ./tools/read-file.sh \
--validate-only
# Actually replay the tool call
agents-exe replay-tool-call \
--session ~/.config/agents-exe/sessions/session-xxx.json \
--tool-call 0 \
--tool ./tools/read-file.shRelated Documentation
- tools.md - Tool system details
- tui.md - Terminal UI documentation
- sessions.md - Session management
- architecture.md - System architecture