Documentation Index
Fetch the complete documentation index at: https://agno-v2-team-approvals.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Code
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIChat
from agno.os.app import AgentOS
from agno.os.interfaces.slack import Slack
from agno.tools.slack import SlackTools
agent_db = SqliteDb(session_table="agent_sessions", db_file="tmp/summarizer.db")
summarizer = Agent(
name="Channel Summarizer",
model=OpenAIChat(id="gpt-4o"),
db=agent_db,
tools=[
SlackTools(
enable_get_thread=True,
enable_search_messages=True,
enable_list_users=True,
)
],
instructions=[
"You summarize Slack channel activity.",
"Your context includes the Slack channel_id and thread_ts you are responding in.",
"When asked to summarize 'this channel', use the channel_id from your context.",
"When asked about a channel:",
"1. Use get_channel_history with the channel_id to fetch recent messages",
"2. Look for messages with thread_ts and reply_count > 0 — these have threaded replies",
"3. Use get_thread with the channel_id and thread_ts to expand important threads",
"4. Group messages by topic/theme",
"5. Highlight decisions, action items, and blockers",
"Format summaries with clear sections:",
"- Key Discussions (include expanded thread context)",
"- Decisions Made",
"- Action Items",
"- Questions/Blockers",
"Use bullet points and keep summaries concise.",
],
# Session history enables follow-up questions in the same Slack thread
add_history_to_context=True,
num_history_runs=5,
add_datetime_to_context=True,
markdown=True,
)
agent_os = AgentOS(
agents=[summarizer],
interfaces=[
Slack(
agent=summarizer,
reply_to_mentions_only=True,
)
],
)
app = agent_os.get_app()
if __name__ == "__main__":
agent_os.serve(app="channel_summarizer:app", reload=True)
Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
Set Environment Variables
export SLACK_TOKEN=***
export SLACK_SIGNING_SECRET=***
export OPENAI_API_KEY=***
Install Dependencies
uv pip install 'agno[slack]'
Run Example
python channel_summarizer.py
Key Features
- SlackTools Integration: Reads channel history, threads, and user info via the Slack API
- Structured Summaries: Groups messages by topic with sections for decisions, action items, and blockers
- Follow-Up Questions: Session history enables contextual follow-ups in the same Slack thread