Skip to content

feat: add RAG-powered Document Q&A Agent (uAgents + LangChain + Gemini)#166

Open
davi713albano-coder wants to merge 1 commit into
fetchai:mainfrom
davi713albano-coder:feat/rag-document-qa-agent
Open

feat: add RAG-powered Document Q&A Agent (uAgents + LangChain + Gemini)#166
davi713albano-coder wants to merge 1 commit into
fetchai:mainfrom
davi713albano-coder:feat/rag-document-qa-agent

Conversation

@davi713albano-coder

Copy link
Copy Markdown

Summary

Adds a RAG-powered Document Q&A Agent (contributors/rag-document-qa-agent/) that ingests PDF/plain-text documents, embeds them with HuggingFace sentence-transformers, stores vectors in ChromaDB, and answers natural-language questions via the uAgents Chat Protocol using Google Gemini 2.0 Flash as the LLM backbone.

Closes #128

What the agent does

  1. Accepts a document (PDF, .txt, .md, .csv) via the ingest <path> command or DOCUMENT_PATH env var
  2. Chunks the document with RecursiveCharacterTextSplitter and embeds with all-MiniLM-L6-v2
  3. Stores vectors in a local ChromaDB instance
  4. Answers questions grounded in document content via the Chat Protocol — no hallucinated information
  5. Supports conversational follow-up (chat history window)

Commands

Command Description
ingest <path> Load a document into the vector store
status Check if a document is currently loaded
<question> Ask a question about the loaded document

Tech Stack

  • uAgents — agent runtime + Chat Protocol
  • LangChain — RAG pipeline orchestration
  • Google Gemini 2.0 Flash — LLM (free tier, no cost barrier)
  • ChromaDB — local vector store
  • HuggingFace sentence-transformers (all-MiniLM-L6-v2) — embeddings
  • pypdf — PDF parsing

Type of Change

  • New agent example

Checklist

  • I have starred this repository.
  • New community agents are under contributors/<agent-name>/ (not repo root).
  • I ran ruff check . — all checks passed.
  • I ran ruff format . — all files formatted.
  • I added/updated README.md for changed example(s).
  • I added .env.example if environment variables are required.
  • I added demo image/GIF (if applicable).
  • I added agent profile link (if applicable).
  • I updated contributors/CHANGELOG.md for community agent changes, or root CHANGELOG.md for other non-doc changes.
  • I added my agent to the Community Contributors table in root README.md (if new agent).
  • I verified paths/commands used in docs.
  • I understand this PR requires maintainer review before merge (review-required CI).

Related Issue

Closes #128

Notes for Reviewers

  • The demo.png is a placeholder — a real screenshot should be added after manual testing.
  • The agent follows the same patterns as existing contributor agents (community_agent, news-summarizer-agent).
  • Gemini 2.0 Flash free tier is used so there's no cost barrier for contributors testing this example.

Add contributors/rag-document-qa-agent/ — a uAgent that ingests PDF
or plain-text documents, embeds them with HuggingFace
sentence-transformers, stores vectors in ChromaDB, and answers
questions via the Chat Protocol using Google Gemini 2.0 Flash.

Files:
- agent.py: uAgent with Chat Protocol (ingest, status, Q&A commands)
- rag.py: LangChain RAG pipeline (loading, chunking, embedding, retrieval)
- ingest.py: Standalone document ingestion utility
- requirements.txt, .env.example, .gitignore
- README.md with setup, usage, and architecture docs
- assets/demo.png placeholder

Also updates contributors/CHANGELOG.md and root README.md Community
Contributors table.

Closes fetchai#128
@github-actions github-actions Bot added good first issue Good for newcomers gssoc26 GirlScript Summer of Code 2026 contribution help wanted Extra attention is needed level3 GSSoC level 3 - advanced (highest points) labels Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers gssoc26 GirlScript Summer of Code 2026 contribution help wanted Extra attention is needed level3 GSSoC level 3 - advanced (highest points)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Contributor] RAG-powered Document Q&A Agent using uAgents + Langchain + Gemini

1 participant