Examples / Ask your warehouse in Slack

Ask your warehouse in Slack

An agent answers @mentions in Slack by exploring your PostgreSQL warehouse with read-only tools, then replies in the thread with the numbers and the SQL it ran.

SlackPostgreSQLYour AI models

What you tell the assistant

When someone @mentions the bot in #analytics, answer their question using our warehouse database and reply in the thread. Always show the SQL you used.

Why it works

  • The agent can only use the read-only query, list_tables and describe_table tools.
  • Statement timeouts and row caps keep exploratory queries cheap.
  • Replies land in the original thread, so conversations stay together.
Build this workflow

What it builds

Trigger
Slack
slack · app_mention
agent
Research the question
1 tool · smart
tool
Reply in thread
slack.post_message
View the definition
trigger:
  kind: slack
  connection: slack
  events: [app_mention]
  channels: [C02ANALYTICS]
steps:
  - key: answer
    name: Research the question
    kind: agent
    model: smart
    tools: [warehouse.*]
    max_iterations: 12
    system: You are a data analyst. Explore the schema before querying. Keep answers short and include the final SQL in a code block.
    prompt: "Question from Slack: {{ trigger.text }}"
  - key: reply
    name: Reply in thread
    kind: tool
    tool: slack.post_message
    args:
      channel: "{{ trigger.channel }}"
      thread_ts: "{{ trigger.ts }}"
      text: "{{ steps.answer.output.text }}"

A sample run

What each step produces

Research the question agent

succeeded
Using model smart (Claude Sonnet 5, Murmurator AI)
→ warehouse.list_tables({"schema":"public"})
→ warehouse.describe_table({"table":"trials"})
→ warehouse.query({"sql":"select count(*) filter (where converted_at is not null) …"})
Turn 4: 38 of 211 trials converted
{
  "tool_calls": 4,
  "text": "*38 trials converted last week* (out of 211 started, 18.0%).\n```sql\nselect count(*) filter (where converted_at is not null) as converted, count(*) as started\nfrom trials where started_at >= date_trunc('week', now()) - interval '1 week'\n  and started_at < date_trunc('week', now());\n```"
}

Reply in thread tool

succeeded
Calling slack.post_message
{
  "channel": "C02ANALYTICS",
  "ts": "1758631231.002300"
}

Trigger payload

{
  "type": "app_mention",
  "channel": "C02ANALYTICS",
  "user": "U03PRIYA",
  "text": "<@U0BOT> how many trials converted to paid last week?",
  "ts": "1758631200.001900"
}

Your next automation is one sentence away.

14-day free trial with $5 of built-in AI included. Cancel anytime.