Workflow

LangGraph Research Agent with Memory and Search

Build a LangGraph research agent that combines persistent memory with live web search. The agent remembers previous research and grounds new findings in current data.

Overview

LangGraph research agents that rely solely on search produce repetitive results because they forget previous sessions. This workflow adds persistent memory so the agent builds on past research. The search step fills knowledge gaps while memory provides continuity. Each research session costs $0.05-0.25 in search queries.

Trigger

On-demand via API call or scheduled weekly for recurring research topics.

Schedule

On-demand or weekly for recurring topics

Workflow Steps

1

Load Previous Research from Memory

Retrieve relevant context from the persistent memory store. This includes past findings, open questions, and known facts about the research topic.

2

Identify Knowledge Gaps

Compare the current research question against stored knowledge. Identify what is already known and what needs fresh search data.

3

Execute Targeted Searches

Run search queries only for identified gaps. Use Google for facts, Reddit for opinions, YouTube for tutorials. Avoid re-searching what memory already covers.

4

Synthesize and Update Memory

Merge new search findings with existing memory. Update the knowledge store with new facts, changed information, and resolved questions.

5

Generate Research Output

Produce the research report or answer, citing both memory-sourced and search-sourced information with timestamps for freshness.

Python Implementation

Python
import requests, os

API_KEY = os.environ["SCAVIO_API_KEY"]

def research_search(queries: list) -> list:
    """Execute targeted research searches for identified knowledge gaps."""
    results = []
    for q in queries:
        platform = "reddit" if "opinion" in q.lower() else "youtube" if "tutorial" in q.lower() else "google"
        resp = requests.post(
            "https://api.scavio.dev/api/v1/search",
            headers={"x-api-key": API_KEY, "Content-Type": "application/json"},
            json={"query": q, "platform": platform, "country_code": "us"},
            timeout=15,
        )
        data = resp.json()
        results.append({
            "query": q,
            "platform": platform,
            "findings": [
                {"title": r.get("title", ""), "snippet": r.get("snippet", ""), "url": r.get("link", "")}
                for r in data.get("organic_results", [])[:5]
            ],
        })
    return results

# Targeted searches for knowledge gaps only
gaps = ["LangGraph v0.3 breaking changes 2026", "langgraph memory implementation opinion"]
findings = research_search(gaps)
for f in findings:
    print(f"[{f['platform']}] {f['query']}: {len(f['findings'])} results")

JavaScript Implementation

JavaScript
const H = {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'};
async function researchSearch(queries) {
  const results = [];
  for (const q of queries) {
    const platform = q.toLowerCase().includes('opinion') ? 'reddit' : q.toLowerCase().includes('tutorial') ? 'youtube' : 'google';
    const r = await fetch('https://api.scavio.dev/api/v1/search', {method:'POST', headers:H, body:JSON.stringify({query:q, platform, country_code:'us'})});
    const d = await r.json();
    results.push({query:q, platform, findings:(d.organic_results||[]).slice(0,5).map(r=>({title:r.title, snippet:r.snippet, url:r.link}))});
  }
  return results;
}
const gaps = ['LangGraph v0.3 breaking changes 2026', 'langgraph memory tutorial'];
const findings = await researchSearch(gaps);
findings.forEach(f => console.log('['+f.platform+'] '+f.query+': '+f.findings.length+' results'));

Platforms Used

Google

Web search with knowledge graph, PAA, and AI overviews

YouTube

Video search with transcripts and metadata

Reddit

Community, posts & threaded comments from any subreddit

Frequently Asked Questions

LangGraph research agents that rely solely on search produce repetitive results because they forget previous sessions. This workflow adds persistent memory so the agent builds on past research. The search step fills knowledge gaps while memory provides continuity. Each research session costs $0.05-0.25 in search queries.

This workflow uses a on-demand via api call or scheduled weekly for recurring research topics.. On-demand or weekly for recurring topics.

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

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

LangGraph Research Agent with Memory and Search

Build a LangGraph research agent that combines persistent memory with live web search. The agent remembers previous research and grounds new findings in current data.