New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
You know RAG, agents, and evals separately, and you have never actually put all three in one script that runs end to end.
What you'll have at the end
One deployed script that retrieves context, lets an agent call a tool, and grades its own answer before returning it
You need
You can already call an LLM API with a defined tool schema, embed short passages and compare them by similarity, and you have, or can stand in for, one function that returns a real record by id, such as an order lookup.
Not covered
Scaling the document set to a real vector database, letting the agent choose among several tools, or resuming a crashed run mid-chain are separate jobs; this wires exactly one retrieval step, one tool, and one check into a single working path.
Leans on
Your RAG system leaked across tenants
if this script will serve more than one account or customer, wire tenant isolation into the retrieval step first; this recipe assumes one shared document set.
Your agent crashed mid task with no checkpoint to resume from
if a single tool call is expensive or slow enough that losing it mid-run would genuinely hurt, that recipe adds the checkpoint this one script skips.
Checked 15 Aug 2026
Part of the AI Engineering cookbook