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

@@ -27,11 +27,14 @@ import (
// MaxTokens and Temperature bound and steer the LLM call (the output is
// tiny structured JSON). Timeout caps a single agent run and MaxTurns
// bounds the agent reasoning loop. Zero-valued tuning fields fall back
// to package defaults.
// to package defaults. ChromeAddr enables the read-only browser toolset
// (so the agent can open cookie-database and cookie-policy pages to read
// the true setter); when empty the agent relies on web search alone.
type TrackerMappingAgentConfig struct {
LLMClient *llm.Client
Model string
FirecrawlAPIKey string
ChromeAddr string
MaxTokens *int
Temperature *float64
Timeout time.Duration
@@ -45,11 +48,15 @@ type TrackerMappingAgentConfig struct {
// MaxTokens and Temperature bound and steer the LLM call (the output is
// tiny structured JSON). Timeout caps a single agent run and MaxTurns
// bounds the agent reasoning loop. Zero-valued tuning fields fall back
// to package defaults.
// to package defaults. ChromeAddr enables the read-only browser toolset
// (so the agent can open authoritative vendor and cookie-database pages
// to ground a description); when empty the agent relies on web search
// alone.
type TrackerEnrichmentAgentConfig struct {
LLMClient *llm.Client
Model string
FirecrawlAPIKey string
ChromeAddr string
MaxTokens *int
Temperature *float64
Timeout time.Duration