< all projects26 steps · medium · Rebuild
Build a research agent that writes a cited report
You will have built a research agent, one function at a time, and watched a real model answer a question from a pile of company notes with a report whose every sentence cites a source: 6 functions that index and search the notes, 4 that turn the question into sub-questions, 5 that run researchers in parallel under a budget and merge what they found, 6 that write and parse a report with numbered citations, 3 that check every citation and every quote, and 2 that run the loop and fix what the check rejects. Each step is a few lines with its own tests, and the earlier functions are provided to the later ones. The notes are handed to you, and so is `model`, with one method, `chat(messages, tools, system, max_tokens)`. It is real: the steps that call it check what it did (the plan has the right shape, a quote is really in the note, every sentence ends in a citation) and spend a little of your credits. The point of the project is the shape around the calls. The planner proposes and the budget disposes. A researcher may cite only what it was shown, and a quote it invents is dropped in code. The writer sees findings, not notes. The checker holds the report to a rule a model cannot talk its way around: either the words are in the note or they are not. When every step has passed, the six files assemble into one agent, and you can ask it a question, live, and read the report it writes with its sources.
Part 01 · 6 steps
Find the notes
A keyword index over the corpus, and the search the researchers use.
Part 02 · 4 steps
Plan the research
A real model splits the question into sub-questions you can trust.
Part 03 · 5 steps
Researchers
Workers that read notes and return findings with quotes, in parallel, under a budget.
Part 04 · 6 steps
Write it up
A report with numbered citations, parsed and renumbered.
Part 05 · 3 steps
Check it
Every sentence has a source, and every quote is really in the note.
Part 06 · 2 steps
The loop
One pass that plans, researches, writes, fixes and stops.