Skip to main content
Glama

Autonomous Web Research Agent

A teaching project: one Python agent that plans, searches the web, stores notes in RAG, writes a report, then critiques itself and loops until the answer is good enough.

Stack: Python 3.11+ · LangChain · LangGraph · MCP · Chroma RAG · LangSmith

What you are building (classroom map)

Piece

File

Job

Config

src/research_agent/config.py

Reads .env

LLM layer

src/research_agent/llm.py

One function, many providers

Tools

src/research_agent/tools.py

Search + fetch pages

MCP

src/research_agent/mcp_server.py

Same tools over the MCP protocol

RAG

src/research_agent/rag.py

Remember pages in Chroma

State

src/research_agent/state.py

The graph's notebook

Nodes

src/research_agent/nodes.py

One function per step

Graph

src/research_agent/graph.py

Wires the loop

CLI

src/research_agent/cli.py

Run from terminal

API

src/research_agent/api.py

FastAPI backend

Read TEACHING.md for the full lesson.

Related MCP server: Local-MCP-server

Setup

cd ~/Projects/autonomous-web-research-agent
python3.11 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env

Put at least one LLM key in .env (OPENAI_API_KEY is the default path). Search works with free DuckDuckGo. Add TAVILY_API_KEY later if you want higher-quality search. Add LANGCHAIN_API_KEY to watch traces in LangSmith.

Run a research job

python -m research_agent.cli "How does MCP differ from a normal LangChain tool?"

Run the backend

python -m research_agent.api
# POST http://127.0.0.1:8001/research  {"question": "..."}

Run the MCP server (for Cursor / other hosts)

python -m research_agent.mcp_server

Example Cursor MCP config:

{
  "mcpServers": {
    "research-tools": {
      "command": "/Users/YOU/Projects/autonomous-web-research-agent/.venv/bin/python",
      "args": ["-m", "research_agent.mcp_server"]
    }
  }
}

Tests (no API key needed)

pytest

Available Tools

2 tools
fetch_pageB

Download a URL and return cleaned visible text.

Inputs: url (required). Returns: result

search_webC

Search the public web and return titles, URLs, and snippets.

Inputs: query (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 2 tools

    Disambiguation5/5

    search_web is for querying the web and returning snippets, while fetch_page retrieves full content from a specific URL. Their purposes are completely distinct and easily distinguishable.

    Naming Consistency5/5

    Both tools follow a consistent verb_noun pattern (search_web, fetch_page), making the naming predictable and clear.

    Tool Count3/5

    With only two tools, the server feels thin for a general research purpose. While each tool is essential, the minimal count borders on insufficient for complex workflows.

    Completeness4/5

    The two tools cover the basic research loop of searching and fetching content. Minor gaps exist (e.g., no ability to refine searches or manage results), but agents can work around them.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      A minimal MCP server for agent-friendly web extraction and search. Offers two tools: fetching real pages with Playwright and Crawl4AI, and searching across 7 engines with automatic fallback.
      3
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      A self-contained web-research MCP server that lets local LLM agents search, fetch, and synthesize web content using tools like web_search, web_fetch, and web_research.
      2
      MIT