Skip to content

feat: add the Pydantic AI coding agent - #15

Merged
zimeg merged 6 commits into
mainfrom
clack/coding-agent-pydantic-ai
Oct 19, 2026
Merged

zimeg merged 6 commits into
mainfrom
clack/coding-agent-pydantic-ai

Conversation

@zimeg

@zimeg zimeg commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

This pull request adds a Pydantic AI implementation of the coding agent in pydantic-ai/, ported from openai-agents-sdk/ with the starter agent's Pydantic AI app as the framework reference.

  • Matches the OpenAI Agents SDK version's experience: the same 16 tools with the same names, arguments, and descriptions, the same prompts, and the same approvals, stop, and archive behavior. listeners/ and the framework-free agent/ files are copied unchanged, so only agent/agent.py, agent/guardrails.py, and agent/tools/ use Pydantic AI.
  • Picks the model when a run starts with a SelectModel capability. Anthropic is preferred when ANTHROPIC_API_KEY is set: claude-sonnet-5-5 codes and claude-haiku-4-5 routes. Otherwise it uses OpenAI with the same gpt-6.1-sol and gpt-6-luna as the OpenAI version.
  • Command approvals use deferred tools. A before_tool_execute hook raises ApprovalRequired, the run ends with DeferredToolRequests, and a click resumes it with deferred_tool_results. A dropped approval answers its call as not run, so the next turn's history stays valid.
  • create_code_channel and archive_channel are output functions, so a successful call ends the run with no extra model call. A Slack error in either goes back to the model as a retry.
  • The stop button skips every tool call with SkipToolExecution, a raising tool reaches the model as a failed tool call, and running out of turns ends with a message and keeps that turn's history.
  • Long sessions compact old conversation with AnthropicCompaction and OpenAICompaction, in place of the OpenAI version's truncation="auto".
  • Keeps both ANTHROPIC_ and OPENAI_ variables out of a command's environment, since this implementation can use either provider.
  • Adds pydantic-ai/ to the lint and test matrices in ci.yml, dependabot, the root README, and AGENTS.md.

Deviations from the OpenAI version, all noted in pydantic-ai/AGENTS.md:

  • If one step asks for more than one command that needs approval, the first is decided and the rest are answered as not run.
  • Requires Python 3.11, as pydantic-ai-slim does. ruff ignores UP041 so the shared workspace.py keeps asyncio.TimeoutError.

Testing

  • Copy pydantic-ai/.env.sample to .env, set ANTHROPIC_API_KEY, and start the app with slack run from pydantic-ai/. Repeat the checks below with only OPENAI_API_KEY set.
  • Mention the agent in a thread with a question and confirm it answers in place, then with a task on a throwaway repo and confirm it links a new code channel.
  • In the code channel, approve a test or build command and confirm it runs, then deny one and confirm the agent carries on without running it.
  • Send a new message while an approval is pending and confirm the buttons show it was skipped and the agent picks up the new message.
  • Press stop mid-turn and confirm the agent says it stopped and posts nothing more from that turn.
  • Say the work is done and confirm the summary is shared back to your original message and the channel is archived.

🤖 Generated with Claude Code

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg added the enhancement M-T: A feature request for new functionality label Oct 16, 2026
@zimeg zimeg self-assigned this Oct 16, 2026
zimeg and others added 2 commits October 19, 2026 13:20
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Moves the pydantic-ai lint and test matrix entries into the combined ci.yml workflow.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg added the semver:minor Use on pull requests to describe the release version increment label Oct 19, 2026
zimeg and others added 2 commits October 19, 2026 13:26
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…ic-ai

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👾 Before merging a few comments for an agent nearest

Comment thread openai-agents-sdk/agent/workspace.py Outdated
Comment thread pydantic-ai/agent/tools/create_code_channel.py

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗣️ note: Tests are planned to align after adjacent implementations land.

Comment thread pydantic-ai/README.md

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📚 note: To self - will align later.

@zimeg
zimeg marked this pull request as ready for review October 19, 2026 22:48
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg

zimeg commented Oct 19, 2026

Copy link
Copy Markdown
Member Author

🏁 Will merge so we can land more structure of related samples now.

@zimeg
zimeg merged commit a6a0578 into main Oct 19, 2026
5 checks passed
@zimeg
zimeg deleted the clack/coding-agent-pydantic-ai branch October 19, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality semver:minor Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant