agents/04-lead-enrichment/agent.capsule15 lines
(agent lead-enrichment
(purpose "We sell Tessellate, CI analytics that finds slow and flaky tests for software teams. Enrich your lead, the row of leads you are given: fetch its website from web, then insert one row in enriched. If the lead scores 70 or more, send its contact one short first email, specific to what you read, about how Tessellate could help; send nothing to a lead under 70. A website you cannot fetch is scored on what leads says, and its summary says the site could not be read.")
1 (capability leads :table "leads.jsonl" :columns (company website contact)
:source leads/events :fact (lead contact))
2 (capability web :corpus "web")
(capability enriched :table "enriched.jsonl" :columns (company score summary)
:insert "Insert your lead's one row: company is the lead's company as leads lists it; score is an integer from 0 to 100, how well the company fits a buyer of CI analytics (100 fits best: a software team whose builds and tests slow it down); summary is one sentence on what the company does.")
(capability outbox :spool "outbox")
(relation lead 1 :source leads/events)
(grant capability leads/events :kind source)
(grant capability web/fetch :kind tool)
; A score, the row's second operand (:at 1), is a whole number 0 to 100;
; any other is refused at the door.
3 (grant capability enriched/insert :kind number :scope "0..100" :at 1)
; An email goes only to a lead's contact, and waits for you.
4 (derive (grant capability outbox/send :kind message :scope ?who :ask) (lead ?who))
5 (per leads)
6 (done (each leads enriched company) (within enriched score 0 100)))