Prerequisites
- Java 21 or later
- Maven 3.8+
- Claude CLI installed and authenticated (
claude login)
Tutorial Structure
| Part | Modules | Topics |
|---|---|---|
| 1. Fundamentals | 01-04 | Query API, ClaudeSyncClient, Message Types |
| 2. Configuration | 05-08 | CLI Options, Permissions, Structured Output |
| 3. Sessions & State | 09-12 | Multi-turn, Resume, Fork, Streaming |
| 4. Safety & Control | 13-16 | Callbacks, Hooks, Interrupts |
| 5. MCP Integration | 17-19 | External servers, Spring AI, Custom tools |
| 6. Multi-Agent | 20-22 | Subagents, Parallel execution, Patterns |
| Capstone | Final | Complete research agent project |
Getting the Code
Running a Module
Three API Styles
The SDK provides three ways to interact with Claude:| API | Class | Programming Style | Best For |
|---|---|---|---|
| One-shot | Query | Static methods | Simple queries, scripts |
| Blocking | ClaudeSyncClient | Iterator-based | Traditional applications, synchronous workflows |
| Reactive | ClaudeAsyncClient | Flux/Mono | Non-blocking applications, high concurrency |
ClaudeSyncClient and ClaudeAsyncClient support the full feature set: multi-turn conversations, hooks, MCP integration, and permission callbacks. They differ only in programming paradigm.
The tutorial primarily uses Query for simple examples and ClaudeSyncClient for advanced features (blocking is more accessible to most developers).