State, Memory, RAG, and Execution Graphs
Build an evidence-grounded stateful workflow with retrieval, citations, and abstention.
Previous · Course overview · Next
Assignment
Let the agent use project-specific knowledge when it needs evidence. Continue in your project repository and:
- Prepare a small knowledge collection relevant to your project.
- Split and index it while preserving stable source identifiers.
- Implement retrieval with a local embedding model such as FastEmbed so that indexing and search do not consume OpenRouter credit.
- Represent the complete agent workflow as an explicit state graph.
- Allow the agent to retrieve, inspect a source, search again, use another project tool, ask for clarification, answer, or abstain.
- Verify that cited evidence exists and was actually retrieved.
The graph transition after retrieval must depend on the evidence found. Include one case where the first retrieval is insufficient and the agent decides whether to try again or abstain. Test retrieval and answer generation separately. A fixed single-pass retrieve -> answer pipeline does not satisfy the assignment.
Example
The diagram shows retrieval as one capability inside an agent loop, not a fixed single-pass RAG pipeline.
Deliverables
- A reproducible domain-knowledge index with source metadata.
- An explicit state graph with success, clarification, abstention, and failure paths.
- Retrieval using a reproducible local embedding setup.
- Verifiable citations in the agent’s results.
- A small evaluation set containing supported and unsupported cases.
- Separate retrieval and answer-quality results.
- Tests, traces, and analysis of at least one failure.