The core building blocks that turn a prompt into an autonomous, tool‑using loop — and how Python and TypeScript expose them.
Every SDK call runs the same cycle Claude Code runs internally: read context, decide, act, observe — repeat until the task is done or a limit stops it.
Hooks sit inside the loop, not beside it — intercepting a call before it runs, or rewriting its result after, without touching the tool's own code.
A skill is a folder of instructions for one kind of task — loaded only when it's relevant, instead of sitting in context the whole session.
Claude sees a name and one‑line description for every available skill up front — the full instructions stay out of context until needed.
When a request matches, Claude invokes the Skill tool and loads the relevant instructions into the active context — e.g. a docx skill only when a Word file is due.
Several skills can combine in one task — a research skill to gather facts, then a document skill to format the result.
Tool calls pass through hooks, rules and the active permission mode. Your callback handles calls that still need an application-level decision.
Wrap your own function so Claude can call it like any built‑in — no separate process to run or manage.
A subagent works in its own context. The parent receives its returned result rather than the full working transcript, while the application can optionally observe intermediate activity.
Each run has a session_id. Sessions are stored locally by default and can be continued, resumed, forked, or mirrored to external storage.
Connect local or remote MCP servers through stdio, SSE, or Streamable HTTP. For large catalogs, Tool Search can defer detailed schemas until Claude needs them.
Two hard limits bound an open-ended run; a third control trades speed and cost for reasoning depth.
Caps tool‑use round trips. Hit it and the run stops with error_max_turns plus partial output.
Stops the query when the SDK’s cumulative client-side cost estimate reaches the threshold.
low to max — trades speed and cost for reasoning depth, per turn.
As a conversation approaches its context limit, the runtime compacts earlier context into a summary while retaining the recent working state needed to continue.
Broadly the same agent runtime, exposed through different language idioms — with occasional differences in API shape and release timing.
ClaudeSDKClient auto‑tracks across callssnake_case options@tool decoratorquery() with continuation or resume optionscamelCase optionstool() helperEvery module exists to shape one thing: what happens inside the loop.
The pieces change what the loop can do — the loop is still the thing.