Repository navigation
Conversation
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>
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>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
- Add vercel/.vercelignore so npx vercel deploy skips .env and .slack/ - Say the app needs Python 3.12 or later before the venv step - Correct where wait_until_runner.py runs - Drop the direct vercel-blob pin, which vercel already brings in - List vercel in the vendor-bolt commands and note how vercel differs in the root README Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Name the directory after its agent framework, like claude-agent-sdk, openai-agents-sdk and pydantic-ai. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Document running the same HTTP and OAuth entry point on your machine with `npx vercel dev` and ngrok, so the Slack MCP Server can be tried before deploying, like the siblings' OAuth server. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…ence Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
It's only used by the Vercel entry point. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
mwbrooks
left a comment
There was a problem hiding this comment.
Thanks @zimeg, this is a great port and the wait_until runner is a neat trick! One blocking point before it merges: DEBUG logging on the Vercel entry point writes the OAuth token response to the function logs. The other comments are non-blocking.
Co-authored-by: Michael Brooks <21328+mwbrooks@users.noreply.github.com> Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-authored-by: Michael Brooks <21328+mwbrooks@users.noreply.github.com> Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
WilliamBergamin
left a comment
There was a problem hiding this comment.
🧩 Thanks @zimeg! The wait_until runner is a neat fix for lazy listeners on Vercel, and the stores slot in behind the slack_sdk interfaces so tests can swap them.
Left a few comments, nothing blocking. The retry and fallback-token ones may belong in a follow-up across all four apps 🙏
| token=os.environ.get("SLACK_BOT_TOKEN"), | ||
| ), | ||
| oauth_settings=oauth_settings, | ||
| process_before_response=True, |
There was a problem hiding this comment.
🧠 question (non-blocking): Should we skip Slack retries here (x-slack-retry-num)? A cold start that misses the 3s ack gets retried, and the retry runs the agent again and posts a second reply.
| token=_fallback_bot_token, | ||
| ) | ||
| auth_test = await fallback_client.auth_test() | ||
| return AuthorizeResult.from_auth_test_response( |
There was a problem hiding this comment.
🧠 suggestion (non-blocking): Could the fallback check that auth_test["team_id"] matches team_id first? On a public deploy, any team without a stored install gets the dev workspace's bot token, and each miss calls auth.test.
| from slack_bolt.adapter.asgi.async_handler import AsyncSlackRequestHandler | ||
| from slack_bolt.async_app import AsyncApp | ||
| from slack_bolt.authorization.authorize_result import AuthorizeResult | ||
| from slack_bolt.lazy_listener.async_internals import to_runnable_function |
There was a problem hiding this comment.
🔭 thought (non-blocking): to_runnable_function is a Bolt internal, and start copies AsyncioLazyListenerRunner.start. Could we open a bolt-python issue for a public lazy runner option so this sample doesn't depend on internals?
|
|
||
| register_listeners(app) | ||
|
|
||
| app.listener_runner.lazy_listener_runner = WaitUntilLazyListenerRunner(app.logger) |
There was a problem hiding this comment.
🧪 suggestion (non-blocking): Could one test post a signed app_mention through handler and assert a 200 plus a wait_until call? Today the runner and this line are only tested apart, so dropping this line would still pass.
| # --------------------------------------------------------------------------- | ||
| # Bot-token fallback for pre-OAuth first-run experience | ||
| # --------------------------------------------------------------------------- | ||
| # When SLACK_BOT_TOKEN is set, Bolt clears it because oauth_settings is |
There was a problem hiding this comment.
🪓 suggestion (non-blocking): The banner and explanation comments here could become names instead, e.g. a with_fallback_bot_token(authorize) function. The same goes for the docstrings in oauth/, thread_context/store.py and agent/agent.py.
| SLACK_MCP_URL = "https://mcp.slack.com/mcp" | ||
|
|
||
|
|
||
| async def run_agent( |
There was a problem hiding this comment.
🧪 suggestion (non-blocking): Could we add a test for run_agent with a fake model? It is the one module that changes the most from the siblings, and nothing covers MCP tool loading or that system messages are dropped from the returned history.
|
|
||
|
|
||
| async def handle_feedback_button( | ||
| ack: Ack, |
There was a problem hiding this comment.
🏷️ suggestion (non-blocking): Since this listener awaits it, could ack be typed AsyncAck (from slack_bolt.context.ack.async_ack), like the other async types here?
| ``` | ||
|
|
||
| 6. Update the whl filename in all three `requirements.txt` files (`claude-agent-sdk/requirements.txt`, `openai-agents-sdk/requirements.txt`, `pydantic-ai/requirements.txt`). Replace the existing `../vendor/slack_bolt-*.whl` line with the new filename. | ||
| 6. Update the whl filename in all four `requirements.txt` files (`claude-agent-sdk/requirements.txt`, `openai-agents-sdk/requirements.txt`, `pydantic-ai/requirements.txt`, `vercel-ai-sdk/requirements.txt`). Replace the existing `../vendor/slack_bolt-*.whl` line with the new filename. |
There was a problem hiding this comment.
📚 question (non-blocking): None of the subprojects has a requirements.txt anymore (each pins slack-bolt in pyproject.toml), so this path points at nothing. Could we fix these commands in their own PR instead of extending them?
| ``` | ||
|
|
||
| 3. In all three `requirements.txt` files (`claude-agent-sdk/requirements.txt`, `openai-agents-sdk/requirements.txt`, `pydantic-ai/requirements.txt`), replace the `../vendor/slack_bolt-*.whl` line with `slack-bolt>=<version>` using the version from step 1. | ||
| 3. In all four `requirements.txt` files (`claude-agent-sdk/requirements.txt`, `openai-agents-sdk/requirements.txt`, `pydantic-ai/requirements.txt`, `vercel-ai-sdk/requirements.txt`), replace the `../vendor/slack_bolt-*.whl` line with `slack-bolt>=<version>` using the version from step 1. |
There was a problem hiding this comment.
📚 question (non-blocking): Same here, vercel-ai-sdk/requirements.txt doesn't exist.
Summary
This pull request adds a
vercel-ai-sdk/directory: the Starter Agent built on the AI SDK for Python with models through Vercel AI Gateway, which runs locally withslack runand deploys to Vercel over HTTP.claude-agent-sdk/,openai-agents-sdk/andpydantic-ai/: App Home, DMs, channel mentions with one conversation per person in a thread, suggested prompts, the emoji reaction tool, feedback buttons, and the Slack MCP Server once someone installs with OAuth.app.pyruns in Socket Mode forslack run.app_vercel.pybuilds the sameAsyncAppfor HTTP with OAuth and serves it with Bolt's ASGI adapter, andpyproject.tomlnames it in[tool.vercel] entrypoint, since Vercel would otherwise pick upapp.py.app_mentionandmessageare lazy listeners, so Slack gets its acknowledgment right away. On Vercel, a small lazy listener runner inapp_vercel.pyhands each lazy listener towait_untilso the function stays alive until the agent finishes.ai.Agentonanthropic/claude-sonnet-5.5. On Vercel, AI Gateway uses the deployment's OIDC token, so there's no model key to manage. Locally it readsAI_GATEWAY_API_KEY. This app needs Python 3.12 or later, which the AI SDK for Python requires.app_oauth.py.npx vercel devand ngrok in place of the siblings' OAuth server, and "Deploy to Vercel"..vercelignorekeeps a local.envout of deploys. The root README,AGENTS.md, CI matrices and Dependabot now includevercel-ai-sdk.Testing
The following ran on a test Vercel project and a test workspace:
slack create my-starter-agent --template slack-samples/bolt-python-starter-agent --branch vercel-subproject --subdir vercel-ai-sdk, thenruff check,ruff format --checkandpytest(34 tests) in the new project.slack runconnects in Socket Mode and answers a DM in a thread.npx vercel devserves the same entry point locally:/slack/installreturns 200, unsigned requests get 401, and a signed DM event gets a reply in Slack.npx vercel deploy --prod, Slack acceptshttps://<project>.vercel.app/slack/eventsas the request URL when the manifest switchessocket_mode_enabledtofalse, and/slack/installserves the install page.wait_untilrunner, an earlier test deployment acknowledged events but never ran the lazy listener.Still to check by hand, and these need a person in Slack:
@mentionin a channel, and use a suggested prompt in the assistant panel./slack/installon the deployment, install with OAuth, then ask the agent to search Slack so it uses the Slack MCP Server.🤖 Generated with Claude Code