Chapter 29 · CLI
Agent SDK and API: building on Claude Code
The Agent SDK lets you build applications using Claude Code capabilities as a library: tools, sessions, hooks and permissions. It is a developer appendix, different from the regular Claude subscription for daily use.
Video
Steps
- Understand the difference: the SDK is for building products and processes, with an API key and usage pricing, not a consumer subscription.
- Walk the SDK quickstart and run a minimal example in a development environment.
- Map the familiar concepts: session, tools, hooks and permissions exist in the SDK too, with the same caution principles.
- Manage API keys as secrets: environment variables or a secret manager, never in code or git.
Common pitfall: An API key exposed in git is stolen within minutes by automated scanners; revoke and replace a leaked key immediately.
Hands-on exercise: Read the SDK overview page and record three differences between it and regular Claude Code use.
Filmed demo · Video is added in the media phase
Recap
Comprehension check
What is the difference between the Agent SDK and a regular Claude subscription?
Recap
- SDK = library for building applications
- API keys are secrets
- Same permission principles apply in code