Build an agentic RAG system in one day
From the PDF to the agent, one layer at a time.
Agentic RAG in one day.
Most document assistants fail before the model is involved. The PDF was read in the wrong order, a table was lost, or the right passage ranked eleventh. This day covers those steps, then the agent that sits on top of them.
We build one assistant over four TotalEnergies annual reports, about 670 pages each, and write every layer ourselves.
Morning: the search
We read the pages with a layout model and Docling, split them into chunks, and index them for keyword search and semantic search. Then we combine both rankings, rerank the results and filter by company, year and language. The same search runs in plain Python, PostgreSQL and OpenSearch, so you can compare them.
Afternoon: the agent
With Google's Agent Development Kit, the model gets a search tool, skills, a memory and a pause for a person to confirm. It decides when to use each. When one agent isn't enough, as when summarising a 680-page report, we wrap it in a workflow with a router.
The last hour is about production: what a question costs, how each part fails, how to trace a request, and how to measure the search, the steps and the answers.
How the day works
There are 11 coding exercises, about one per topic. You fill in the functions, a check command tells you if they work, and a checkpoint command catches you up if you're stuck. One day is short for this material, so we chose depth on each layer over breadth.
Schedule
Why RAG, and the system we build
An assistant over four TotalEnergies annual reports, about 670 pages each, for risk managers, investors and analysts.
From PDFs to text
Reading pages with pymupdf, finding regions with a layout model, putting columns in reading order, and turning tables and charts into text with Docling.
Chunking and indexing
One topic per chunk. Keyword search with BM25, semantic search with embeddings and HNSW, in Python, PostgreSQL and OpenSearch.
Retrieval
Combining both rankings with reciprocal rank fusion, reranking with a cross-encoder, and filtering by company, year and language.
Lunch
The whole corpus is indexed in the background, so the afternoon runs on real data.
From LLM to agents
Who decides the control flow: your code, or the model.
Agents with Google ADK
Tools, skills, state and memory, and a pause for a person to confirm.
Workflows
When one agent isn't enough: a router and nine agents around the search.
In production
What a question costs, how each part fails, tracing, latency and evaluation.
Questions and close
Who should come
Engineers and data scientists comfortable with Python.
What to bring
A laptop with uv and Docker installed, and a charger.