Give tracker agents a browser to read setters

The tracker-mapping and common-pattern enrichment agents only had
web search, which returns title/url/snippet, so they could never
open a cookie-database or cookie-policy page to read which vendor
actually sets a tracker. This mis-attributed setters whose snippet
is misleading (e.g. _li_* read as LinkedIn rather than LiveIntent).

Wire the read-only headless-browser toolset into both agents, gated
on a configured Chrome endpoint, mirroring the common-third-party
enrichment worker: agent construction moves into the run path so each
run can carry a per-run browser that is closed when the run returns.
The prompts now direct the agent to open a promising result and read
the named setter from the full page text. Both agents stay unchanged
when no Chrome endpoint is configured.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-12 16:11:17 +02:00
parent dbfd191bc5
commit b5bf63b436
8 changed files with 99 additions and 36 deletions

View File

@@ -35,15 +35,24 @@ type CommonPatternEnrichmentResult struct {
Description string `json:"description" jsonschema:"A concise, factual, compliance-grade description of what this tracker stores or does and its purpose. One or two sentences. Name the operating company when known. Empty when the purpose cannot be substantiated from evidence."`
}
// buildCommonPatternEnrichmentAgent builds the common-pattern enrichment
// agent. extraTools carries the browser read-only toolset when a headless
// Chrome endpoint is configured; it is empty otherwise, in which case the
// agent relies on the DB search tool and web search alone. The browser
// lets it open authoritative vendor and cookie-database pages to ground a
// description.
func buildCommonPatternEnrichmentAgent(
cfg TrackerEnrichmentAgentConfig,
pgClient *pg.Client,
logger *log.Logger,
extraTools []agent.Tool,
) *agent.Agent {
tools := []agent.Tool{
searchThirdPartiesTool(pgClient),
}
tools = append(tools, extraTools...)
if cfg.FirecrawlAPIKey != "" {
tools = append(tools, search.FirecrawlSearchTool(cfg.FirecrawlAPIKey))
}