apus agent runs a single agent turn from the command line without an inbound chat message. Use it for scripted workflows, testing, and programmatic delivery. Full flag and behavior reference: Agent CLI reference.

For strict, ephemeral CI or coding automation that should own setup, cleanup, output projection, and process status, use apus agent exec.

Quick start

Run a simple agent turn

```bash
apus agent --agent main --message "What is the weather today?"
```

Sends the message through the Gateway and prints the reply.

Send a multiline prompt from a file

```bash
apus agent --agent ops --message-file ./task.md
```

Reads a valid UTF-8 file as the agent message body.

Target a specific agent or session

```bash
# Target a specific agent
apus agent --agent ops --message "Summarize logs"

# Target a phone number (derives session key)
apus agent --to +15555550123 --message "Status update"

# Reuse an existing session
apus agent --session-id abc123 --message "Continue the task"

# Target an exact session key
apus agent --session-key agent:ops:incident-42 --message "Summarize status"
```

Deliver the reply to a channel

```bash
# Deliver to WhatsApp (default channel)
apus agent --to +15555550123 --message "Report ready" --deliver

# Deliver to Slack
apus agent --agent ops --message "Generate report" \
  --deliver --reply-channel slack --reply-to "#reports"
```

Flags

Flag Description
--message <text> Inline message to send
--message-file <path> Read the message from a valid UTF-8 file (max 4 MiB)
--to <dest> Derive session key from a target (phone, chat id)
--session-key <key> Use an explicit session key
--agent <id> Target a configured agent (uses its main session)
--session-id <id> Reuse an existing session by id
--model <id> Model override for this run (provider/model or model id)
--local Force local embedded runtime (skip Gateway)
--deliver Send the reply to a chat channel
--channel <name> Delivery channel; with --agent + --to, also applies DM scope
--reply-to <target> Delivery target override
--reply-channel <name> Delivery channel override
--reply-account <id> Delivery account id override
--thinking <level> Set thinking level for the selected model profile
--verbose <on|full|off> Persist verbose level for the session (full also logs tool output)
--timeout <seconds> Override agent timeout (default 600, or config value)
--json Output structured JSON

Behavior

Examples

# Simple turn with JSON output
apus agent --to +15555550123 --message "Trace logs" --verbose on --json

# Turn with a model override
apus agent --agent ops --model openai/gpt-5.4 --message "Summarize logs"

# Turn with thinking level
apus agent --session-id 1234 --message "Summarize inbox" --thinking medium

# Multiline prompt from a file
apus agent --agent ops --message-file ./task.md

# Exact session key
apus agent --session-key agent:ops:incident-42 --message "Summarize status"

# Bare key scoped to an agent
apus agent --agent ops --session-key incident-42 --message "Summarize status"

# Deliver to a different channel than the session
apus agent --agent ops --message "Alert" --deliver --reply-channel telegram --reply-to "@admin"

Related

Agent CLI reference

Full `apus agent` flag and option reference.

Sub-agents

Background sub-agent spawning.

Sessions

How session keys work and how `--to`, `--agent`, and `--session-id` resolve them.

Reactions

Emoji reaction semantics for the `react` action, per channel.

Slash commands

Native command catalog used inside agent sessions.

ACP agents

External agents reachable over ACP.