Aegis explores how a multi-agent interface can combine quantitative market anomalies with LLM-assisted investigation workflows for misinformation and reputation-risk review.
The current system is a research prototype, not a validated fact-checking authority. Its most defensible engineering contributions are the workflow orchestration, strict response contract, protected API gateway, fallback handling, and observable agent state. Licensed retrieval and labeled evaluation remain future work.
Tech Stack
How the System is Engineered
Data Flow & Inference
Quantitative Correlation
The system fetches 5-day historical closing prices and volume via a proxy-routed Yahoo Finance request. It immediately calculates rolling Z-scores to distinguish organic market drift from coordinated algorithmic anomalies.
Z = (X - μ) / σ → Targets |Z| > 2.5
Context-Aware Prompts
The statistical state (ticker, Z-score, fast drop percentage) is injected into heavily constrained system prompts requiring strict roleplay and enforcing strict JSON schema bounds.
Injected Payload: { "ticker": "TATAMOTORS", "deviation": "-3.4σ", ... }
Serverless Inference Gateway
To avoid leaking API keys into the DOM, the frontend pushes the generated payload to a serverless Node gateway. The gateway selects an API key from a rotated array and dispatches the request to the Gemini v1beta endpoint.
Gateway Request → Round-Robin Key selection
Output Validation & Rendering
The AI returns a strict JSON array representing threats. The frontend strips Markdown fencing, validates the JSON shape via try-catch parsing, and dynamically renders the DOM.
[{ "target": "CEO", "severity": 8, "sentiment": -80 }]
Challenges & Solutions
Strict LLM Rate Limits (HTTP 429)
Google's free-tier Gemini API kept buckling under my Agent Swarms due to a strict 15 Requests Per Minute (RPM) limit.
Automated Key Rotation & Fallbacks
Engineered a serverless gateway that injects environment-backed API keys. If one route returns a rate-limit error, the workflow can try another key or model and surface a controlled failure when every route is exhausted.
CORS Errors & External API Blocks
Legacy APIs (like Yahoo Finance) actively block direct frontend fetch requests via strict CORS configurations, breaking the data pipeline.
Multi-Tier Proxy Routing
Built an array of proxy fallbacks (`AllOrigins`, `CORSProxy.io`) and specifically defined an `OPTIONS` preflight handler within the gateway to ensure secure browser invocations.
Backend Cold Starts on PaaS
Render's free tier spins down the backend after 15 minutes of inactivity, causing 50–90 second delays for the first user query.
Cron-based Heartbeats & Client Feedback
Implemented a `/api/claims` ping that acts as a live heartbeat to keep the container warm. The UI displays an elegant "Waking up cluster" banner if the delay exceeds 3 seconds, preserving user trust.