Claude Certification
Claude Code Configuration & Workflows
Lesson 6 · 9 min

Claude Agent SDK

Building custom agents on the same primitives as Claude Code.

The Agent SDK (Python/TS) gives you the loop: prompt, tool registry, message history, permissions, and a session object. Use it when you need an agent inside your own product rather than as a CLI.

Production scenario

Real-world example: Code-review agent in CI

A team builds a code-review agent on the Agent SDK and runs it on every pull request:

from claude_agent_sdk import Session, Tool

session = Session(
    system="You review pull requests for security, performance, and readability.",
    tools=[Tool("read_file"), Tool("list_files"), Tool("git_diff")],
)
review = await session.run(f"Review PR #{pr_number}. Comment inline.")
post_to_github(review)

The same loop that powers Claude Code (history, tools, permissions) now lives inside their CI. The reviewer is consistent across PRs and never gets tired.

Why this matters: the Agent SDK is what you reach for when you want Claude Code's *behavior* embedded in your own product, not Claude Code itself as a CLI.

Knowledge points in this lesson
  • Agent SDK exposes Claude Code's primitives
  • Available in Python and TypeScript
  • Session owns history, tools, permissions
  • Build in-product agents, not just CLI
  • Tool registry mirrors MCP shape
Quick check
Claude CodeSelect one
Where do user-wide permissions live in Claude Code?