Lesson 09.04 · Phase 09 · Frameworks & SDKs

Claude Agent SDK

The Claude Agent SDK doesn't give you a loop to configure; it gives you a whole harness. Claude Code's loop, file tools, shell, context management and permission system run as a subprocess, and your program streams messages from it. Your job moves from writing the loop to deciding what the agent may do: allow rules, permission modes, hooks and a permission callback.

Learning objectives

  • Explain what changes when the framework is a full harness rather than a loop library.
  • Implement layered permissions: hooks, deny and allow rules, permission modes and a canusetool callback.
  • Add an in-process custom tool exposed as mcp<server><tool>.
  • Stream a run as typed messages (system init, assistant, user tool results, result) and resume a session by id.

You want an agent that edits a repository: read files, change them, run commands. Phase 10 builds those tools from scratch, and there's a lot to get right: path jails, unique-match edits, shell timeouts, context compaction for long sessions, and above all permission to act. One bad rm -rf and the demo becomes an incident.

Loading the full lesson…