Skip to content

feat: add the team agent to the Pydantic AI app - #7

Merged
zimeg merged 7 commits into
mainfrom
clack/team-agent-pydantic
Oct 29, 2026
Merged

zimeg merged 7 commits into
mainfrom
clack/team-agent-pydantic

Conversation

@zimeg

@zimeg zimeg commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

This pull request brings the pydantic-ai app to parity with the OpenAI Agents SDK team agent from #5: the agent writes what channel messages settle into runbooks, then answers from those runbooks next time.

  • Runbooks are canvases titled Runbook: <topic>.
  • Bot-token runbook tools list_runbooks (files.list), read_runbook (canvases.getContent), and create_runbook (canvases.create with channel_id) are a FunctionToolset. The emoji reaction tool stays on the agent.
  • The Slack MCP Server is optional. When a person has connected it, run_agent() swaps the runbook toolset for the Slack MCP Server, filtered to its search and canvas tools, so the agent works as them and can edit existing runbooks.
  • One agent learns as it answers. The message listener runs it on each channel message. When a run calls a runbook write tool, the message's author gets an ephemeral note with the link. Nothing is posted to the channel.
  • The model is picked when a run starts, by which API key is set: claude-sonnet-5-5 with ANTHROPIC_API_KEY, otherwise gpt-6.1-sol with OPENAI_API_KEY, matching bolt-python-coding-agent. A missing key now shows as an error in Slack, not at startup.
  • Bumps pydantic-ai from 2.55.0 to 2.63.0. 2.55.0 resolves anthropic 2.3.0, where BetaMessageParam is a Union, so every Anthropic run failed with TypeError: 'typing.Union' object is not callable. 2.60.0 is the first release that doesn't call it.
  • Runs use pydantic-ai's default limit of 50 model requests. Unlike feat: add the team agent to the OpenAI Agents SDK app #5, a run that hits it shows the generic error.
  • New bot scopes: canvases:read, canvases:write, files:read. Both scope lists are sorted.
  • The root README.md and AGENTS.md now describe the team agent instead of the starter agent. The root README follows bolt-python-coding-agent's, so it drops the starter's Using the App and Local Development sections.

Known risks (same as #5):

  • With the Slack MCP Server connected, a crafted message could steer the agent into searching the author's DMs and private channels, or into editing any canvas they can open.
  • Two messages close together are learned from at the same time, which can create two copies of a new runbook.
  • Learning sees only the message itself, not its thread.

Testing

  • With ANTHROPIC_API_KEY set, run slack run and invite the agent to a channel. Post "Fixed it: rotate the signing secret, then redeploy." Confirm a Runbook: <topic> tab appears in the channel and only you see an ephemeral note with the link.
  • Post small talk and confirm nothing changes and no note appears.
  • @mention the agent with the same problem and confirm it answers from the runbook and links it.
  • Unset ANTHROPIC_API_KEY, set OPENAI_API_KEY, and repeat the @mention.
  • With OAuth (app_oauth.py), connect the Slack MCP Server from the Home tab. Post a correction ("Actually, redeploy before rotating") and confirm the existing runbook is updated.

🤖 Generated with Claude Code

zimeg and others added 5 commits October 28, 2026 10:43
…anthropic 2.x

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

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg added enhancement M-T: A feature request for new functionality new PR only - a new app is being introduced semver:minor Use on pull requests to describe the release version increment labels Oct 28, 2026
@zimeg zimeg self-assigned this Oct 28, 2026
@zimeg
zimeg marked this pull request as ready for review October 29, 2026 17:44
@zimeg
zimeg merged commit 108e4c6 into main Oct 29, 2026
7 checks passed
@zimeg
zimeg deleted the clack/team-agent-pydantic branch October 29, 2026 17:44
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 new PR only - a new app is being introduced 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