Engineering the Scan and Recommendation Agents for a Memory-Driven GEO System
The AI pipeline turns a brand name into two things: a measurable GEO visibility result and a recommendation for what to do next. I worked on both the Scan Agent and the Recommendation Agent, and we kept them as separate modules because they solve two different problems. • Scan Agent: Gathers and structures evidence. • Recommendation Agent: Reasons over that evidence and the history stored in…
The AI pipeline transforms a brand name into two components: a quantifiable GEO visibility outcome and a proposed course of action. The system consists of two distinct modules: the Scan Agent and the Recommendation Agent, which are kept separate to handle different tasks.
The Scan Agent is responsible for collecting and organizing evidence. It begins with a brand name and category, generating questions based on how a customer would typically search. These inquiries are then sent to models representing search engines like ChatGPT and Perplexity. Each response is analyzed to ascertain whether the target brand was mentioned, which competitors were discussed, and the raw responses are retained for later use.
The scan generates a consistent structure containing the brand name, timestamp, queries tested, number of mentions, total queries, competitors mentioned, and raw snippets.
The structured data serves several purposes. Firstly, it enables the scan to be utilized as reusable evidence. It can be stored for future reference, displayed in the frontend, compared with other scans, and passed to the Recommendation Agent. Additionally, it provides a predictable structure for the frontend and allows the Recommendation Agent to operate without understanding how the original responses were gathered.
The Recommendation Agent receives two inputs: the current scan and the Hindsight record containing scan history and the actions log. The actions log is crucial as it records not only what was suggested but also what was attempted and the subsequent outcomes. A key rule stipulates that if the actions log is empty, it indicates Scan 1, and a baseline recommendation is provided, explicitly acknowledging the absence of prior history.
Separating the two agents allows each to address different inquiries: the Scan Agent determines the current visibility situation, while the Recommendation Agent considers the existing situation and prior actions to propose what should be done next. This separation simplifies testing and integration, enabling the system to be tested using sample inputs, a simulated scan, or a growing history. Problems can be isolated as either data collection issues or recommendation reasoning problems.
The testing process evaluates the system's performance by examining how recommendations change with different stages of history. Scans 1, 5, and 10 are tested separately. Scan 1 involves an empty history, expecting a generic and honest recommendation. Scans 5 and 10 incorporate previous actions and outcomes, aiming for the agent to recognize useful patterns and tailor recommendations accordingly.
Hindsight also offers a similar-precedent function, which identifies relevant past actions or outcomes from the same brand or comparable situations, providing a short explanation of why that precedent is pertinent. This allows the agent to draw upon similar precedents instead of solely relying on fixed rules. The testing phase initially used hardcoded data to identify problems in the data flow and recommendation logic before integrating all real components.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.