
Building a Custom Agent with the Claude Agent SDK
A practical, code-first walkthrough of the Claude Agent SDK: custom tools, MCP servers, and subagents — the same engine that powers Claude Code, in your own app.

A practical, code-first walkthrough of the Claude Agent SDK: custom tools, MCP servers, and subagents — the same engine that powers Claude Code, in your own app.

Claude Code is the most agentic coding CLI Anthropic ships — but it does not have to talk to Anthropic. Because Claude Code speaks the standard Anthropic Messages API, you can point it at any compatible endpoint with a single environment variable. That means OpenRouter, your local Ollama server, a private LiteLLM proxy, or a self-hosted model behind your own router all work without forking the source. This guide walks through the three setup paths, which models actually deliver usable tool-use at each tier, what breaks, and when you should stop and switch back to the official API. ...