AI Agent Learning

Learning Path

Lesson 0 to 13: Progressive Agent Design with OpenAI Java SDK

Layer Legend

Tools & Execution
Planning & Coordination
Memory Management
Concurrency
Collaboration
00
L00Minimal chat completion loop

Basic Chat LoopThe Foundation of Every Agent

50 lines of code0 tools

The simplest agent is just a while loop calling the model

Learn More
01
L01Function calling + tool dispatch

Tool UseFunction Calling Basics

143 lines of code1 tools

Function calling turns a chat model into an agent that can act

Learn More
02
L02Tool dispatch map

ToolsOne Handler Per Tool

329 lines of code4 tools

The loop stays the same; new tools register into the dispatch map

Learn More
03
L03TodoManager + nag reminder

TodoWritePlan Before You Act

469 lines of code5 tools

An agent without a plan drifts; list the steps first, then execute

Learn More
04
L04Subagent spawn with isolated context

SubagentsClean Context Per Subtask

408 lines of code5 tools

Subagents use independent context, keeping the main conversation clean

Learn More
05
L05SkillLoader + two-layer injection

SkillsLoad on Demand

414 lines of code5 tools

Inject knowledge via tool_result when needed, not upfront in the system prompt

Learn More
06
L06micro-compact + auto-compact + archival

CompactThree-Layer Compression

422 lines of code5 tools

Context will fill up; three-layer compression enables infinite sessions

Learn More
07
L07TaskManager with file-based state

TasksTask Graph + Dependencies

640 lines of code8 tools

A file-based task graph with ordering, parallelism, and dependencies

Learn More
08
L08BackgroundManager + notification queue

Background TasksBackground Threads + Notifications

474 lines of code6 tools

Run slow operations in the background; the agent keeps thinking ahead

Learn More
09
L09TeammateManager + file-based mailbox

Agent TeamsTeammates + Mailboxes

644 lines of code0 tools

When one agent can't finish, delegate to persistent teammates via async mailboxes

Learn More
10
L10request_id correlation for protocols

Team ProtocolsShared Communication Rules

554 lines of code0 tools

One request-response pattern drives all team negotiation

Learn More
11
L11Task board polling + self-governance

Autonomous AgentsScan Board, Claim Tasks

353 lines of code0 tools

Teammates scan the board and claim tasks themselves; no need for assignment

Learn More
12
L12Worktree lifecycle + event stream

Worktree IsolationIsolate by Directory

484 lines of code0 tools

Each works in its own directory; tasks manage goals, worktrees manage directories

Learn More
13
L13All mechanisms combined

Full Reference AgentCapstone — Everything Combined

829 lines of code0 tools

The capstone combines every mechanism from Lessons 1–12 into one agent

Learn More

LOC Growth

L00
50
L01
143
L02
329
L03
469
L04
408
L05
414
L06
422
L07
640
L08
474
L09
644
L10
554
L11
353
L12
484
L13
829