Teammates scan the board and claim tasks themselves
What You’ll Learn
- How to make teammates self-directed instead of hand-assigned
- How to implement an idle-scan-claim-resume cycle
- Why autonomy needs safety bounds
The Problem
The lead agent becomes a bottleneck — assigning every task, checking every result, micro-managing the team. This doesn’t scale to teams of 5, 10, or 20.
The Solution
Give teammates an autonomous cycle: idle, scan the task board, claim an available task, execute it, report the result.
Autonomous cycle:
+------------------+
| Idle (wait) |
+-------+----------+
|
v
+------------------+
| Scan board | <-- read tasks/task-*.json
+-------+----------+
|
v
+------------------+
| Claim task | <-- write status: in_progress, assignee: self
+-------+----------+
|
v
+------------------+
| Execute | <-- run agent loop with task prompt
+-------+----------+
|
v
+------------------+
| Report result | <-- write status: done, update task file
+------------------+
How It Works
-
Each autonomous agent has a heartbeat: every N seconds, scan the task board.
-
If an unclaimed, ready task exists — claim it and start working.
-
Safety bounds: max concurrent claims, max retry count, timeouts.
class AutonomousAgent(Teammate):
def run(self):
while self.active:
task = self.scan_board()
if task:
self.claim(task["id"])
result = self.execute(task)
self.report(task["id"], result)
time.sleep(IDLE_INTERVAL)
What Changed From s16
| Component | Before (s16) | After (s17) |
|---|---|---|
| Assignment | Lead assigns | Self-claim from board |
| Idle behavior | Wait for message | Scan for work |
| Bottleneck | Lead is single | Teammates self-organize |
Try It
cd learn-claude-code
python agents/s17_autonomous_agents.py
Create 5 tasks and start 2 autonomous teammatesWatch them claim and complete tasks without interventionAdd a new task mid-session and see an idle teammate pick it up
Key Takeaway
Autonomy is a bounded mechanism — idle, scan, claim, execute, report, repeat. Not magic, just a predictable cycle with safety limits.