Sonar
LivePersonal project exploring multi-agent orchestration. The use case is sales-call review; the actual point was learning Anthropic tool use, prompt caching, and persisted agent state end to end.
What it does
A sales rep uploads a call recording. About twenty seconds later, Sonar returns:
- Research on the prospect’s company (Tavily + Claude Haiku 4.5)
- Structured analysis of the call — topics, pain points, objections, action items, sentiment (Claude Sonnet 4.6)
- A recommended next step with talking points and urgency (Claude Sonnet 4.6)
- A follow-up email draft with bracketed citations linking back to transcript segments (Claude Sonnet 4.6)
The reviewer sees a split-view UI: email on the left, transcript on the right. Hovering a citation highlights the matching segment. The reviewer can approve, edit the body in place, or regenerate the writer with feedback. Regeneration reuses the prior research, analysis, and strategy state; only the writer runs again.
Why I built it
Not a product — a personal project. I wanted one codebase that exercised the modern AI stack end to end: multi-agent orchestration with persistent state, real audio handling, structured tool use, prompt caching, and the multi-tenant B2B shape. Sales-call review was the domain because the workflow is genuinely linear-with-rollback, which is the sweet spot for agent graphs.
How it works
Multi-agent orchestration
- Five sequential nodes: transcription, then research, analysis, strategy, and writer.
- Every agent node returns structured output via Anthropic tool use + a Zod schema. No free-text outputs.
- Each step writes an
AgentRunSteprow. The run pauses atAWAITING_APPROVALafter the writer step. - Anthropic prompt caching is enabled on system messages — ~70% input-token reduction on repeat runs.
- Writer regeneration reuses upstream state.
- Background execution via Next.js 16’s
after()route handler (maxDuration = 300).
Audio processing
- Drag-drop upload goes browser to Supabase Storage via signed URL. The server is not in the upload path.
- Groq Whisper Large v3 transcribes with segment-level timestamps.
- MIME type and 100 MB cap enforced both on the server action and bucket policy.
- The writer receives transcript segments tagged with bracketed indices; citations reference those indices.
- The split-view UI scrolls the cited segment into view on hover.
Multi-tenant B2B
Workspaces, roles (OWNER, ADMIN, MEMBER), invites, API keys, audit log, Stripe billing, and delivery tracking through Resend. Three isolation layers — Postgres row-level scoping, application-layer guards on every server action, and Supabase Storage bucket policies keyed by workspace ID.
Status
Live at sonar.picoral.me. The agent pipeline, workspace tenancy, and follow-up delivery are working end to end; a Loom walkthrough is next.
Questions
What is Sonar?
Sonar is a multi-agent AI workspace for sales teams. A rep uploads a recorded sales call; about twenty seconds later they have prospect research, a structured call analysis, a recommended next step, and a follow-up email draft with citations linking each claim back to a specific transcript segment.
How does Sonar's multi-agent orchestration work?
A five-node run — transcription, then four Claude agent nodes for research, analysis, strategy, and writer — each returning structured output through Anthropic tool use with Zod schemas. Every step writes an AgentRunStep row to Postgres; the run pauses at AWAITING_APPROVAL after the writer step for human review. The writer can be regenerated with reviewer feedback without re-running the upstream nodes.
Why does Sonar use Anthropic prompt caching?
System messages are cached on every node. On repeat runs against the same workspace, this cuts input tokens roughly 70%, which compounds into latency and cost wins as the corpus of workspace context grows.