Skip to content

Create slack runner integration page #1521 - 4 - #2035

Open
zyantw wants to merge 2 commits into
mainfrom
zyantw-patch-3
Open

Create slack runner integration page #1521 - 4#2035
zyantw wants to merge 2 commits into
mainfrom
zyantw-patch-3

Conversation

@zyantw

@zyantw zyantw commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Rendered> https://deploy-preview-2035--adk-docs-preview.netlify.app/integrations/slack/
Pull request to upload Slack logo> #2036
PR> #1524
Original Issue> #1521

Adds the official integration documentation for SlackRunner.

  • Created docs/integrations/slack.md following the Plugin template.
  • Added Socket Mode installation and initialization instructions (google-adk[slack]).
  • Checked against the integration-review and integration-create instructions.

Adds the official integration documentation for `SlackRunner`. 

- Created `docs/integrations/slack.md` following the Plugin template.
- Added Socket Mode installation and initialization instructions (`google-adk[slack]`).
- Checked against the integration-review and integration-create instructions.
@netlify

netlify Bot commented Jul 30, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit 9ccc197
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a6bdd660fe8130008d41a32
😎 Deploy Preview https://deploy-preview-2035--adk-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@zyantw zyantw self-assigned this Jul 30, 2026
@zyantw
zyantw requested a review from joefernandez July 30, 2026 22:46
@joefernandez

Copy link
Copy Markdown
Collaborator

Technical Verification Against google/adk-python

1. Installation & Extra Dependencies — ✅ Verified

  • Doc Claim: pip install "google-adk[slack]"
  • Code Verification:
    • In pyproject.toml, optional-dependencies.slack is explicitly defined as [ "slack-bolt>=1.22" ].
    • In slack_runner.py, missing slack_bolt explicitly instructs the user to run pip install "google-adk[slack]".

2. Module Imports & Exports — ✅ Verified

  • Doc Claim: from google.adk.integrations.slack import SlackRunner and from google.adk.agents import Agent
  • Code Verification:
    • SlackRunner is re-exported at slack/init.py.
    • Agent is exported as an alias for LlmAgent at agents/init.py.

3. Slack Scopes & Socket Mode Prerequisites — ✅ Verified

  • Doc Claim: Requires bot token scopes (app_mentions:read, chat:write, im:history) and app-level token scope (connections:write).
  • Code Verification:
    • SlackRunner._setup_handlers listens for app_mention and message (specifically direct messages im and threads).
    • SlackRunner._handle_message dispatches messages via say, chat_update, and chat_delete (requiring chat:write).
    • SlackRunner.start uses AsyncSocketModeHandler, which requires connections:write.
    • Matches the repository integration reference in README.md.

4. API Reference Table — ✅ Verified

  • Doc Claim: __init__(runner, slack_app) and start(app_token)
  • Code Verification:
    • SlackRunner.init accepts runner: Runner and slack_app: AsyncApp.
    • SlackRunner.start accepts app_token: str.

Issues & Recommended Fixes for PR #2035

Issue 1: Missing Import of InMemorySessionService

  • File & Line: docs/integrations/slack.md, line 63
  • Problem: The example code instantiates session_service=InMemorySessionService(), but InMemorySessionService is not imported in lines 45–50. Running this code throws NameError: name 'InMemorySessionService' is not defined.
  • Fix: Add from google.adk.sessions import InMemorySessionService to the top import block.
  • Code Reference: sessions/init.py and sample agent.py.

Issue 2: Missing auto_create_session=True on Runner

  • File & Line: docs/integrations/slack.md, lines 60–64
  • Problem: In SlackRunner._handle_message, session IDs are dynamically formatted per channel/thread (e.g. f"{channel_id}-{thread_ts}"). Runner.__init__ defaults auto_create_session=False (runners.py). Without auto_create_session=True, incoming messages will fail with a SessionNotFoundError.
  • Fix: Add auto_create_session=True when initializing Runner(...).
  • Code Reference: Sample agent.py.

Issue 3: Minor Comment Formatting

  • File & Line: docs/integrations/slack.md, line 59
  • Problem: #Wire it up to Slack over Socket Mode is missing a space after #.

Suggested Corrected Code Block for docs/integrations/slack.md

import asyncio
import os
from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.adk.integrations.slack import SlackRunner
from slack_bolt.app.async_app import AsyncApp

# Define the core agent
root_agent = Agent(
    model="gemini-flash-latest",
    name="slack_agent",
    instruction="You are a helpful team assistant running on Slack.",
)

# Wire it up to Slack over Socket Mode
runner = Runner(
    app_name="slack_agent",
    agent=root_agent,
    session_service=InMemorySessionService(),
    auto_create_session=True,
)
slack_app = AsyncApp(token=os.environ["SLACK_BOT_TOKEN"])
slack_runner = SlackRunner(runner, slack_app)

asyncio.run(slack_runner.start(os.environ["SLACK_APP_TOKEN"]))

import os
from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.integrations.slack import SlackRunner

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add:
from google.adk.sessions import InMemorySessionService

runner = Runner(
app_name="slack_agent",
agent=root_agent,
session_service=InMemorySessionService(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add:
auto_create_session=True,

instruction="You are a helpful team assistant running on Slack.",
)

#Wire it up to Slack over Socket Mode

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add space to conform to comment syntax:
# Wire it...


<div class="language-support-tag"><span class="lst-supported">Supported in ADK</span><span class="lst-python">Python</span></div>

ADK provides the `SlackRunner` class to easily deploy your agents directly on Slack using [Socket Mode](https://api.slack.com/apis/connections/socket). This integration acts as an adapter that handles event listening, response dispatching, and automated conversation thread management.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

to easily deploy --> to allow you to deploy

Avoid using descriptors like "easily"; just the facts.


## Prerequisites

- A Slack App configured in your [Slack API Dashboard](https://api.slack.com/apps). You must sign in to your Slack account first.

@joefernandez joefernandez Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove "A " pre-amble from each of these bullets: not necessary

- Slack App...
- **Bot User...
- **Websocket...

@joefernandez joefernandez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved with comments.

- A **Websocket App-Level Token** (`xapp-...`) with the `connections:write` scope.

## Installation

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add intro sentence explaining what this command does

```

## Use with agent

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add intro sentence explaining what this code example does

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants