Your First Town
Let’s build a real workflow: coordinating agents to implement and review a feature.
The Scenario
You want to:
- Have one agent implement a feature
- Have another agent write tests
- Have a third agent review both
Project Setup
# Create and enter your project
mkdir feature-builder && cd feature-builder
# Initialize git (optional but recommended)
git init
# Initialize tinytown
tt init --name feature-builder
Understanding the Config
Open tinytown.toml:
name = "feature-builder"
default_cli = "claude"
max_agents = 10
[redis]
use_socket = true
socket_path = "redis.sock"
Key settings:
use_socket = true— Uses Unix socket for ~10x faster communication than TCPdefault_cli— Agent CLI when--modelisn’t specifiedmax_agents— Prevents accidentally spawning too many
Create Your Team
# The implementer
tt spawn dev --model claude
# The tester
tt spawn tester --model auggie
# The reviewer
tt spawn reviewer --model codex
Check your team:
tt list
Agents:
dev (550e8400-...) - Starting
tester (6ba7b810-...) - Starting
reviewer (6ba7b811-...) - Starting
Assign the Work
# Implementation task
tt assign dev "Create a REST API endpoint POST /users that:
- Accepts {email, password, name}
- Validates email format
- Hashes password with bcrypt
- Returns {id, email, name, created_at}"
# Testing task
tt assign tester "Write integration tests for POST /users:
- Test successful creation
- Test duplicate email rejection
- Test invalid email format
- Test missing required fields"
# Review task
tt assign reviewer "Review the implementation and tests when ready:
- Check for security issues
- Verify error handling
- Ensure tests cover edge cases"
Monitor Progress
# See overall status
tt status
# Watch for changes (re-run periodically)
watch -n 5 tt status
What Happens Behind the Scenes
- Task Creation: Each
tt assigncreates aTaskwith a unique ID - Message Sending: A
Messageof typeTaskAssignis sent to the agent’s inbox - Redis Queue: Messages are stored in town-isolated Redis lists (
tt:<town>:inbox:<agent-id>) - Agent Pickup: Agents receive messages via
BLPOP(blocking pop) - State Tracking: Agent and task states are stored in Redis
Connecting Real Agents
Tinytown creates the infrastructure, but you need to connect actual AI agents. The spawn command prepares the configuration; you then run the agent:
# Example: Run Claude CLI pointing at your town
cd agents/dev
claude --print # Uses the model command from config
Or with Augment:
cd agents/tester
augment # Uses the model command from config
Cleanup
When you’re done:
# Stop the town's agents
tt stop
# Or just Ctrl+C if running `tt start`
Next Steps
- Core Concepts — Deep dive into Towns, Agents, Tasks
- Multi-Agent Tutorial — More complex coordination patterns