claude-agent-sdk
Installation
Summary
Build autonomous AI agents with structured JSON validation, event-driven hooks, and 14 documented error preventions.
- Structured outputs (v0.1.45+) guarantee JSON schema validation with full TypeScript inference via Zod or raw schemas
- 12 hook events (PreToolUse, PostToolUse, SubagentStart, SubagentStop, etc.) enable event-driven workflows, custom permission logic, and cleanup patterns
- MCP server integration supports stdio, HTTP, and SSE transports with tool naming conventions and strict configuration validation
- Session management includes forking for safe exploration, V2 preview APIs for simpler multi-turn patterns, and file checkpointing for rollback capability
- Permission control via
canUseToolcallbacks and sandbox settings for secure execution with auto-approval logic and excluded command lists - Prevents 14 documented issues including CLI not found, context length session-breaking, MCP config gotchas (missing
typefield), Unicode line separator parsing, and subagent cleanup orphaning
SKILL.md
Claude Agent SDK - Structured Outputs & Error Prevention Guide
Package: @anthropic-ai/claude-agent-sdk@0.2.12 Breaking Changes: v0.1.45 - Structured outputs (Nov 2025), v0.1.0 - No default system prompt, settingSources required
What's New in v0.1.45+ (Nov 2025)
Major Features:
1. Structured Outputs (v0.1.45, Nov 14, 2025)
- JSON schema validation - Guarantees responses match exact schemas
outputFormatparameter - Define output structure with JSON schema or Zod- Access validated results - Via
message.structured_output - Beta header required:
structured-outputs-2025-11-13 - Type safety - Full TypeScript inference with Zod schemas
Example:
Related skills
More from jezweb/claude-skills
tailwind-v4-shadcn
|
2.7Ktanstack-query
|
2.5Kshadcn-ui
Install and configure shadcn/ui components for React projects. Guides component selection, installation order, dependency management, customisation with semantic tokens, and common UI recipes (forms, data tables, navigation, modals). Use after tailwind-theme-builder has set up the theme infrastructure, when adding components, building forms, creating data tables, or setting up navigation.
2.5Ktailwind-theme-builder
>
2.2Kfastapi
|
2.0Kcolor-palette
>
1.9K