Agent Builder
Research agents for a financial research firm
A TypeScript monorepo of research agents: a Mastra agent service, a NestJS gateway and a React front end. An earnings monitor pulls live data via MCP (Aiera, Gmail, Drive, Calendar), writes digests, updates calendars and leaves the emails as drafts. A transcript pipeline turns recorded expert calls into analyst anecdotes in the firm's house style, and a research chat agent answers from shared and private knowledge bases with semantic memory recall. LLMs only make bounded judgment calls, structured in and structured out; state, dedup, and templating stay deterministic in code.
Challenge
During earnings season, analysts monitor live events, cross-reference internal reports, and draft daily digests by hand. After every expert call someone also writes the call up as anecdotes in the house style. The tools and data sources involved do not talk to each other.
Solution
A scheduled sweep pulls the earnings watchlist over MCP, dedupes events with single-purpose LLM calls, and sends small research agents for consensus and price anchors. Code then builds the digest, updates Google Calendar and creates Gmail drafts. When a Zoom call ends, a webhook queues a job and a background worker runs a 5-pass anecdote pipeline: KPI selection, synthesis, a lint and rewrite pass, a completeness check, and sentiment. The result lands as a .docx attached to a Gmail draft, and analysts review it in a queue.
Impact
Digests, calendar updates and call write-ups arrive as drafts for an analyst to check and send. The manual part of earnings season shrinks to review.
Core features
- Earnings & Events Monitor pulling live data via MCP, run per user with their own Google connection
- Zoom transcripts turned into analyst anecdotes by a 5-pass LLM pipeline, delivered as .docx drafts
- Anecdote channels with their own KPIs, tone, recipients and call matchers, plus a review queue
- Editor agent that separates one-off edits from lasting house rules, which a person approves
- Research chat agent with semantic memory recall, working memory and tool approval prompts
- Shared and private knowledge bases built from PDF and markdown, embedded locally
- Monitoring with traces, health checks, deduplicated alerts, cost estimates and an eval gate
- Custom React front end for research workflows and real-time interaction
Engineering highlights
- Mastra agent framework orchestrating LLM reasoning with deterministic TypeScript code
- Base prompts never change, so they stay cached; learned house rules are appended after them
- MCP tools are mapped to fixed names, so the model never sees each server's raw tool names
- Zoom webhooks are verified with a constant-time signature check and answered at once, with the slow work queued
- Per-user Google OAuth tokens encrypted at rest with AES-256-GCM