feat(providers): add claude-agent-sdk provider#104
Open
lesandiz wants to merge 2 commits intomicrosoft:mainfrom
Open
feat(providers): add claude-agent-sdk provider#104lesandiz wants to merge 2 commits intomicrosoft:mainfrom
lesandiz wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Add a new provider that uses the claude-agent-sdk package to delegate the agentic loop, tool execution, and structured output extraction to the Claude Code CLI. Unlike the raw claude provider, this provider does not manage its own retry logic, MCP servers, or tool wiring — these are handled by the SDK runtime. - New provider: ClaudeAgentSdkProvider with execute(), validate_connection(), close() - Message dispatch via type(message).__name__ matching real SDK class names - Tool result pairing: tracks pending tool_use IDs to emit agent_tool_complete with actual results from ToolResultBlock (not fake nulls) - Structured output via ClaudeAgentOptions.output_format (json_schema) - Event callback parity: agent_turn_start, agent_message, agent_reasoning, agent_tool_start, agent_tool_complete - 22 tests using real SDK types (AssistantMessage, TextBlock, etc.) - Updated schema, factory, __init__, docs, and example workflow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude-agent-sdkprovider that delegates the agentic loop, tool execution, retry logic, and structured output extraction to the Claude Code CLI via theclaude-agent-sdkpackageclaudeprovider (~1900 lines), this provider is ~250 lines — the SDK handles the heavy liftingWhat's included
New files:
src/conductor/providers/claude_agent_sdk.py—ClaudeAgentSdkProviderimplementationtests/test_providers/test_claude_agent_sdk.py— 22 tests using real SDK typesexamples/test-claude-agent-sdk.yaml— example workflowModified files:
src/conductor/config/schema.py— added"claude-agent-sdk"to provider Literal typessrc/conductor/providers/factory.py— added factory case for the new providersrc/conductor/providers/__init__.py— exportedClaudeAgentSdkProviderpyproject.toml— addedclaude-agent-sdkdependencyAGENTS.md,README.md,docs/cli-reference.md,docs/configuration.md,docs/providers/comparison.md,.claude/skills/conductor/SKILL.md,.claude/skills/conductor/references/yaml-schema.mdKey design decisions
type(message).__name__— the Python SDK classes don't set a.typeattribute (unlike the TypeScript SDK)pending_toolsdict — trackstool_use_id → tool_namefrom AssistantMessage ToolUseBlocks, then matches them to ToolResultBlocks in subsequent UserMessagesAssistantMessage,TextBlock, etc. directly fromclaude_agent_sdkto catch API contract drifttoolsandruntime.mcp_serversare ignored (documented in comparison.md and yaml-schema.md)Test plan
uv run ruff check src tests— lint passesuv run ruff format --check src tests— format passesuv run pytest tests/test_providers/test_claude_agent_sdk.py -v— 22 tests passuv run pytest -m "not real_api and not performance"— full suite passesuv run conductor validate examples/test-claude-agent-sdk.yaml— validatesuv run conductor run examples/test-claude-agent-sdk.yaml --input question="What is Claude Design?"— executes successfully with web search🤖 Generated with Claude Code