Use AgentMark prompts with Anthropic’s Claude Agent SDK
The Claude Agent SDK adapter lets you run AgentMark prompts as agentic tasks using Anthropic’s Claude Agent SDK, with tool use, budget controls, and tracing. Available for both TypeScript and Python; every section below shows both side by side.
The Python adapter (agentmark-claude-agent-sdk-v0) is in alpha. The API surface documented here is stable, but expect occasional changes ahead of the v1 release. For type-safe structured outputs across all major providers, Pydantic AI is the recommended general-purpose Python adapter. Reach for Claude Agent SDK when you specifically need Claude’s agentic capabilities.
Create your AgentMark client with a ClaudeAgentModelRegistry. The registry creator is a function that receives the model name and returns a ModelConfig. Use createDefault() for a pass-through registry, or register models explicitly if you need per-model options like maxThinkingTokens:
The Python adapter does not ship a create_default() / .createDefault(). Register models or providers explicitly so the model names in your prompt frontmatter resolve.The simplest setup registers a provider by prefix (anthropic/...):
For per-model options like max_thinking_tokens, register models explicitly with a ModelConfig creator. The creator receives the model name and the run options:
Adapter options are configured at client construction time (via createAgentMarkClient), not inside prompt.format(). prompt.format() silently ignores them:
The Claude Agent SDK adapter handles tools differently from the AI SDK adapter. Instead of registering custom tool executors, you list tool names in your prompt frontmatter. The adapter passes these names through as allowedTools to the Claude Agent SDK.Tools can be any of the SDK’s built-in tools (Read, Write, Bash, etc.) or tools provided by MCP servers. Configure MCP servers on the client:
---name: tasktext_config: model_name: claude-sonnet-4-20250514 tools: - weather---<System>You are a helpful assistant with access to weather data.</System><User>{props.task}</User>
Register evaluation functions for scoring prompt outputs during experiments. Score schemas are defined separately in agentmark.json; eval functions are connected to scores by name.
Create your AgentMark client in agentmark_client.py (see the Setup section above for the full create_claude_agent_client configuration).Optionally scaffold the AgentMark config and MCP wiring with the create tool:
npm create agentmark@latest my-app
The create tool writes agentmark.json, an empty agentmark/ directory for your .prompt.mdx files, and optional IDE MCP config. It does not prompt for a language or adapter, so add the Python adapter and client yourself as shown above.Run the local dev server: