Back to Blog
Building an AI Research Agent with Persistent Memory
TutorialJanuary 16, 20264 min

Building an AI Research Agent with Persistent Memory

TL;DR

The Quercle Research Agent is an AI assistant that remembers what it learns. Unlike standard chatbots that forget everything between sessions, this agent builds knowledge over time using Quercle for web research, OpenRouter for LLM access, and MongoDB for persistent memory.

Links:

The Problem with AI Research

You're researching AI agent frameworks. You spend 30 minutes with ChatGPT, learn a lot, then move on. Weeks later, you want to continue - but what exactly did you learn? Which sources did you use? What's changed since then?

Standard chatbots aren't designed for ongoing research. Even with memory features, they store general facts about you - not structured research findings with sources, timestamps, and topics you can query later.

The Quercle Research Agent solves this by maintaining a dedicated research memory you can search and build on over time.

How It Works

When you ask a question, the agent:

  1. Checks memory first - Do I already know this?
  2. Searches if needed - Uses Quercle to find current information
  3. Stores findings - Saves key facts to MongoDB for future sessions
  4. Cites sources - Every answer includes source links

Both your research memories and conversation history are stored in MongoDB - not browser storage. Your data persists across devices and won't disappear if you clear your browser.

Example: Building Knowledge Over Time

Session 1: Initial Research

You: What are the main approaches to AI agent memory?

Agent: [recall] No previous research found
       [search] "AI agent memory architectures 2025"
       [fetch] langchain.com/docs/memory
       [remember] Stored 6 findings about agent memory

Report: There are three main approaches...
        1. Buffer memory (recent context)
        2. Vector memory (semantic search)
        3. Entity memory (knowledge graphs)

Session 2: Follow-up (days later)

You: How does LangChain implement vector memory?

Agent: [recall] Found 2 memories about LangChain memory...
       [search] "LangChain vector memory implementation" (for details)
       [remember] Updated findings with implementation specifics

Report: Based on my previous research and new findings...

Session 3: Checking for updates

You: Any new developments in AI agent memory since my last research?

Agent: [recall] Last researched: 2 weeks ago
       [search] "AI agent memory latest developments"

Report: Since your last research, two notable developments...

Who Is This For?

Individual researchers, analysts, and curious minds who:

  • Track evolving topics over weeks/months
  • Return to the same domains repeatedly
  • Want to see exactly what sources the AI used
  • Prefer building cumulative knowledge over one-shot answers

Not for:

  • One-off questions (just use ChatGPT/Claude/Perplexity)
  • Team collaboration (no multi-user support yet)
  • Real-time data needs (memory is point-in-time snapshots)

Tech Stack

ComponentChoiceWhy
FrameworkNext.jsApp router, server components
RuntimeBunFast, modern
Web SearchQuercle APIReturns analyzed content, not raw HTML
Memory & HistoryMongoDB AtlasStores research findings and conversation history
LLMOpenRouterAccess to multiple models
AI SDKVercel AI SDKStreaming, tool calling

Agent Tools

ToolPurpose
quercleSearchSearch the web, get AI-synthesized results
quercleFetchRead and analyze a specific webpage
rememberStore facts in long-term memory
recallRetrieve past research

Quick Start

git clone https://github.com/quercledev/quercle-research-agent.git
cd quercle-research-agent
bun install
cp .env.example .env
# Edit .env with your API keys
bun dev

Configuration

# .env
QUERCLE_API_KEY=qk_...           # Web search
MONGODB_URI=mongodb+srv://...     # Memory storage
OPENROUTER_API_KEY=sk-or-...      # LLM provider
MODEL=openai/gpt-5-nano           # Or any OpenRouter model that supports tool calls

Limitations

  • Single user - No authentication or multi-user support
  • No sharing - Can't share research or collaborate
  • Memory grows - No automatic cleanup of old memories

Get Started

Clone the repo, add your API keys, and start building cumulative knowledge:

github.com/quercledev/quercle-research-agent

Have ideas for new features or want to contribute? Pull requests and suggestions are welcome on GitHub!

Ready to try Quercle?

Built for AI agents. See how it compares in real-world tests.

More Articles

Quercle Chat: Open Source AI Chat with Web Tools

Quercle Chat: Open Source AI Chat with Web Tools

Quercle Chat runs entirely in your browser - no backend, no data collection. An open source, model-agnostic AI chat with web search and fetch capabilities. Use any OpenRouter model.

Jan 163 min
SERP MCP: Local Google Search for AI Agents

SERP MCP: Local Google Search for AI Agents

Get Google search results locally with SERP MCP - an open source MCP server with fingerprint rotation. Learn when to use it vs Quercle for your AI agents.

Jan 164 min
Quercle + xpander.ai: Powering AI Agents with Web Data

Quercle + xpander.ai: Powering AI Agents with Web Data

Quercle integrates with xpander.ai to give AI agents reliable web access. See how to build agents that monitor GitHub trends, research topics, and more.

Jan 164 min
Testing LLM Security: A Prompt Injection Testing Ground

Testing LLM Security: A Prompt Injection Testing Ground

Sunny Valley Farm is not what it seems. An open source website for testing whether LLM web tools can defend against prompt injection attacks.

Jan 165 min
How Claude Code Web Tools Work: WebFetch and WebSearch Internals

How Claude Code Web Tools Work: WebFetch and WebSearch Internals

A deep dive into how Claude Code implements WebFetch and WebSearch tools internally. Learn about secondary conversations, Haiku processing, and how to build better alternatives.

Jan 155 min
Quercle vs Tavily: Which Web API is Best for AI Agents?

Quercle vs Tavily: Which Web API is Best for AI Agents?

A detailed comparison of Quercle and Tavily for AI agent web access. Compare features, pricing, security, and when to use each.

Jan 154 min
Quercle vs Exa: Choosing the Right Web API for Your AI Agents

Quercle vs Exa: Choosing the Right Web API for Your AI Agents

Compare Quercle and Exa for AI-powered web access. Learn about their differences in search, content extraction, and agent integration.

Jan 154 min
Quercle vs Firecrawl: Web Scraping APIs for AI Agents Compared

Quercle vs Firecrawl: Web Scraping APIs for AI Agents Compared

Compare Quercle and Firecrawl as web fetching APIs for AI agents. See how they differ in security, pricing, and developer experience.

Jan 154 min