Project 3: A Research Assistant Agent with Tools
Build a LangChain agent that plans research steps, uses tools, and produces a cited summary.
Quick Reference
| Attribute | Value |
|---|---|
| Difficulty | Level 3: Advanced |
| Time Estimate | 12-20 hours |
| Language | Python or JavaScript |
| Prerequisites | Tool calling, retrieval basics |
| Key Topics | agents, tools, planning, citations |
1. Learning Objectives
By completing this project, you will:
- Build a tool-using agent that plans steps.
- Add web or document retrieval tools.
- Enforce citation requirements for claims.
- Log and replay agent traces.
- Evaluate answer quality with a rubric.
2. Theoretical Foundation
2.1 Agentic Research
Research agents must separate planning from execution and ensure every claim is grounded in evidence.
3. Project Specification
3.1 What You Will Build
An agent that takes a research question, performs multi-step retrieval, and outputs a cited response.
3.2 Functional Requirements
- Planner to decompose questions.
- Tool set for search and retrieval.
- Citation enforcement in output.
- Trace log of steps and tool calls.
- Evaluation rubric for quality.
3.3 Non-Functional Requirements
- Safe tool use with allowlists.
- Deterministic mode for testing.
- Evidence-first responses.
4. Solution Architecture
4.1 Components
| Component | Responsibility |
|---|---|
| Agent | Plan and execute steps |
| Tools | Search, read, summarize |
| Trace Logger | Record decisions |
| Evaluator | Score output quality |
5. Implementation Guide
5.1 Project Structure
LEARN_LANGCHAIN_PROJECTS/P03-research-assistant/
├── src/
│ ├── agent.py
│ ├── tools.py
│ ├── prompts.py
│ ├── trace.py
│ └── eval.py
5.2 Implementation Phases
Phase 1: Agent + tools (4-6h)
- Implement agent loop with tool calls.
- Checkpoint: agent completes a 3-step task.
Phase 2: Citations + trace (4-6h)
- Add citations in output.
- Log tool calls and decisions.
- Checkpoint: trace file is replayable.
Phase 3: Evaluation (4-8h)
- Add rubric and test questions.
- Checkpoint: quality scores recorded.
6. Testing Strategy
6.1 Test Categories
| Category | Purpose | Examples |
|---|---|---|
| Unit | tools | tool schemas valid |
| Integration | agent | multi-step completion |
| Regression | citations | every claim cited |
6.2 Critical Test Cases
- Missing citation triggers output failure.
- Tool failure is logged and recovered.
- Agent stops within step budget.
7. Common Pitfalls & Debugging
| Pitfall | Symptom | Fix |
|---|---|---|
| Hallucinated claims | no sources | enforce citations |
| Infinite loops | repeated tools | add step limit |
| Overly broad plan | no progress | break into tasks |
8. Extensions & Challenges
Beginner
- Add a local document search tool.
- Add structured report output.
Intermediate
- Add reranking of sources.
- Add summary + full evidence sections.
Advanced
- Add multi-agent debate for research.
- Add confidence scores per claim.
9. Real-World Connections
- Research copilots require traceable evidence.
- Compliance teams need audit trails for conclusions.
10. Resources
- LangChain agent docs
- RAG system design guides
- “AI Engineering” (agent safety)
11. Self-Assessment Checklist
- I can build a tool-using agent.
- I can enforce citations in outputs.
- I can log and replay agent traces.
12. Submission / Completion Criteria
Minimum Completion:
- Agent executes multi-step research
- Cited output
Full Completion:
- Trace logging
- Evaluation rubric
Excellence:
- Reranking or multi-agent debate
- Confidence scoring per claim
This guide was generated from project_based_ideas/AI_AGENTS_LLM_RAG/LEARN_LANGCHAIN_PROJECTS.md.