A Python adapter for integrating Google Agent Development Kit (ADK) agents with Slack
Project description
ADK Slack Adapter
A Python library for integrating Google Agent Development Kit (ADK) agents with Slack through Socket Mode. This adapter enables seamless communication between your ADK-powered AI agents and Slack workspaces.
Features
- Real-time Communication: Uses Slack Socket Mode for instant message processing
- Thread-aware Conversations: Maintains conversation context within Slack threads
- Session Management: Automatic session handling per user and thread
- Streaming Responses: Real-time streaming of agent responses to Slack
- Flexible Configuration: Environment-based configuration with validation
- Event Filtering: Smart handling of direct messages, mentions, and thread replies
Installation
Install from PyPI:
pip install adk-slack-adapter
Or with uv:
uv add adk-slack-adapter
Quick Start
1. Setup Slack App
Create a Slack app with the following settings:
- Socket Mode: Enabled
- Bot Token Scopes:
chat:write,channels:read,groups:read,im:read,mpim:read - Event Subscriptions:
message.channels,message.groups,message.im,message.mpim,app_mention
2. Environment Variables
Set the required environment variables:
export SLACK_BOT_TOKEN="xoxb-your-bot-token"
export SLACK_APP_TOKEN="xapp-your-app-token"
export SLACK_BOT_USER_ID="U01234567"
export ADK_APP_NAME="my-adk-agent" # optional
export LOGGING_LEVEL="INFO" # optional
3. Basic Usage
import asyncio
from google.adk.agents import Agent
from adk_slack_adapter import AdkSlackAppRunner
# Create your ADK agent
agent = Agent(
# Your agent configuration
)
# Create and start the Slack adapter
async def main():
runner = AdkSlackAppRunner(agent_instance=agent)
await runner.start()
if __name__ == "__main__":
asyncio.run(main())
4. Advanced Configuration
from adk_slack_adapter import AdkSlackAppRunner, AdkSlackConfig
# Custom configuration
config = AdkSlackConfig(
slack_bot_token="xoxb-your-token",
slack_app_token="xapp-your-token",
slack_bot_user_id="U01234567",
adk_app_name="my-custom-agent",
logging_level="DEBUG"
)
runner = AdkSlackAppRunner(
agent_instance=agent,
config=config
)
How It Works
The adapter follows a layered architecture:
- SlackAdapter: Handles Slack Socket Mode connection and events
- SlackEventProcessor: Filters and processes relevant messages
- InteractionFlow: Orchestrates message flow between Slack and ADK
- AdkAdapter: Manages ADK agent sessions and streaming responses
Message Flow
- User sends message in Slack (DM, mention, or thread reply)
- SlackAdapter receives event via Socket Mode
- SlackEventProcessor filters relevant messages
- InteractionFlow coordinates with AdkAdapter
- AdkAdapter streams responses from ADK agent
- Responses are sent back to Slack in real-time
Session Management
- Sessions are created per Slack thread:
slack_{user_id}_{thread_id} - Uses ADK's built-in session management for conversation continuity
- Automatic cleanup and memory management
Event Handling
The adapter intelligently handles different types of Slack events:
- Direct Messages: Processes all DMs automatically
- Channel Mentions: Responds when bot is @mentioned
- Thread Conversations: Continues conversations in threads where bot was initially mentioned
- Bot Loop Prevention: Ignores bot's own messages
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/ktagashira/adk-slack-adapter.git
cd adk-slack-adapter
# Install dependencies
uv sync
# Install development dependencies
uv sync --group dev
Running Tests
uv run pytest
Code Quality
# Format code
uv run black .
uv run isort .
# Lint code
uv run ruff check .
# Type checking
uv run mypy .
Requirements
- Python 3.11+
- Google Agent Development Kit (ADK) 1.2.1+
- Slack Bolt SDK 1.23.0+
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For questions and support:
- Create an issue on GitHub
- Check the documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file adk_slack_adapter-0.2.1.tar.gz.
File metadata
- Download URL: adk_slack_adapter-0.2.1.tar.gz
- Upload date:
- Size: 222.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc97d5b6f999ed9c0c4bdfc38bff02bfb1210fc54d1adeebed76f15f19d429c5
|
|
| MD5 |
055dff0eab5b5e1fb1d0da53200fd263
|
|
| BLAKE2b-256 |
7dd4ae922b78e012f36a638c53198832e8439dc6f3921bd472b68ef4f1dbe345
|
Provenance
The following attestation bundles were made for adk_slack_adapter-0.2.1.tar.gz:
Publisher:
publish.yml on ktagashira/adk-slack-adapter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adk_slack_adapter-0.2.1.tar.gz -
Subject digest:
cc97d5b6f999ed9c0c4bdfc38bff02bfb1210fc54d1adeebed76f15f19d429c5 - Sigstore transparency entry: 1009268398
- Sigstore integration time:
-
Permalink:
ktagashira/adk-slack-adapter@32f8a3a1a3fdbf2e029b8a01b6504e48ae21b37d -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/ktagashira
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@32f8a3a1a3fdbf2e029b8a01b6504e48ae21b37d -
Trigger Event:
release
-
Statement type:
File details
Details for the file adk_slack_adapter-0.2.1-py3-none-any.whl.
File metadata
- Download URL: adk_slack_adapter-0.2.1-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f02f767ad0c19e7f8d2ab9f0576324d3be0a31a929bacba8d61f286d1c7adfa
|
|
| MD5 |
2d91b51c243a3de3cd2487c130bf87cd
|
|
| BLAKE2b-256 |
5719542ae653c2f564ec9084018ab9ae52da5c21d9913ad3ad0685114cd1d17a
|
Provenance
The following attestation bundles were made for adk_slack_adapter-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on ktagashira/adk-slack-adapter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adk_slack_adapter-0.2.1-py3-none-any.whl -
Subject digest:
7f02f767ad0c19e7f8d2ab9f0576324d3be0a31a929bacba8d61f286d1c7adfa - Sigstore transparency entry: 1009268418
- Sigstore integration time:
-
Permalink:
ktagashira/adk-slack-adapter@32f8a3a1a3fdbf2e029b8a01b6504e48ae21b37d -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/ktagashira
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@32f8a3a1a3fdbf2e029b8a01b6504e48ae21b37d -
Trigger Event:
release
-
Statement type: