A local-first conversational ReAct assistant in Go. Flip two toggles to choose where answers come from: 📚 My Library (your own PDF books, searched natively over Pinecone) and 🌐 Web (live results via Tavily). It remembers your conversations, narrows to a single book when you name one, cites its web sources, and labels every answer with where it actually came from.
Two toggles sit next to the chat box. They decide which retrieval tools the agent is even allowed to use this turn — so the answer is always grounded in a source you picked, never a silent guess.
Answers come from your PDF books — embedded with Ollama and searched directly over Pinecone — plus the MongoDB database via MCP. Name a book and it narrows the search to just that title.
Answers use live web search via the Tavily API. The source URLs are captured and rendered as clickable, persisted "Sources" chips on the answer.
No retrieval tools are wired in — the agent answers from the model's own knowledge. If it doesn't know, it says so and suggests enabling 🌐 Web instead of hallucinating.
Every capability exists to keep the assistant accurate and transparent — grounding answers in sources you control, and telling you exactly where each answer came from.
Turns are persisted in MongoDB via a direct Go driver. A token-budgeted tier keeps recent turns verbatim and folds older ones into a rolling summary, so prompts stay cheap on small local models.
No external service. The agent embeds your query with Ollama (nomic-embed-text) and queries Pinecone directly for the most relevant book chunks — ported from the Omni-RAG retrieval code.
Mention a book in chat and it resolves against a Mongo books catalog, filtering the vector search to just that title. Ambiguous? The agent clarifies — "do you mean X or Y?" — instead of guessing.
Tavily source URLs are captured during the ReAct loop and rendered as clickable, persisted "Sources" chips — so every web-backed claim links back to where it came from.
Each answer carries a tag for exactly where it came from: from My Library, from Web, from Database, or the model's own knowledge. No source pretends to be another.
A dedicated ingest page takes a PDF, then extracts → chunks → embeds → upserts it into Pinecone and a Mongo books catalog — adding it to My Library for the agent to cite.
A dedicated recall_history tool, scoped to the current conversation and injected by the backend, lets the model fetch exact earlier messages — never the destructive MongoDB CRUD tools.
Runs fully local on Ollama by default; switches to Anthropic Claude when ANTHROPIC_API_KEY, ANTHROPIC_MODEL, and ANTHROPIC_CREDIT_BALANCE: true are all set — no code change.
A standalone MongoDB Model Context Protocol server exposes CRUD as discoverable tools over SSE. Gated behind My Library, and kept separate from the deterministic conversation-history layer.
A step-by-step tour of the live UI — from an empty chat to library-grounded answers, web citations, ingestion, and conversation history. Click any screenshot to zoom.
The hero greets you with the two source toggles off by default. Flip 📚 My Library and/or 🌐 Web to decide where this turn's answer may come from.
Active toggles turn emerald. The active set decides which retrieval tools the ReAct loop is allowed to call this turn — search_pdf + mcp for Library, web_search for Web.
Name a book and the agent resolves it against the catalog and filters the vector search to that title. The answer carries a from My Library provenance tag.
With 🌐 Web on, the agent searches Tavily and renders the source URLs as clickable "Sources" chips beneath a from Web tag.
When My Library is on but the topic can't be pinned to one book, the agent asks back — Needs your input — rather than hallucinating across thousands of chunks.
The /ingest.html page takes a PDF and runs extract → chunk → embed → upsert into Pinecone and the books catalog, adding it to My Library.
The right-hand sidebar lists prior conversations. Click one to reload its full thread — answers, source tags, and citations included.
Two decoupled Go services and a pluggable LLM brain, joined by an open protocol. The agent reasons and picks its tools per turn; the MCP server exposes MongoDB as discoverable tools; nothing is hardcoded between them.
A single endpoint runs the full reason → act → observe cycle. The active tool set is assembled per request from the source toggles; tool observations live only inside one turn and are never persisted.
tools/list, then iterative Thought → Action → Observation until the final answer.Recent turns are kept verbatim within a token budget; older turns fold into a rolling summary. Raw tool observations (Pinecone chunks, web text) are never persisted or replayed — re-retrieved fresh each turn if needed.
The active tool set is rebuilt every request: recall_history is always in; search_pdf + mcp only with My Library; web_search only with Web. The system prompt branches its guidance to match.
| Service | Port | Endpoint |
|---|---|---|
| ReAct agent + chat UI | 8082 | POST /api/agent/query · chat UI at / · ingest at /ingest.html |
| Ingestion | 8082 | POST /api/ingest (multipart PDF upload) |
| Conversations | 8082 | GET /api/conversations · GET|DELETE /api/conversations/{id} |
| MongoDB MCP server | 8083 | SSE at /sse |
Tools are wired in per turn based on the source toggles. The MongoDB operations are advertised by the MCP server at runtime and work against any collection.
| Tool / Operation | Gated by | What it does |
|---|---|---|
recall_history | Always on | Read-only, conversation-scoped recall of earlier messages |
search_pdf | 📚 My Library | Native Pinecone vector search over your PDF books (Ollama embeddings), with book-title narrowing |
web_search | 🌐 Web | Live web search via Tavily, with source-URL citations |
list_collections | 📚 · MCP · discovered | List all collections with document counts |
query_documents | 📚 · MCP · discovered | Query documents with an optional filter |
insert_document | 📚 · MCP · discovered | Insert a new document |
update_document | 📚 · MCP · discovered | Update matching documents |
delete_document | 📚 · MCP · discovered | Delete matching documents |
The system is two decoupled Go services wired together over MCP — the agent (the brain, tools, PDF search, ingestion, and conversation memory) and a standalone, general-purpose MongoDB MCP server.
The reasoning core and the chat + ingest UI. It assembles a per-turn tool set from the source toggles, runs the ReAct loop against Ollama or Claude, embeds queries and searches Pinecone natively, persists conversations to MongoDB, and ingests PDFs.
Browse agents/ →A standalone Model Context Protocol server exposing a MongoDB database as MCP tools over HTTP/SSE. General-purpose — the CRUD tools operate on any collection and any document shape. Connect any MCP client; it is agent-agnostic.
Browse mcp/ →
search_pdf · web_search · mcp · recall_history
tools/listA single script installs and verifies Go, MongoDB, and Ollama, pulls the models, builds both modules, and creates your config files. The only thing you provide is API keys (Tavily / Pinecone / optionally Anthropic).
# macOS · Homebrew · idempotent — safe to re-run git clone https://github.com/dharmendrra/agentic-ai.git cd agentic-ai ./setup.sh # Then start the two services in separate terminals: cd mcp && go run . # MongoDB MCP server on :8083 cd agents && go run . # Agent + chat UI on :8082 # Open the UI open http://localhost:8082 # chat open http://localhost:8082/ingest.html # add PDFs to My Library
setup.sh automatesInstalls/verifies Go, MongoDB (and starts the service), and Ollama; pulls nomic-embed-text + a chat model; runs go mod download and builds both modules; copies config.example.json → config.json in agents/ and mcp/ if missing.
API keys can't be auto-provisioned. The script reads TAVILY_API_KEY, PINECONE_API_KEY, PINECONE_HOST (and optionally Anthropic) from your environment if set — otherwise it writes placeholders and prints exactly which keys to fill in agents/config.json. config.json stays gitignored.
A Go-centric, local-first stack built around an open protocol — portable across LLM backends and MCP clients.
Full Go source, per-module READMEs, MCP client setup for Claude Desktop & Cursor, API + storage-format docs, and architecture diagrams live in the repository.