Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

tt spawn

Create and start a new agent.

Synopsis

tt spawn <NAME> [OPTIONS]

Description

Spawns a new worker agent in the town. This actually starts an AI process!

The agent:

  1. Registers in Redis with state Starting
  2. Starts a background process (or foreground with --foreground)
  3. Runs in a loop, checking inbox for tasks
  4. Executes the AI model (claude, auggie, etc.) for each task
  5. Stops after --max-rounds iterations

Arguments

ArgumentDescription
<NAME>Human-readable agent name (e.g., worker-1, backend, reviewer)

Options

OptionShortDescription
--model <MODEL>-mAI CLI to use (default: from tinytown.toml)
--max-rounds <N>Maximum iterations before stopping (default: 10)
--foregroundRun in foreground instead of background
--town <PATH>-tTown directory (default: .)
--verbose-vEnable verbose logging

Setting the Default CLI

Edit tinytown.toml to change which AI CLI is used by default:

name = "my-town"
default_cli = "auggie"

Then all tt spawn commands use that CLI:

tt spawn backend              # Uses auggie (from config)
tt spawn frontend --model codex   # Override to use codex

Built-in Agent CLIs

CLICommand (non-interactive)
claudeclaude --print --dangerously-skip-permissions
auggieauggie --print
codexcodex exec --dangerously-bypass-approvals-and-sandbox
aideraider --yes --no-auto-commits --message
geminigemini
copilotgh copilot
cursorcursor

These are the CLI tools that run AI coding agents, not the underlying models.

Examples

Spawn in Background (Default)

tt spawn worker-1
# Agent runs in background, logs to logs/worker-1.log

Spawn in Foreground (See Output)

tt spawn worker-1 --foreground
# Agent runs in this terminal, you see all output

Limit Iterations

tt spawn worker-1 --max-rounds 5
# Agent stops after 5 rounds (default is 10)

Spawn Multiple Agents (Parallel!)

tt spawn backend &
tt spawn frontend &
tt spawn tester &
# All three run in parallel

Output

🤖 Spawned agent 'backend' using model 'auggie'
   ID: 550e8400-e29b-41d4-a716-446655440000
🔄 Starting agent loop in background (max 10 rounds)...
   Logs: ./logs/backend.log
   Agent running in background. Check status with 'tt status'

What Happens

  1. Agent registered in Redis (tt:<town>:agent:<id>)
  2. Background process started running tt agent-loop
  3. Agent loop:
    • Checks inbox for messages
    • If messages: builds prompt, runs AI model
    • Model output logged to logs/<name>_round_<n>.log
    • Repeats until --max-rounds reached
  4. Agent stops with state Stopped

Agent Naming

Choose descriptive names:

Good NamesWhy
backendDescribes the work area
worker-1Simple numbered workers
reviewerDescribes the role
alicePersonality names work too
AvoidWhy
agentToo generic
aNot descriptive
SpacesUse hyphens instead

Agent State After Spawn

New agents start in Starting state, then transition to Idle:

Starting → Idle (ready for work)

Check state with:

tt list

Errors

Town Not Initialized

Error: Town not initialized at . Run 'tt init' first.

Solution: Run tt init or specify --town path.

Agent Already Exists

Agents are tracked by name. Spawning the same name creates a new agent with a new ID.

See Also