Repository navigation
feat: add the Claude Agent SDK coding agent - #16
Conversation
Adds claude-agent-sdk/, the coding agent built with the Claude Agent SDK. It shares structure, listeners, and the framework-free agent files with openai-agents-sdk/. Command approvals defer run_command from a PreToolUse hook and resume the Claude Code session with the decision. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Moves the claude-agent-sdk lint and test matrix entries into the combined ci.yml workflow. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…-agent-sdk Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…ands Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Adds the claude-agent-sdk row to the framework table alongside pydantic-ai. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
left a comment
There was a problem hiding this comment.
👾 A comment for me and a comment for thee-
|
|
||
| from agent.sessions import AgentDeps, RequestDeps | ||
|
|
||
| current_deps: ContextVar[AgentDeps | RequestDeps] = ContextVar("current_deps") |
There was a problem hiding this comment.
can this go with sessions?
There was a problem hiding this comment.
🤖 Yep, moved in 8742907: current_deps now sits under RequestDeps in agent/sessions.py, next to the deps it carries, and runtime.py is gone. One tradeoff is that sessions.py is otherwise identical across implementations, so the root AGENTS.md now says to keep current_deps in place when copying changes to that file.
There was a problem hiding this comment.
🤖 Reverted in 1872a9d after a second look. Moving current_deps here made sessions.py the one shared file that differs between implementations, so it'd need review and care on every copy. Keeping it in runtime.py leaves every Claude difference in the framework files and the shared files byte-identical.
| def tool_result(text: str) -> dict: | ||
| """A tool's reply to the model.""" | ||
| return {"content": [{"type": "text", "text": text}]} |
There was a problem hiding this comment.
and can this go with tools/init.py?
There was a problem hiding this comment.
🤖 Done in the same commit! It's defined above the tool imports in agent/tools/__init__.py, since each tool imports it back from the package and a definition below them would be a circular import. With both moves, claude-agent-sdk/ has the same set of files as the other implementations.
There was a problem hiding this comment.
🤖 Reverted with the other move in 1872a9d. This only worked defined above the tool imports, which is easy to break with an import sort or E402, so tool_result stays in runtime.py beside current_deps.
There was a problem hiding this comment.
🧪 note: Plans to follow up on test alignment remain but for now coverage is good!
There was a problem hiding this comment.
📝 note: Planning also to follow up with updates to mirror between samples once features are complete!
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
This reverts commit 8742907, so files shared across implementations stay identical. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
|
🏁 Testing remains good so I'll merge now with planned follow up after landing similar changes in JS! |
Summary
This pull request adds a Claude Agent SDK implementation of the coding agent in
claude-agent-sdk/, ported fromopenai-agents-sdk/with the starter agent's Claude Agent SDK app as the framework reference.listeners/and the framework-freeagent/files are copied unchanged. The SDK stays inagent/agent.py,agent/guardrails.py, andagent/tools/, plusagent/runtime.py, which holds the deps that@toolfunctions can't be passed.@toolfunctions served by an in-process MCP server. Claude Code's built-in tools are off, and so are the machine's settings,CLAUDE.mdfiles, and MCP servers.verbatim_promptskeeps an@pathinside a Slack message from reading a local file. Usesclaude-sonnet-5-5for coding andclaude-haiku-4-5for routing.PreToolUsehook'sdeferdecision. The run ends with the command waiting, and a click resumes the Claude Code session. The hook then allows or denies that same call.can_use_tooldenies it withinterrupt, so closing it costs no model call.PostToolUsehook ends the run once a channel is created or archived. The stop button denies every tool call, a raising tool reaches the model as an error result, and running out of turns ends with a message, keeping the session.~/.claude/projects/, as the README notes.ANTHROPIC_variables out of a command's environment in place ofOPENAI_, since each implementation hides its own provider's.claude-agent-sdk/to the lint and test matrices inci.yml, dependabot, the root README, andAGENTS.md. The rootAGENTS.mdnow words the dropped-pause rule so it fits both kinds of pausing.tests/test_runs.pydrives the real SDK and bundled CLI againsttests/fake_model.py, a local server that answers the Messages API from a script. The CLI's config goes to a temp directory, and these tests take about 30s.Testing
claude-agent-sdk/.env.sampleto.env, setANTHROPIC_API_KEY, and start the app withslack runfromclaude-agent-sdk/.🤖 Generated with Claude Code