Agente de Memória Sempre Ativo do Google Cloud Substitui RAG e Embeddings por Consolidação Contínua de LLM no Gemini 3.1 Flash-Lite

Agente de Memória Sempre Ativo do Google Cloud Substitui RAG e Embeddings por Consolidação Contínua de LLM no Gemini 3.1 Flash-Lite

O repositório generative-ai do Google Cloud disponibiliza o Always-On Memory Agent, uma implementação de referência que trata a memória como um processo em execução. Construído sobre o Google ADK e o Gemini 3.1 Flash-Lite, ele não usa banco de dados vetorial nem embeddings. Em vez disso, um orquestrador direciona para os subagentes de Ingestão, Consolidação e Consulta, que leem, conectam e gravam memória estruturada no SQLite 24 horas por dia, 7 dias por semana. O post Agente de Memória Sempre Ativo do Google Cloud Substitui RAG e Embeddings por Consolidação Contínua de LLM no Gemini 3...

MarkTechPost ·Michal Sutter ·

Most AI agents forget. They process a request, answer it, then drop the context. Google Cloud’s generative-ai repository now ships a sample that tackles this directly. It is the Always-On Memory Agent, a reference implementation that treats memory as a running process.

Always-On Memory Agent

Fundamentally, the project is a lightweight background agent that never stops. It runs 24/7 as a continuous process, not a one-shot call. It is built with Google ADK (Agent Development Kit) and Gemini 3.1 Flash-Lite. Notably, it uses no vector database and no embeddings. Instead, an LLM reads, thinks, and writes structured memory into SQLite. The model choice targets low latency and low cost for continuous background work.

How It Works: Ingest, Consolidate, Query

Architecturally, an orchestrator routes every request to one of three specialist sub-agents. Each sub-agent owns its own tools for reading or writing the memory store.

First, the IngestAgent handles incoming content. It uses Gemini’s multimodal capabilities to extract a summary, entities, topics, and an importance score. That structured record then lands in the memories table.

Next, the ConsolidateAgent runs on a timer, every 30 minutes by default. Like sleep cycles, it reviews unconsolidated memories and finds connections between them. Then it writes a synthesized summary, one key insight, and those connections to the database. Consequently, the agent builds new understanding while idle, with no prompt.

Finally, the QueryAgent answers questions. It reads all memories and consolidation insights, then synthesizes a response. Importantly, it cites the memory IDs it used as sources.

", src:"report.pdf", sm:"Anthropic reports 62% of Claude usage is code-related.",

ent:["Anthropic","Claude","AI agents"], tp:["AI","code generation"], imp:0.8},

{icon:"", src:"roadmap.png", sm:"Q1 priority: reduce inference costs by 40%.",

ent:["Q1","inference"], tp:["cost","planning"], imp:0.7},

{icon:"", src:"standup.mp3", sm:"AI agents grow fast, but reliability is still a challenge.",

ent:["AI agents","reliability"], tp:["agents","reliability"], imp:0.75},

{icon:"", src:"idea.txt", sm:"Smart inbox idea: persistent AI memory for email.",

ent:["smart inbox","email"], tp:["product","memory"], imp:0.6}

var CONS = {

links:[[1,3],[2,1],[3,4]],

insight:"The bottleneck for next-gen AI tools is the transition from static RAG to dynamic memory systems."

var Q = "What should I focus on?";

var A = 'Based on your memories, prioritize: ship the cost-reduction plan [Memory 2], ' +

'then close the agent reliability gap [Memory 3]. ' +

'The smart inbox concept [Memory 4] validates demand for persistent AI memory.';

var i=0, consolidated=false;

var $=function(id){return document.getElementById(id)};

var store=$("store"), pkt=$("pkt"), logEl=$("log");

function post(){ try{ parent.postMessage({type:"aoma-resize",height:document.body.offsetHeight+40},"*"); }catch(e){} }

function log(html){ logEl.innerHTML=html; post(); }

function activate(el,cls){ [ "sIngest","sCons","sQuery" ].forEach(function(id){ $(id).classList.remove("active","cons","query"); });

if(el){ el.classList.add("active"); if(cls) el.classList.add(cls); } }

function packet(color){ pkt.style.background=color; pkt.style.opacity="1"; pkt.style.left="0";

setTimeout(function(){ pkt.style.left="calc(100% - 10px)"; },30);

setTimeout(function(){ pkt.style.opacity="0"; },950); }

function ingest(){

if(i>=SAMPLES.length){ log("Inbox empty. All 4 sample files ingested — now consolidate or query."); return; }

var s=SAMPLES[i]; var id=i+1;

activate($("sIngest")); packet("#4285F4");

log('IngestAgent reads '+s.icon+' '+s.src+' → extracting summary, entities, topics, importance…');

var c=document.createElement("div"); c.className="card"; c.id="card"+id;

c.innerHTML='#'+id+'

'+s.sm+'
'+

'

'+s.ent.map(function(e){return ''+e+''}).join("")+'
'+

'

'+s.tp.map(function(t){return ''+t+''}).join("")+'
'+

'

importance '+s.imp+'
';

store.appendChild(c); post();

setTimeout(function(){ c.classList.add("show"); post();

log('Stored memory #'+id+' in SQLite. '+(SAMPLES.length-id)+' file(s) left in inbox.'); },500);

if(i>=2){ $("bCons").disabled=false; $("bQuery").disabled=false; }

function consolidate(){

if(i<2){ log("Ingest at least 2 memories first."); return; }

activate($("sCons"),"cons"); packet("#FBBC04");

$("tmr").classList.add("run");

log("ConsolidateAgent woke on its 30-min timer — reviewing unconsolidated memories…");

var svg=$("wires"); svg.innerHTML="";

for(var k=1;k<=Math.min(i,4);k++){ var el=$("card"+k); if(el) el.classList.add("hl"); }

setTimeout(function(){

CONS.links.forEach(function(pair){ drawWire(pair[0],pair[1]); });

log("Found connections across memories — writing one cross-cutting insight…");

setTimeout(function(){

var ins=$("insight"); ins.innerHTML='Insight: '+CONS.insight; ins.classList.add("show");

$("tmr").classList.remove("run"); consolidated=true;

log("Consolidation done. New insight written back to the store — no prompt needed."); post();

function drawWire(a,b){

var svg=$("wires"), ca=$("card"+a), cb=$("card"+b); if(!ca||!cb) return;

var box=svg.getBoundingClientRect(), ra=ca.getBoundingClientRect(), rb=cb.getBoundingClientRect();

var x1=ra.left-box.left+ra.width/2, y1=ra.top-box.top+ra.height/2;

var x2=rb.left-box.left+rb.width/2, y2=rb.top-box.top+rb.height/2;

var ln=document.createElementNS("http://www.w3.org/2000/svg","line");

ln.setAttribute("x1",x1);ln.setAttribute("y1",y1);ln.setAttribute("x2",x1);ln.setAttribute("y2",y1);

ln.setAttribute("stroke","#FBBC04");ln.setAttribute("stroke-width","2");ln.setAttribute("stroke-dasharray","4 3");

svg.appendChild(ln);

requestAnimationFrame(function(){ ln.style.transition="all .5s"; ln.setAttribute("x2",x2); ln.setAttribute("y2",y2); });

function query(){

if(i<1){ log("Ingest something first."); return; }

activate($("sQuery"),"query"); packet("#34A853");

$("qbox").classList.add("show"); $("qask").textContent='Q: '+Q; $("qans").innerHTML="Reading all memories…";

log("QueryAgent reads every memory"+(consolidated?" and the consolidation insight":"")+", then synthesizes…");

["card2","card3","card4"].forEach(function(id){ var el=$(id); if(el) el.classList.add("cite"); });

setTimeout(function(){ $("qans").innerHTML=A;

log("Answer returned with cited memory IDs — grounded only in stored memories."); post(); },900);

function reset(){

i=0; consolidated=false; store.innerHTML=""; $("wires").innerHTML="";

$("insight").className="insight"; $("insight").innerHTML="";

$("qbox").className="qbox"; $("qans").innerHTML=""; $("qask").textContent="";

$("bCons").disabled=true; $("bQuery").disabled=true; activate(null);

log("Reset. Drop a file into the agent's inbox to begin.");

$("bIngest").onclick=ingest;

$("bCons").onclick=consolidate;

$("bQuery").onclick=query;

$("bReset").onclick=reset;

window.addEventListener("load",post);

window.addEventListener("resize",post);

if(window.ResizeObserver){ new ResizeObserver(post).observe(document.body); }

setTimeout(post,150);

(function(){

window.addEventListener("message",function(e){

if(e.data && e.data.type==="aoma-resize"){

var f=document.getElementById("aoma-frame");

if(f && e.data.height){ f.style.height=e.data.height+"px"; }

Supported Inputs

Beyond text, the IngestAgent accepts 27 file types across five categories. Simply drop any supported file into the ./inbox folder for automatic pickup.

CategoryExtensionsText.txt, .md, .json, .csv, .log, .xml, .yaml, .ymlImages.png, .jpg, .jpeg, .gif, .webp, .bmp, .svgAudio.mp3, .wav, .ogg, .flac, .m4a, .aacVideo.mp4, .webm, .mov, .avi, .mkvDocuments.pdf

How It Compares to RAG, Summaries, and Knowledge Graphs

To clarify the difference, it frames three common memory approaches. Each solves part of the problem, yet leaves a gap.

ApproachHow it storesActive processingMain limitationVector DB + RAGEmbeddings in a vector storeNonePassive; embeds once, retrieves laterConversation summaryCompressed textNoneLoses detail; no cross-referenceKnowledge graphsNodes and edgesManual upkeepExpensive to build and maintainAlways-On Memory AgentStructured rows in SQLiteContinuous consolidationQuery reads up to 50 recent memories

Unlike RAG, this agent processes memory actively, not only on retrieval.

Use Cases With Examples

Practically, the pattern fits any workload needing durable, evolving context. Consider three examples.

• A research assistant ingests PDFs, meeting audio, and screenshots all week. Later, it links a cost target to a reliability problem on its own.

• A personal knowledge base absorbs notes, articles, and images continuously. Over time, consolidation surfaces themes you never explicitly connected.

• A support agent stores past tickets as structured memories. Then it answers new questions with cited references to earlier cases.

Getting Started

With the design clear, setup stays minimal for early-level engineers. Install dependencies, set your key, then start the process.

Copy CodeCopiedUse a different Browser

pip install -r requirements.txt

export GOOGLE_API_KEY="your-gemini-api-key"

python agent.py

Once running, the agent watches ./inbox, consolidates every 30 minutes, and serves an HTTP API on port 8888. Therefore, you can also feed it over HTTP.

Copy CodeCopiedUse a different Browser

# Ingest text

curl -X POST http://localhost:8888/ingest \

-H "Content-Type: application/json" \

-d '{"text": "AI agents are the future", "source": "article"}'

# Ask a question

curl "http://localhost:8888/query?q=what+do+you+know"

Additionally, the API exposes /status, /memories, /consolidate, /delete, and /clear. An optional Streamlit dashboard adds ingest, query, browse, and delete controls. CLI flags change the watch folder, port, and consolidation interval.

Copy CodeCopiedUse a different Browser

python agent.py --watch ./docs --port 9000 --consolidate-every 15

Key Takeaways

• No vector DB, no embeddings — an LLM reads, thinks, and writes structured memory into SQLite.

• Runs 24/7 on Google ADK + Gemini 3.1 Flash-Lite as a lightweight background process.

• Three sub-agents under one orchestrator: Ingest, Consolidate, and Query.

• Consolidates every 30 minutes — links related memories and writes new insights while idle.

• Ingests 27 file types across text, images, audio, video, and PDFs, dropped into ./inbox.

Check out the FULL CODES here. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.

Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us

The post Google Cloud’s Always-On Memory Agent Replaces RAG and Embeddings With Continuous LLM Consolidation on Gemini 3.1 Flash-Lite appeared first on MarkTechPost.

compartilhar: