Objective
An SDR spends ~70% of pre-call time on research: who is this account, what did we already talk about, what similar customers have we won? In this recipe an account-research agent reads the CRM row, retrieves similar-shape wins from your historical close patterns, and outputs a structured briefing — in one SQL call.
Step 1: CRM accounts + activity + close patterns
CREATE TABLE IF NOT EXISTS recipe_sl_accounts (
account_id INTEGER PRIMARY KEY,
name TEXT,
industry TEXT,
arr_band TEXT, -- '<1M' | '1-10M' | '10-100M' | '100M+'
owner_email TEXT,
notes TEXT
);
CREATE TABLE IF NOT EXISTS recipe_sl_activity (
activity_id INTEGER PRIMARY KEY,
account_id INTEGER,
kind TEXT, -- 'call' | 'email' | 'demo' | 'reply'
summary TEXT,
happened_at TIMESTAMP
);
CREATE TABLE IF NOT EXISTS recipe_sl_wins (
win_id INTEGER PRIMARY KEY,
customer TEXT,
industry TEXT,
acv_usd DOUBLE,
use_case TEXT,
embedding VECTOR(384)
);
Step 2: Seed
INSERT INTO recipe_sl_accounts VALUES
(101,'Northwind Logistics','Logistics','10-100M','jane@yourco.com','Mid-sized 3PL, scaling pain on returns processing'),
(102,'BlueRiver Health', 'Hospital','100M+','sam@yourco.com','Multi-hospital system, RAG-over-policies pain'),
(103,'PixelForge Studios', 'Software','1-10M','jane@yourco.com','30-engineer dev shop, ML team forming');
INSERT INTO recipe_sl_activity VALUES
(1,101,'call', 'CIO: returns auto-triage is the #1 pain. Currently 30min/RMA, 200 RMAs/day.','2026-05-19 10:00:00'),
(2,101,'email','Sent ROI calc spreadsheet. No reply yet.','2026-05-22 14:00:00'),
(3,101,'reply','CIO: numbers look right, what about pilot scope?','2026-05-26 09:15:00'),
(4,102,'demo', 'VP Innovation watched RAG-over-policies demo. Pushback on PHI boundary.','2026-05-21 11:00:00'),
(5,103,'call', 'Founder/CTO: needs in-DB AI, currently glued together Pinecone + LangChain.','2026-05-15 16:00:00');
INSERT INTO recipe_sl_wins (win_id, customer, industry, acv_usd, use_case) VALUES
(1,'Acme 3PL','Logistics', 90000,'Replaced manual returns triage with a SQL agent — 30 min/RMA → 5 min, 200 RMAs/day. Pilot to closed in 5 weeks.'),
(2,'Helios Hospital','Hospital',180000,'In-DB clinical Q&A over policies + EHR — never crossed PHI boundary. Champion: CIO. Procurement took 6 weeks.'),
(3,'Riverbed Devops','Software',62000,'Incident triage agent — replaced a LangChain + Pinecone stack. Champion: VP Eng. Pilot in 2 weeks, closed in 4.'),
(4,'Civic Insurance','Insurance',220000,'Claims triage agent — same shape as Acme 3PL, larger volume. Champion: VP Innovation. Took 10 weeks (board approval).');
Step 3: Embed past wins (by use case)
UPDATE recipe_sl_wins SET embedding = EMBED(industry || ' — ' || use_case);
Step 4: Ground truth — similar-win retrieval
SELECT customer, acv_usd, COSINE_SIMILARITY(embedding, EMBED('logistics company with returns-triage pain')) AS sim
FROM recipe_sl_wins ORDER BY sim DESC LIMIT 2;
Expected: Acme 3PL ranks first; Civic Insurance second (same shape, different industry).
Step 5: Brief me before the call
SELECT AGENT_RUN(
'aidb-assistant',
'Brief me for a 2pm call with account 101 (Northwind Logistics). Use execute_query to pull the account record and the activity log, sorted most recent first. Use rag_search on recipe_sl_wins to find the 2 most similar past wins by shape (same pain, same buyer-title, similar industry). Output: a one-page briefing with (a) what we know about this account, (b) the last 3 touches and the most recent customer signal, (c) the 2 most similar wins with ACV + cycle-time, (d) recommended next step.'
) AS briefing;
Cleanup
DROP TABLE IF EXISTS recipe_sl_accounts;
DROP TABLE IF EXISTS recipe_sl_activity;
DROP TABLE IF EXISTS recipe_sl_wins;
Use it from your agent
- REST/SDK: schedule the briefing on every meeting in your CRM — generate it 10 min before each call.
- MCP: call
queryfrom your sales console with the Step-5 SQL. - Why in-DB: the briefing is only useful if it knows your pipeline state. A generic AI sales assistant doesn't know who on your team touched the account this quarter. SynapCores does — same DB.
Key Concepts Learned
- The briefing pattern is
account state (SQL) + similar-shape wins (RAG)— the agent fuses both in one call. AGENT_RUNis composable: schedule it on a CRON to brief the entire team's day every morning.