Skip to content
portfolio

grant-pilot, finds federal grants a small business qualifies for

Open-source projects (independent)Author, applied AIMay 10, 2026

TypeScript, Bun, Anthropic SDK, Next.js 16, Vercel, Upstash

A multi-turn agent that helps a small business or nonprofit find federal grants they qualify for and drafts the skeleton of an application. A planner dispatches three specialist sub-agents (discovery, eligibility, drafter) over the federal grants opportunity API and the federal entity-registration API. 3 sub-agents, 3 tools, ~$0.05 per run, hosted with a daily budget cap and per-IP rate limit so strangers can run it without burning the bill.

How it's built

Bun + TypeScript strict, Vercel AI SDK (generateObject for Discovery + Eligibility, streamObject for the prose-heavy Drafter; see the migration writeup for why I shipped on the raw Anthropic SDK first and ported once the case was clear), Zod-validated tool boundaries, real integrations against the federal grants and entity-registration APIs. The planner runs a bounded multi-turn loop: discovery derives a keyword query and ranks 5 candidates 0 to 100; eligibility fetches full grant detail + an optional SAM check and returns a verdict based only on the eligibility text; drafter produces a structured application skeleton (sections + applicant prompts + watch-outs, never prose). Each sub-agent has its own fallback ladder (Sonnet 4.6 then Haiku 4.5, ported from fedbench). The hosted demo is protected by a $3/day budget cap, a 5-runs/hour-per-IP rate limit (Upstash Redis), and bounded enum + regex inputs that close off the openings prompt injection needs.

Files worth reading

The trade-offs

A planner that coordinates sub-agents is more code to maintain than a single agent with a long prompt. It's also the thing that makes a multi-turn agent debuggable, observable, and cost-bounded in production. Three sub-agents was deliberate. Adding a fourth would be framework creep without commensurate user value at v0.1. The cap itself is the signal.