From 0c8888f9099e9983cda672bac1106b25f6873288 Mon Sep 17 00:00:00 2001 From: Mustafa Esoofally Date: Mon, 16 Feb 2026 18:46:03 -0500 Subject: [PATCH] feat: add Slack integration with slack_dash agent --- app/config.yaml | 4 +++ app/main.py | 5 +++- dash/__init__.py | 3 ++- dash/slack_agent.py | 61 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 dash/slack_agent.py diff --git a/app/config.yaml b/app/config.yaml index 7745782..4befaac 100644 --- a/app/config.yaml +++ b/app/config.yaml @@ -8,3 +8,7 @@ chat: - "Tell me about yourself" - "Who won the most races in 2019?" - "Who won the most F1 World Championships?" + slack-dash: + - "Tell me about yourself" + - "Who won the most races in 2019? Export as CSV" + - "Generate an image of a Formula 1 car at Monaco" diff --git a/app/main.py b/app/main.py index c6855ae..dcdd6a5 100644 --- a/app/main.py +++ b/app/main.py @@ -12,8 +12,10 @@ from pathlib import Path from agno.os import AgentOS +from agno.os.interfaces.slack import Slack from dash.agents import dash, dash_knowledge, reasoning_dash +from dash.slack_agent import slack_dash from db import get_postgres_db # --------------------------------------------------------------------------- @@ -23,9 +25,10 @@ name="Dash", tracing=True, db=get_postgres_db(), - agents=[dash, reasoning_dash], + agents=[dash, reasoning_dash, slack_dash], knowledge=[dash_knowledge], config=str(Path(__file__).parent / "config.yaml"), + interfaces=[Slack(agent=slack_dash, reply_to_mentions_only=True)], ) app = agent_os.get_app() diff --git a/dash/__init__.py b/dash/__init__.py index 49daa89..3111b23 100644 --- a/dash/__init__.py +++ b/dash/__init__.py @@ -1,5 +1,6 @@ """Dash - A self-learning data agent with 6 layers of context.""" from dash.agents import dash, dash_knowledge, dash_learnings, reasoning_dash +from dash.slack_agent import slack_dash -__all__ = ["dash", "reasoning_dash", "dash_knowledge", "dash_learnings"] +__all__ = ["dash", "reasoning_dash", "slack_dash", "dash_knowledge", "dash_learnings"] diff --git a/dash/slack_agent.py b/dash/slack_agent.py new file mode 100644 index 0000000..96a8291 --- /dev/null +++ b/dash/slack_agent.py @@ -0,0 +1,61 @@ +""" +Slack Dash Agent +================ + +Enhanced Dash agent with web search, image generation, and file export tools +for rich Slack interactions. + +Run: python -m dash.slack_agent +""" + +from agno.models.openai import OpenAIChat +from agno.tools.dalle import DalleTools +from agno.tools.duckduckgo import DuckDuckGoTools +from agno.tools.file_generation import FileGenerationTools +from agno.tools.slack import SlackTools + +from dash.agents import INSTRUCTIONS, base_tools, dash + +SLACK_INSTRUCTIONS = """\ + +## Slack Capabilities + +You have additional tools for Slack interactions: + +**File Export** — When users ask for data exports: +- Use `generate_csv_file` for tabular data (query results, comparisons) +- Use `generate_json_file` for structured data +- Always include descriptive filenames (e.g., "hamilton_2019_wins.csv") + +**Image Generation** — When users ask for visualizations or creative images: +- Use `create_image` to generate images with DALL-E +- Good for: team logos, race visualizations, infographics +- Be descriptive in your prompts for best results + +**Web Search** — When users ask about recent events or external context: +- Use `web_search` for current F1 news, driver updates, rule changes +- Use `search_news` for latest headlines +- Combine with database queries for comprehensive answers + +**Slack** — When asked to share results or notify channels: +- Use `send_message` to post to channels +- Use `send_message_thread` to reply in threads +""" + +slack_dash = dash.deep_copy( + update={ + "name": "Slack Dash", + "model": OpenAIChat(id="gpt-4o"), + "instructions": INSTRUCTIONS + SLACK_INSTRUCTIONS, + "tools": base_tools + + [ + DalleTools(), + DuckDuckGoTools(), + FileGenerationTools(), + SlackTools(), + ], + } +) + +if __name__ == "__main__": + slack_dash.print_response("Who won the most races in 2019? Export results as CSV.", stream=True)