agent

NAME

agent — spawn a one-shot sub-agent that blocks until completion

SYNOPSIS

agent [--model <id>] [--thinking <level>] [--read-only <paths>] <cwd> <allowed-commands> <prompt>

DESCRIPTION

Spawns a sub-scoop, feeds it a task, blocks until the agent loop completes, then prints the scoop's final message on stdout. The sub-scoop is ephemeral: it is automatically dropped when the command exits, leaving no persistent state or conversational context behind.

Unlike scoop_scoop, which creates a persistent scoop you can converse with via feed_scoop, agent is synchronous and one-shot. It behaves like any other shell command — it blocks, returns an exit code, writes to stdout/stderr, and composes with pipes, redirects, and background jobs.

ARGUMENTS

OPTIONS

SANDBOX

The spawned scoop operates in a restricted filesystem sandbox:

Read-only access (default)

Both are dropped when --read-only is passed.

Write access

Escape prevention

When invoked from a scoop shell, <cwd> must be writable by the calling scoop. A scoop cannot pass /scoops to gain write access over sibling sandboxes.

EXIT STATUS

WHEN TO USE

Prefer agent when the task is:

Prefer scoop_scoop when you need:

EXAMPLES

# Simple one-word response
agent . "*" "say hello in one word"

# Restricted allow-list for a focused file-counting task
agent /home ls,wc,find "how many files do I have in my home directory"

# Use a faster model for a quick summary
agent --model claude-haiku-4-5 . "*" "summarize the README in one sentence"

# High reasoning effort for a complex task
agent --thinking high . "*" "design a migration plan for the database schema"

# Custom read-only visibility
agent --read-only /workspace/,/shared/assets/ . "*" "review the docs and assets"

# Pipe result into downstream processing
SUMMARY=$(agent /tmp "curl,jq" "Fetch https://api.example.com/status and return the version field")
echo "Current version: $SUMMARY"

# Parallel extraction with background jobs
for url in site-a site-b site-c; do
  agent /tmp "curl,jq" "Fetch https://$url/api, return the top-level title field." >> /tmp/titles.txt &
done
wait

# Delegate a focused refactor with a restricted allow-list
agent /workspace/src "rg,sed,node" "Rename getCwd to getCurrentWorkingDirectory across *.ts"

NOTES

SEE ALSO

man delegation — orchestration patterns and when to delegate.
man scoop — persistent scoop lifecycle and management.
scoop_scoop — create a persistent, conversational sub-agent.
feed_scoop — send follow-up messages to persistent scoops.
models — list available model IDs for --model.