Claude Agent SDK Integration
Deep integration blueprint: weaving @anthropic-ai/claude-agent-sdk into 12 Paths as the practice substrate for building real agents.
Why Claude Agent SDK as Practice Substrate
Theory Made Concrete
Every concept in docs/ maps to a real SDK API. "What is an agent loop?" becomes query() streaming messages. "What is tool use?" becomes allowedTools + canUseTool. No abstract pseudocode.
Progressive Complexity
SDK surface area graduates perfectly with the 3-track structure: Track 1 uses query() + tools. Track 2 adds session + hooks. Track 3 unlocks MCP + subagents + sandbox.
Real Over Simulated
Learners run actual agent code on their machine. Not a sandbox simulator, not pseudocode, not a framework wrapper. Direct SDK calls with real Claude API responses. Copy, paste, run.
Integration Strategy: Inline, Not Parallel
SDK code blocks are woven into existing lesson text, not as a separate "Lab" page. When a lesson explains "the agent loop", the SDK code block appears right there, showing the real implementation. Exercises at the end of each Path use SDK as their only language.
SDK Concept Graduation Map
Each row shows which SDK APIs are introduced at that level. dark = first introduced. light = carried forward from earlier.
Explorer
Explorer
Apprentice
Apprentice
Apprentice
Builder
Builder+
Builder+
Expert
Prerequisites (shown before P1)
Environment Setup
node --version to verifynpm install -g @anthropic-ai/claude-codeexport ANTHROPIC_API_KEY="sk-ant-..."npm init -y && npm i @anthropic-ai/claude-agent-sdk zodnpm i -D typescript tsx && npx tsc --initLearner-Level Adaptation
L1 Explorers only need steps 1-4. TypeScript is introduced at P3 with Zod schemas. The setup page detects the learner's current level and shows only the relevant steps.
Path-by-Path SDK Details
Detailed SDK integration for each of the 12 Paths (lessons, exercises, gates) has been merged into the Curriculum page. Each Path card shows SDK Focus APIs and per-lesson integration points inline.
Impact on Other Learn Modules
Flashcards
Add "Claude Agent SDK" deck: ~40 cards covering API signatures, error codes, message types, hook events. Auto-generated from exercises.
Skills Library
Each SDK API becomes a skill entry. Skill detail pages link to the Path where the API is introduced. "Generate FlashCard" button creates SDK-specific cards.
Chat Sim (AI Tutor)
Tutor recognizes SDK code in questions. Can explain error codes, suggest fixes for known issues, and walk through API usage step by step.
Exercises Index
Replace "Coming Soon" placeholders with real SDK exercises. Each card shows: SDK APIs used, prerequisite Path, estimated time.
Progress Dashboard
Track SDK API coverage: "You've used 8/13 core APIs". Badge triggers: "First query()" = Tried badge, "All hooks used" = Master badge.
Daily Quests
New quest types: "What error code means X?", "Which hook fires when Y?", "Write a canUseTool for scenario Z".
SDK API ↔ Path Coverage Matrix
Spiral Learning
Every SDK API appears at least twice: once at introduction (simplified, isolated), once at deepening (combined with other APIs), and optionally at mastery (production-grade, edge cases). This mirrors the competency matrix: Aware → Solid → Edge cases.
Key Design Decisions
Inline over Parallel
SDK code lives inside lesson text, not in separate "lab" pages. Reduces navigation, keeps theory and practice co-located. Learner never has to context-switch between "the concept page" and "the code page".
Copy-Paste-Run over Playground
No browser-based code editor. Learners run real code on their machine with real API calls. This is production-skill transfer, not sandboxed simulation. The tradeoff: requires setup (Node.js + API key), but produces genuinely capable practitioners.
TypeScript-First from P3
P1-P2 use plain JavaScript for lowest barrier. P3 introduces TypeScript via Zod (structured output requires it). From P3 onward, all code is TypeScript. This mirrors the SDK's own design.
Error Prevention as Curriculum
The SDK's 14 known issues become teaching moments, not just a reference table. Issue #4 (context overflow) teaches session management. Issue #13 (MCP type field) teaches configuration discipline. Errors are the curriculum.
Level-Appropriate Complexity
L1 sees query("hello"). L3 sees hooks + sessions + tools. L5 sees sandbox + subagents + MCP + checkpointing. The SDK surface area grows exactly as the learner's competency grows. No API is shown before the learner is ready for it.