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

  1. Each autonomous agent has a heartbeat: every N seconds, scan the task board.

  2. If an unclaimed, ready task exists — claim it and start working.

  3. 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

ComponentBefore (s16)After (s17)
AssignmentLead assignsSelf-claim from board
Idle behaviorWait for messageScan for work
BottleneckLead is singleTeammates self-organize

Try It

cd learn-claude-code
python agents/s17_autonomous_agents.py
  1. Create 5 tasks and start 2 autonomous teammates
  2. Watch them claim and complete tasks without intervention
  3. Add 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.