Workflow

Agent Memory Refresh Workflow

Keep an AI agent's long-term memory current: periodically search for updates on stored entities, flag stale facts, and patch the knowledge base.

Overview

AI agents accumulate facts that go stale. This workflow periodically re-searches stored entities via Scavio, compares current SERP data against cached facts, and flags or auto-patches entries where the world has changed.

Trigger

Weekly cron or on entity access

Schedule

Weekly cron

Workflow Steps

1

Export entity list from agent memory

Pull all entities with a 'last_verified' timestamp older than 7 days.

2

Search each entity via Scavio Google endpoint

POST /api/v1/search for each entity name. Take top-3 results.

3

Compare SERP snippets against stored facts

LLM prompt: 'Stored fact: [X]. Current SERP says: [Y]. Has the fact changed? Return JSON {changed: bool, new_fact: string}.'

4

Patch stale entries

Update the agent's memory store with new facts and reset last_verified timestamp.

5

Log changes for audit

Append to a changelog: entity, old fact, new fact, date, source URL.

Python Implementation

Python
import requests, os, json

key = os.environ["SCAVIO_API_KEY"]
stale_entities = [{"name": "Tavily", "fact": "Pricing starts at $30/mo"}]

for entity in stale_entities:
    resp = requests.post("https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": key},
        json={"query": entity["name"] + " pricing 2026", "platform": "google", "limit": 3})
    snippets = [r["snippet"] for r in resp.json().get("results", [])]

    check = call_llm(f"Stored: {entity['fact']}. Current SERP: {snippets}. Changed? JSON: changed, new_fact.")
    result = json.loads(check)
    if result["changed"]:
        print(f"UPDATE {entity['name']}: {entity['fact']} -> {result['new_fact']}")

JavaScript Implementation

JavaScript
const entities = [{ name: "Tavily", fact: "Pricing starts at $30/mo" }];
for (const entity of entities) {
  const resp = await fetch("https://api.scavio.dev/api/v1/search", {
    method: "POST",
    headers: { "x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json" },
    body: JSON.stringify({ query: entity.name + " pricing 2026", platform: "google", limit: 3 })
  });
  const snippets = (await resp.json()).results.map(r => r.snippet);
  const check = await callLLM(`Stored: ${entity.fact}. SERP: ${snippets.join(" ")}. Changed? JSON.`);
  if (JSON.parse(check).changed) console.log(`UPDATE ${entity.name}`);
}

Platforms Used

Google

Web search with knowledge graph, PAA, and AI overviews

Frequently Asked Questions

AI agents accumulate facts that go stale. This workflow periodically re-searches stored entities via Scavio, compares current SERP data against cached facts, and flags or auto-patches entries where the world has changed.

This workflow uses a weekly cron or on entity access. Weekly cron.

This workflow uses the following Scavio platforms: google. Each platform is called via the same unified API endpoint.

Yes. Scavio's free tier includes 500 credits per month with no credit card required. That is enough to test and validate this workflow before scaling it.

Agent Memory Refresh Workflow

Keep an AI agent's long-term memory current: periodically search for updates on stored entities, flag stale facts, and patch the knowledge base.