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]
OptionDefaultDescription
--api-keys FILE~/.config/agents-exe/secret-keysPath 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 FILEagents-logfileRaw 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:

OptionDescription
--tools MODETool display mode: none, list, agents-exe, openai (default: none)
--show-configPrint 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 successfully
  • 1 - 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-exe

run

Execute a one-shot agent conversation.

agents-exe run [OPTIONS]

Options:

OptionDescription
--session-file FILEResume from existing session
--thinking TARGETOutput thinking: none, stdout, stderr (default: none)
-m, --media MEDIAAttach media file (can be specified multiple times)
--prompt TEXTInitial prompt text
--file FILERead prompt from file
--shell COMMANDUse shell command output as prompt
--alias NAMEUse predefined prompt alias
--sep4 TEXTShort separator (4 chars)
--sep40 TEXTLong separator (40 chars)
--session-xs FILEInject session at minimal verbosity
--session-s FILEInject session at low verbosity
--session-m FILEInject session at medium verbosity
--session-l FILEInject session at high verbosity
--session-xl FILEInject 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:

CategoryExtensionsMIME Types
Images.png, .jpg, .jpeg, .gif, .webp, .svgimage/png, image/jpeg, image/gif, image/webp, image/svg+xml
Documents.pdf, .txt, .md, .json, .xmlapplication/pdf, text/plain, text/markdown, application/json, application/xml
Audio.mp3, .wav, .ogg, .aac, .flacaudio/mp3, audio/wav, audio/ogg, audio/aac, audio/flac
Video.mp4, .webm, .mov, .avivideo/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.py

tui

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:

OptionDefaultDescription
--keymap FILE, -k FILEnonePath to a keymap configuration JSON file
--db PATHnext to the resolved sessions directorySQLite 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\|PATHnoneDrive 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 TOKENnoneBearer token for --attach, when the server runs with --auth-tokens.
--token-file FILEnoneThe 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 agents
  • Enter - Send message
  • Ctrl+C - Quit
  • Up/Down - Scroll history
  • Ctrl+[ / Ctrl+] - Previous/Next tab
  • Ctrl+E - Pause/unpause conversation
  • Ctrl+D (when paused) - Clear queued messages
  • Ctrl+F - Attach file
  • Ctrl+Shift+F - Clear all attachments
  • Ctrl+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-token

spectate

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:

OptionDefaultDescription
--attach URL\|PATHrequiredThe server to watch. Same forms as tui --attach: http://HOST:PORT, https://..., unix:///path/to.sock, or a bare socket path.
--token TOKENnoneBearer token, when the server runs with --auth-tokens. spectate then sees that owner's sessions only.
--token-file FILEnoneThe same, read from a file.
--panels SPECtree:60+tools:40/45,text/55The panels shown, their places and sizes (see below).
--refresh SECONDS1Time between two refreshes of the screen, from 0.1 to 60; decimals are accepted (0.5).
--layout-file FILE~/.config/agents-exe/spectate-layoutThe saved layout: read at start when the file exists, written by the W key.

Layout:

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 (or agents), tools or text; one that is not named is hidden, and none can be named twice;
  • :N after a panel is its share of its column’s height, and /N after 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, wide

Between 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 (or k / j) - Select a session in the tree; the text panel shows it
  • f - Follow the session that writes, again
  • PgUp / PgDn - Scroll the text
  • 1 / 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 column
  • Tab / 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 column
  • s - Stack it under the column before, or give it a column of its own
  • 0 - Back to the layout at start
  • d / 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
  • ? or h - Show the keys, and the --panels/--refresh flags that reproduce the layout on screen
  • q, Esc or Ctrl+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.5

A 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.json

echo-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.txt

session-print

Display a session file in markdown format.

agents-exe session-print [OPTIONS] SESSIONFILE

Options:

OptionDescription
--show-tool-call-results MODEDisplay mode: hidden, shown, elided (default: hidden)
--show-tool-call-arguments MODEDisplay mode: hidden, shown, elided (default: hidden)
--n-turns NLimit to last N turns
--repeat-system-promptShow system prompt each turn
--repeat-toolsShow available tools each turn
--antichronologicalNewest first (default: oldest first)
--no-funny-stampSkip 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.json

session-edit

Edit a session file (reads JSON from STDIN, writes JSON to STDOUT).

agents-exe session-edit [OPTIONS] < input.json > output.json

Options:

OptionDescription
--takeTake first N turns (use with --count)
--take-tailTake last N turns (use with --count)
--dropDrop first N turns (use with --count)
--drop-tailDrop last N turns (use with --count)
--count N, -n NNumber of turns for take/drop operations
--censor-tool-callsRemove all tool calls
--censor-thinkingRemove 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.json

session-index

Manage the SQLite FTS5 search index for session files.

agents-exe session-index [OPTIONS]

Options:

OptionDescription
--buildBuild the search index from scratch
--updateIncrementally update the search index
--statusShow index status (default)
--cleanRemove the search index
--db-path PATHPath to search index database (default: .agents-search.db)
--include-tool-outputsInclude 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 tokenizer
  • tool_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.db

Search session files with fuzzy text matching and filtering.

agents-exe session-search [OPTIONS] "QUERY"

Arguments:

ArgumentDescription
QUERYSearch query text (supports fuzzy matching)

Options:

OptionDescription
--db-path PATHPath to search index database
--after DATEFilter sessions after date (YYYY-MM-DD)
--before DATEFilter sessions before date (YYYY-MM-DD)
--tool TOOLNAMEFilter by tool name (can specify multiple)
--agent SLUGFilter by agent slug
--include-tool-outputsInclude tool outputs in search
--jsonOutput results as JSON
--preview NShow N lines of context around matches
--limit NLimit to N results
--autoAuto-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 --json

JSON 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] SESSIONFILE

Options:

OptionDescription
-f, --format FORMATOutput 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 arguments
  • json - JSON array for machine processing
  • brief - 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 brief

Example 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:

OptionDescription
-s, --session FILEPath to the session file containing the tool call
-i, --tool-call INDEXIndex of the tool call to replay (0-based)
-t, --tool TOOLPATHPath to the tool script to execute
--validate-onlyOnly validate arguments, don't execute
--rawShow 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 \
  --raw

Example 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:

ArgumentDescription
TOOLNAMEName of the tool to call

Options:

OptionDescription
-l, --log-file FILEOptional 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.log

serve

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:

OptionDefaultDescription
--db FILE\|URLnext to the resolved sessions directorySQLite file, or postgresql:// URL, for sessions and continuations
--bind HOST127.0.0.1Address to listen on
--port PORT8080Port to listen on
--live-session-ttl SECONDS900Idle time before a session's in-memory state is dropped
--shutdown-grace SECONDS10Time open requests get to finish on shutdown
--auth-tokens FILE(none)Bearer tokens and their owners; without, no authentication
--stream-tokensoffStream LLM answers as text.delta events
--admin-owners OWNER,…(none)Owners allowed to store and delete agents over the API (needs --auth-tokens)
--no-uioffDo 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.json

check-tool-call

Validate a tool call payload against a tool schema (reads JSON from stdin).

cat payload.json | agents-exe check-tool-call --tool TOOLPATH

Options:

OptionDescription
-t, --tool TOOLPATHPath 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.sh

Example 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 configuration
  • tools/ - Tool directory
  • secret-keys - API keys file (if doesn’t exist)

Example:

agents-exe init --agent-file ./my-agent.json

new

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:

ArgumentDescription
SLUGUnique identifier for the agent
FILEOutput file path
MODELModel name (e.g., gpt-4o, mistral-large). The provider preset is inferred from the model catalog.

Options:

OptionDescription
--add-to-configAdd the agent to the agentsFiles of agents-exe.cfg.json when it is not listed there, without asking
--no-add-to-configNever modify agents-exe.cfg.json
-f, --forceOverwrite 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.json

What a new agent can do:

A new agent works on the directory it is started from:

ToolboxGives 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-config to add it without being asked, --no-add-to-config to 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:

ArgumentDescription
SLUGUnique identifier for the tool
LANGUAGEProgramming language: bash, python, haskell, node
FILEOutput file path (without extension)

Options:

OptionDescription
-f, --forceOverwrite 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-tool

Generated 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
    ;;
esac

Next steps after creating a tool:

  1. Edit the args array in the describe function
  2. Implement the run function logic
  3. 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:

OptionDescription
-f, --forceOverwrite 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 init

The 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
ArgumentDescription
FILEPath 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 list
config 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
ArgumentDescription
NAMEName 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.json

spec

Display embedded specification documentation.

agents-exe spec TOPIC

Topics:

TopicDescription
bash-toolsBinary tool protocol specification

Examples:

# Display bash-tools specification
agents-exe spec bash-tools

Use 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:

OptionDescription
-f, --format FORMATOutput format: json or pretty (default: json)
--check-onlyOnly 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-only

Output:

{
  "slug": "my-tool",
  "description": "What this tool does",
  "args": [...],
  "empty-result": {...}
}

paths

Show important configuration paths.

agents-exe paths [OPTIONS]

Options:

OptionDescription
--jsonOutput 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 --json

Example 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:

OptionDescription
--allExport all loaded agents
--agent-slug SLUGExport specific agent by slug
--tools-onlyExport only tools, not agent config
--tool TOOLNAMEExport specific tool

Destination Options:

OptionDescription
-o, --output FILEOutput file path
--git-url URLGit remote URL
--git-branch BRANCHGit branch
--git-message MESSAGECommit message
--git-pushPush after commit
--git-tag TAGCreate git tag

Format Options:

OptionDescription
--format FORMATArchive format: tar, tar.gz, zip
--namespace NAMESPACENamespace for export (e.g., "team.project")
--no-toolsExclude tools from export
--no-mcpExclude 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.gz

import

Import agent/tool configurations from archive or git.

agents-exe import [OPTIONS]

Source Options:

OptionDescription
-f, --from-file FILEImport from archive file
--git-url URLImport from git URL
--git-ref REFGit ref (branch, tag, commit)
--namespace NAMESPACENamespace to import from

Destination Options:

OptionDescription
--to-currentImport to current directory
--to PATHImport to specific path
--to-config-dirImport to config directory
--install-to-agent FILEInstall tools to agent's tool directory
--install-to-tooldir DIRInstall tools to specific directory

Mode Options:

OptionDescription
--overwriteOverwrite existing files
--mergeMerge with existing files
(default)Fail on conflict

List Options:

OptionDescription
--list-namespacesList available namespaces (git only)
--list-toolsList 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:

OptionDescription
-W, --width WIDTHMaximum 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 cowsay

describe

Output self-describing schema for the agent.

agents-exe describe [OPTIONS]

Options:

OptionDescription
--self-describe-slug NAMEOverride the slug field
--self-describe-description DESCOverride 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-describe

Output: 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:

  1. Current directory
  2. Parent directories (upward search)

Sessions Configuration

The sessions section configures multi-location session storage:

FieldTypeDescription
writeLocationFilePathDirectory where new sessions are written
readLocations[FilePath]Directories to search for existing sessions

Key behaviors:

  • Deduplication: First location in readLocations has highest priority for duplicate session IDs
  • Auto-prepending: If writeLocation is not in readLocations, it’s automatically prepended
  • Tilde expansion: Paths like ~/.config/agents-exe/sessions/ are resolved to the user’s home directory
  • Backwards compatibility: If sessions is not present, falls back to agentsLogs.logSessionsJsonPrefix (deprecated)

Environment Variables

VariableDescription
AGENTS_API_KEYDefault API key (overrides file)
AGENTS_CONFIG_DIRConfig directory path
AGENTS_LOG_LEVELLogging verbosity
AGENT_MD_VIEWERExternal markdown viewer for TUI session viewing

Exit Codes

CodeMeaning
0Success
1General error
2Invalid arguments
3Configuration error
4Agent loading error
5Tool execution error
10Export error
11Import 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.json

Session 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 10

Multi-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.hs

Automation

# 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 image

Debugging 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.sh