From Dev to Production
A financial analysis system on localhost helps nobody. This module deploys the Finance Analyst to production and connects it to the tools and workflows that financial analysts already use — Slack for real-time alerts, MCP for cross-tool integration, and scheduled reports for routine analysis.
Production Deployment
Environment Management
Financial AI systems handle sensitive data and expensive API calls. Environment variables must be managed carefully:
API keys — Anthropic, embedding service, market data providersDatabase URLs — pgvector connection string with SSLFeature flags — Enable/disable expensive features (cross-company comparisons, scheduled reports)Cost limits — Per-user and per-organization daily budgetsHealth Checks
A standard health endpoint (/api/health) should check:
Database connectivity (can we reach pgvector?)Embedding model availability (can we generate embeddings?)Data freshness (when was the last filing ingested? Is it stale?)API key validity (are external service keys still active?)The data freshness check is uniquely important for financial systems. If your latest filing is 6 months old and it's earnings season, something is broken in the ingestion pipeline.
Slack Integration
Slash Command
/finance-analyst Compare NVDA and AMD gross margins
The analyst types a query in Slack, and the Finance Analyst processes it through the full pipeline: retrieval → gateway → LLM → validation → response. The formatted response appears in the Slack channel with:
Rich message blocks (metrics in bold, tables as code blocks)Source citations as secondary textConfidence badge (emoji: green circle for high, yellow for medium, red for low)Thread for follow-up questionsEarnings Alerts
Automated notifications when new data arrives:
New filing detected: "NVDA filed 10-Q for Q3 2024. Revenue: $18.1B (+94% YoY). Gross margin: 74.0%."Earnings call completed: "AAPL Q4 2024 earnings call transcript available. Key topics: Services growth, China demand, AI investments."Analyst rating change: "Goldman Sachs upgraded MSFT from Hold to Buy. New PT: $480 (was $420)."These alerts post to a configured #earnings channel and include a thread with the full AI-generated summary. The ingestion pipeline triggers alerts when it processes new documents.
Thread-Based Conversations
When an analyst replies to an alert thread, the Finance Analyst maintains context:
"How does this compare to last quarter?" (knows which company from the alert)"What did the CEO say about AI?" (knows to search this company's transcript)"Show me the competitive landscape" (knows to pull peer comparisons)MCP Server
The Model Context Protocol (MCP) server exposes your financial retrieval system as a data source for other AI tools. Any MCP-compatible client (Claude Desktop, Cursor, etc.) can query your Finance Analyst.
Tools
search_filings(query, ticker?, period?) — Search SEC filings with optional filtersget_company_metrics(ticker, period) — Return structured financial metrics (revenue, margins, EPS)compare_companies(tickers[], metric, period) — Side-by-side comparison tableget_analyst_ratings(ticker) — Current ratings, price targets, and recent changesget_earnings_summary(ticker, period) — AI-generated summary of earnings callResources
company_list — All companies in the system with tickers and sectorsavailable_periods — Which fiscal periods have data for each companyanalyst_coverage — Which analysts cover which companiesThis means a user in Claude Desktop can ask "What's NVDA's gross margin trend?" and Claude will call your MCP server's get_company_metrics tool to get real data from your financial database — not from its training data.
Scheduled Reports
Weekly Portfolio Summary
Every Monday morning, automatically:
Pull the latest data for all tracked companiesRun the analysis agent for each company (parallel)Generate a summary with: price changes, margin trends, rating changes, notable earnings call themesDistribute via email and SlackEarnings Season Automation
During earnings season (Jan-Feb, Apr-May, Jul-Aug, Oct-Nov):
Monitor for new SEC filings (daily check)When a filing arrives, auto-ingest it into the data lakeGenerate a standardized analysisPost to Slack with comparison to consensus estimatesUpdate metric dashboardsPrice Alert Integration
When market data shows significant moves:
Stock drops >5% in a day → Trigger analysis of recent filings and analyst notesStock hits new 52-week high/low → Generate technical + fundamental summaryAnalyst consensus shifts → Summary of rating changes and new thesis argumentsMonitoring
Financial-Specific Metrics
Beyond standard latency and error rates, monitor:
Number validation pass rate — What percentage of generated numbers are verified against sources? Target: >90%. If this drops below 80%, the retrieval system or prompts need attention.Data freshness — How old is the most recent filing for each tracked company? Alert when expected filings are late.Cache hit ratio — Financial queries should have 30-40% cache hits during normal trading days (analysts ask similar questions). If cache hit ratio drops, check if TTLs are too aggressive.Cost per analysis — Average token usage per query type. Comparison queries cost 3-5x more than simple lookups.Alerting Thresholds
Error rate > 5% → Page on-callp95 latency > 5 seconds → Investigate (likely database query performance)Number validation pass rate < 80% → Review retrieval qualityData freshness for any company > threshold → Check ingestion pipelineDaily cost exceeds budget → Notify admin, throttle expensive queriesOperations Runbook
Document the common failure modes:
Database connection exhausted → Connection pool sizing and cleanupEmbedding model timeout → Retry logic with circuit breakerLLM rate limit hit → Fallback model chain (Opus → Sonnet → Haiku)Stale data alert → Manual ingestion pipeline triggerNumber validation failure spike → Review recent prompt changes, check retrieval relevanceThe Complete System
At the end of this module, you have a production financial AI system:
Data pipeline ingesting SEC filings, transcripts, market data, analyst notesVector database with table-aware chunking and financial metadataHybrid retrieval with numerical awareness and period filteringAI gateway with number validation, freshness checks, and disclaimersFinancial dashboard with streaming analysis and metric comparisonsSlack integration with earnings alerts and threaded conversationsMCP server exposing financial data to other AI toolsMonitoring tracking accuracy, freshness, cost, and latencyThis is a system a real financial analysis team could use daily — and the monitoring and compliance trail to prove it's reliable.