Files · Cohere Agent Mesh for Insurance Quote Comparison
90 (1 binary, 771.5 kB total)attempt 1
README.md·4289 B·markdown
markdown
# Cohere Agent Mesh for Insurance Quote Comparison
> A multi‑agent system that automates insurance quote gathering from multiple carriers, compares coverages, and recommends the best policy—all orchestrated by a Cohere‑powered agent mesh.
## Problem statement
Independent insurance agents waste hours manually entering client data into each carrier's portal, comparing coverages side-by-side, and often miss the optimal policy because the complexity hides the best deal. This system automates the entire workflow—from profile intake through multi-carrier quoting to a ranked recommendation—so agents can focus on serving their clients instead of wrestling with portals.
A tutorialized reference solution from [reaatech.com](https://reaatech.com), demonstrating how to build production-grade AI systems with the `@reaatech/*` package family.
## Running locally
```bash
pnpm install
cp .env.example .env
# Edit .env with your API keys
pnpm dev # starts Express API on :8080 + Next.js on :3000
pnpm test # vitest run with coverage
pnpm typecheck # tsc --noEmit
pnpm lint # eslint
```
## Project layout
```
app/ Next.js App Router pages + API routes
src/ services, lib, adapters
tests/ vitest suite (mirrors src/)
packages/ API references for every dependency (read these first)
DEV_PLAN.md build plan for this recipe
```
## Architecture overview
The system uses a multi-agent architecture orchestrated by the `@reaatech/agent-mesh` ecosystem:
- **Next.js 16+ dashboard** — user-facing UI for submitting insurance profiles and viewing comparison results
- **Express API server** — backend that receives quote requests, coordinates agent dispatch, and serves results
- **`@reaatech/agent-mesh` agent registry** — YAML-configured carrier agent definitions
- **`@reaatech/agent-mesh-router`** — MCP-based dispatch to carrier agents
- **`@reaatech/agent-mesh-session`** — Firestore-backed conversation state persistence
- **`@reaatech/agent-mesh-observability`** — structured logging, OpenTelemetry, and metrics
- **Cohere LLM** (`command-a-03-2025`) — inference via mastra + `@ai-sdk/cohere` + `cohere-ai` SDK
- **Langfuse** — LLM observability and tracing
- **Carrier agents** (GEICO, Progressive, State Farm, Allstate) — queried in parallel for quotes
- **Coverage analyzer + recommendation agents** — post-processing agents that compare results and rank policies
- **Playwright browser automation** — programmatic carrier portal scraping
## Tech stack
- **Next.js 16+** (App Router)
- **Express**
- **TypeScript** (strict, NodeNext module resolution)
- **Cohere** (`command-a-03-2025`)
- **Mastra + AI SDK** (`@ai-sdk/cohere`)
- **Zod** (runtime schema validation)
- **Playwright** (browser automation)
- **Langfuse** (LLM observability)
- **`@reaatech/agent-mesh` ecosystem** (agent-mesh, agent-mesh-router, agent-mesh-session, agent-mesh-observability)
- **Firestore** (session persistence)
## API documentation
| Method | Path | Description |
|--------|----------------------------|----------------------------------------------------------|
| POST | `/api/quotes` | Submit an insurance profile and get a comparison result |
| GET | `/api/quotes/:id` | Get session status and results |
| GET | `/api/quotes/:id/stream` | SSE stream of quote processing progress |
| GET | `/api/agents` | List registered carrier agents |
| POST | `/api/agents/reload` | Reload agent registry from YAML files |
| GET | `/api/health` | Health check endpoint |
### curl example
```bash
curl -X POST http://localhost:8080/api/quotes \
-H 'Content-Type: application/json' \
-d '{
"userId": "demo-user",
"profile": {
"age": 35,
"drivingHistory": "clean",
"vehicleInfo": { "make": "Toyota", "model": "Camry", "year": 2024 },
"coveragePrefs": { "liabilityLimit": 100000, "deductible": 500 }
}
}'
```
## License
MIT — see [LICENSE](./LICENSE).