Understanding Intelligent Agents Starting with Claude Agent SDK
What is the Claude Agent SDK?
In simple terms, it is a development framework/library that allows developers to use Claude as an "intelligent brain" to build automated agents, which have the ability to:
- Read files, execute commands, search the web, and more
- Automatically manage conversation context, avoiding context misalignment
- Run complex workflows rather than single Q&A
- Support Python and TypeScript/Node.js development environments
Agent Runtime (Agent Loop)
The SDK includes a complete agent loop, which consists of:
- Decision: Understand the task
- Planning: Choose the right tools and steps
- Execution: Invoke tools (such as files, commands, web, etc.)
- Verification: Check execution results and proceed to the next step
This means you don't have to write coordination logic yourself; just use query() to let the SDK decompose, execute, and provide feedback on the task.
📌 Compared to traditional LLM APIs, the Agent SDK is not just a single prompt → response; it is a system that runs continuously, maintains state, and can perform actions.
What functions and tools are supported?
The SDK provides a lot of built-in functions, including but not limited to:
- File operations (reading, editing, creating files)
- Command execution (running shell or scripts)
- Code editing and generation
- Web search, API calls, etc. (integrated via MCP standards)
- Managing permissions and tool access control mechanisms (to prevent dangerous operations)
What underlying models are supported?
- The SDK internally drives agent logic and tool execution through the Claude Code runtime.
- You need to set the ANTHROPIC_API_KEY and connect to Anthropic's API for authentication.
So based on the official design, it essentially supports the Claude series of models (like Claude Agent / Claude Code) and is built around this ecosystem.
But can access other platforms via third-party API providers
The documentation clearly states that you can configure some environment variables to let the SDK use:
- Amazon Bedrock
- Google Vertex AI
- Microsoft Foundry
As underlying model providers (though you still need credentials and settings for these platforms).
Comparison with Codex CLI
My own understanding:
- codex-cli is "an AI tool"
- Claude Agent SDK is "a tool for developers to create AI agents"
Process of developing an agent with Claude agent
Requirements
Define Agent Role
↓
Define What the Agent Can Do (Tools)
↓
Configure Agent Rules & Permissions
↓
Start Agent Loop
↓
Observe / Log / Optimize1️⃣ Clarify requirements
Determine what kind of agent you want to develop, what its role is, what tasks it will be responsible for, and what outputs count as success, avoiding vague goals from the start.
2️⃣ Define roles
Write a long-term effective system prompt for the agent, clarifying its identity, responsibilities, working style, and basic rules, rather than a one-time Q&A prompt.
3️⃣ Configure tools
Decide which tools the agent can use, such as reading and writing files, executing commands, or accessing APIs, only granting necessary permissions to avoid uncontrolled behavior.
4️⃣ Launch the agent
Pass the goals and configurations through the Claude Agent SDK, start the agent loop, allowing the agent to decompose tasks and execute them step by step.
5️⃣ Observe behavior
Check the agent's execution process and the sequence of tool calls to determine whether it is working as expected and if there are any repetitions, deviations from goals, or failures.
6️⃣ Iterate and optimize
Continuously adjust the role descriptions, tool permissions, and output formats based on the running results to make the agent more stable and efficient.
7️⃣ System integration
Integrate the mature agent into scheduled tasks, APIs, or multi-agent processes, making it part of the system rather than a one-off script.
Comparison with Langchain
Claude Agent SDK provides a ready-made agent execution engine, enabling you to quickly create runnable agents; LangChain offers a framework and tools for you to build the structure and processes of your agent.