This is a submission for the Algolia Agent Studio Challenge: Consumer-Facing Non-Conversational Experiences
๐๐ฎ๐๐ฒ๐ด๐ผ๐ฟ๐ ๐ฆ๐๐ฏ๐บ๐ถ๐๐๐ถ๐ผ๐ป: Consumer-Facing Non-Conversational Experiences
Challenge Prompt Fit: This project is intentionally submitted as a Consumer-Facing Non-Conversational Experience. It enhances investor workflows proactively through search, divergence detection, and contextual retrieval without requiring a chat-first interface.
Participants: @aditibajpai @achalbajpai
Video โถ๏ธ
ใ ค
What we built ๐ค
Red Flare is an AI-powered divergence detection platform for retail investors.
Institutional desks use expensive terminals to detect valuation, debt, and sentiment anomalies in real time. Retail investors usually discover risk too late. Red Flare closes that gap with fast search, NLP filters, historical pattern matching, and AI-assisted risk analysis for NIFTY 500 and Nasdaq 100 stocks .
๐ Homepage: https://redflare.vercel.app
How it works? ๐ฃ
Users search stocks naturally using phrases like high debt banks, overvalued tech, or even typo queries like Relience.
The app combines:
- Algolia Search + Query Rules + Synonyms for instant discovery
- Algolia Agent Studio across 4 indices for contextual AI analysis
- Yahoo Finance for live market enrichment
- Upstash Redis for cached AI responses and lower latency
Flow:
- User searches or opens a stock
-
/api/stockfetches quote + fundamentals and enriches with Algolia metadata -
/api/newscomputes sentiment from recent headlines -
/api/analyzedetects divergences, computes risk score, queries patterns/scandals, then streams AI output - Result is cached in Redis for 6 hours for repeat access
ใ ค
App Repository ๐
Red Flare ๐ https://github.com/aditibajpaii/redflare
Features ๐
- Algolia Agent Studio RAG with multi-index context
- NLP Query Rules (7 rules) for natural search intent
- Financial Synonyms (10 groups) for better retrieval
- Typo Tolerance (
Relienceโ Reliance)- Custom Ranking by market cap
- Dynamic Enrichment from Yahoo Finance (debt, valuation, margins)
- Divergence Detection Engine (price/sentiment/fundamental mismatch)
- Risk Scoring (1-10 scale with weighted signals)
- Upstash Redis Caching (6-hour TTL)
- Streaming Analysis UI with graceful fallback behavior
- Shareable Analysis Reel Route (
/share)- Responsive Dashboard for desktop + mobile
ใ ค
Real Performance Snapshot ๐
| Metric | Value |
|---|---|
| Search Latency | 12โ18ms avg |
| Index Coverage | ~600 stocks (NIFTY 500 and NASDAQ 100) |
| Query Rules | 7 active |
| Synonym Groups | 10 |
| RAG Indices | 4 connected |
| Cache HIT Latency | ~50โ100ms |
ใ ค
System Architecture ๐
Frontend (Next.js 16)
โโ StockOmnibar
โโ LiveChart
โโ VerdictCard
โโ Share flow
API Layer
โโ /api/stock -> Yahoo + Algolia enrichment
โโ /api/news -> sentiment extraction
โโ /api/analyze -> divergence detection + RAG + streaming
Infra
โโ Algolia (nifty_companies, divergence_patterns, sebi_scandals, sector_benchmarks)
โโ Upstash Redis (analysis cache)
โโ Yahoo Finance (quote + fundamentals)
ใ ค
Why Algolia Agent Studio?
Search quality and retrieval speed are core to this product.
Algolia gives us low-latency discovery, robust typo tolerance, rules-based intent parsing, and a clean path to RAG through Agent Studio. We can ground AI outputs using multiple indices instead of generating generic commentary.
const agentResponse = await fetch(agentUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-algolia-application-id": appId,
"x-algolia-api-key": apiKey,
},
body: JSON.stringify({
messages: [{ role: "user", parts: [{ type: "text", text: context }] }],
stream: true,
}),
})
Additional Algolia usage:
- Query Rules for intent shortcuts (
high debt,risky,banks, etc.) - Synonyms for finance vocabulary normalization
- Custom ranking for market-cap-prioritized relevance
Caching Layer (Upstash Redis) โก
To prevent repeated expensive generation and improve UX, we cache completed analyses per symbol/day:
const CACHE_TTL_SECONDS = 6 * 60 * 60
const key = `redflare:analysis:${symbol}:${date}`
This gives fast repeat loads while keeping data fresh.
ใ ค
Design ๐จ
The UI is intentionally terminal-inspired with a high-signal visual style:
- dark market-console aesthetic
- compact data-dense cards
- animated but restrained interactions
- emphasis on quick scanning of risk and divergence indicators
Design goal: make analysis feel immediate, not overwhelming.
ใ ค
Challenges we ran into ๐ค
- Getting robust fallback behavior when external AI providers timeout or hit quota
- Balancing fast streaming UX with deterministic fallback output
- Keeping search intent parsing precise across mixed
AND/ORfinancial filters - Preserving responsiveness while rendering dense analytics cards and charts
ใ ค
Whatโs next? ๐
- User auth + per-user watchlists
- Alerting on divergence threshold changes
- Better abuse protection on analysis endpoints
- Sector-level heatmaps and multi-stock compare view
- Expanded historical event intelligence and explainability
ใ ค
End Notes ๐๐ป
Thanks to the hackathon organizers and the Algolia ecosystem for the tooling that made this possible.
Permissive License โ๏ธ
MIT


Top comments (1)
This looks fantastic , really cool how youโve used Algolia, Yahoo Finance, and Redis to give retail investors a fast, simple view of where a stockโs price, fundamentals, and sentiment donโt quite line up.