Intermediate
20 min
Connect a Slack AI Analyst to the Stock Market
Build a stock market AI analyst, deploy it to Bruin Cloud, and connect it to Slack so your team can ask data questions in natural language. Join our Slack and try out the agent for free.
AIBruin CloudSlackBruin CLIClaude Code
Learning paths:Data AnalystData Engineer
Overview
Goal — Build a stock market AI analyst and connect it to Bruin Cloud and a Slack AI agent.
Audience — Data professionals, hobbyists, and financial analysts who want a Bruin Cloud and Slack workflow.
Prerequisites
- Bruin CLI installed and authenticated
- Claude Code available for pipeline generation and AI enhancements
- A Bruin Cloud account with access to Team settings and Projects
- A Git repo containing your Bruin project
- Slack workspace with bot credentials and channel access
High-level flow
- Build a Bruin project for stock market data using Claude.
- Enhance metadata with
bruin ai enhance. - Add the repo to Bruin Cloud and enable the pipeline.
- Create an AI agent in Bruin Cloud and connect it to Slack.
- Ask questions in Slack, review SQL, and export a PDF report.
Steps
1) Build the project
- Create a new Bruin project.
- Use Claude to extract stock data from Yahoo Finance and Wikipedia.
- Build reports that clean and join the data.
2) Enhance metadata
- Run
bruin ai enhanceacross the assets. See AI enhance command. - Confirm descriptions, column metadata, quality checks, and lineage look correct.
3) Add the repo to Bruin Cloud
- Go to Bruin Cloud, open Team settings, then Projects.
- Add the repo to the workspace.
- Enable the pipeline and run it.
- Confirm backfill runs and daily schedule work as expected.
4) Create the AI agent in Bruin Cloud
- Go to Agents and create a new agent.
- Select the repo and pipeline.
- Add Slack credentials.
- Name the agent and select the target Slack channel.
5) Test in AI Agent in Bruin Cloud UI
- Ask a few questions to verify the agent can query the data.
- Confirm it can self-correct when the first query is not correct.
6) Test in Slack
- Mention the agent in a Slack channel.
- Ask a stock market question.
- Open the generated SQL to validate the logic.
- Request a PDF report and confirm it is generated.
Sample prompts
- "Which companies had their free cash flow margin improve in the past 4 quarters but saw their stock price decrease more than 10% during the same period?"
- "Summarize the top 10 tickers by revenue growth and generate a PDF report."
Sample outputs
- A response in Bruin Cloud UI with query results.
- SQL query logs for the Slack questions.
- A PDF report generated in Slack.
Troubleshooting
- Pipeline not visible in Bruin Cloud: confirm the repo is linked and the pipeline is enabled.
- AI enhance missing metadata: ensure the warehouse connection is valid and reachable.
- Slack agent not responding: verify bot token, channel access, and agent configuration.
