system lane · 2026
Agentic Company Research System
A production system that turns a visitor's email into a personalized company report, then checks the report twice for unsupported claims before sending it.
- data (covered)
- model (covered)
- eval (covered)
- serve (covered)
- monitor (covered)
A production system that double-checks every report before sending it, with per-report cost tracking.
stackNext.jsAWS Bedrock AgentCoreClaudeTypeScriptPostgreSQL
I built this at TechForce Advisors as the founding engineer. A visitor enters their work email, and the system researches their company and sends them a personalized report. Since these reports go to prospects, the main design question was how to keep the model from sending something it made up.
Architecture
When a lead comes in, a Next.js control plane on Amplify records the job in Postgres and invokes a worker container on AgentCore Runtime. AgentCore hosts the container and gives it a managed browser, and the agent loop itself is custom TypeScript on Bedrock’s tool-use API, which Claude Code and Cursor wrote to my specification and I verified. A scheduled sweeper re-drives anything that gets stuck.
How a request flows
- The webhook writes a job with an idempotency key and answers right away, since the sender retries on anything but a success, and then invokes the worker.
- The worker claims the job and sends an acknowledgement.
- A research loop searches the web and reads the company’s site and review pages in the managed browser, under a cap of 200,000 tokens and 240 seconds per lead.
- A synthesis step drafts the report, on a larger model for hot leads.
- A verifier on a smaller model checks the draft against what the research found. It can pass the report, pass it with fixes that strip the unsupported claims, or escalate for one rewrite.
- A deterministic grounding pass then removes numeric claims whose source isn’t in the research.
- The report is stored before it is sent, and only then emailed.
The same worker, outbound
The worker also generates reports in parallel for outbound campaigns. Each prospect gets a hosted report page, and dwell time and link clicks flow back to the CRM as engagement. Bounce detection and suppression protect deliverability.
Decisions and tradeoffs
- The verifier can fail, and the pipeline survives. If the verifier errors out, the original report passes through, since an outage shouldn’t block every report. Because an LLM verifier misses things, the deterministic grounding pass runs even then. I added that pass after an evaluation showed the verifier under-detecting fabricated numbers.
- The verifier never grades itself. It runs on a different model from the writer.
- Store, then send. A crash between the two can repeat an email but can never lose a report.
- Budgets fail open and are recorded. A lead that hits its token or time cap still gets a report from what was found, and the telemetry notes it.