Back to M3 — Tool-Calling Lite + Capstone

Tool-Calling / Single-Agent Loop Lite

Outcome: Wire one function-call agent over the retriever Curated video (IBM Technology): What is Tool Calling? Connecting LLMs to Your Data — https://www.youtube.com/watch?v=h8gMhXYAv1k (verified live via yt-dlp 2026-09-24). Pointer: agent-loop skeleton (starter); shell: courses/video-scripts/genai-rag-agents/04.md.

5 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.

Ready to continue?

Mark this lesson as complete when you're ready to proceed.

Key moments

  1. Agent Loop Lite Overview — Examines the minimal single-agent while-loop architecture without external framework dependencies.
  2. Tool Schema and Invocation — Demonstrates declaring retriever tool schemas and handling tool call requests from model completions.
  3. Retrieve-Draft-Cite Loop — Walks through the iterative cycle of retrieving documents, drafting answers, and validating inline citations.
  4. Budget Guards & Cost Caps — Implements strict execution step counters and cumulative token spend guardrails.
  5. Structured Audit Telemetry — Instruments structured JSON telemetry logging across agent turns to feed evaluation suites.
PDF notes

Frequently asked questions

Why build a native while-loop instead of using LangGraph or CrewAI?

A native loop eliminates framework abstractions, giving you complete visibility into state mutations, cost controls, and debugging traces.

What happens if the retriever returns empty or irrelevant chunks?

The agent passes the empty context back to the model, prompting it to either reformulate the search query or report missing information.

Where in the loop should the citation check be executed?

Execute the citation validation immediately after the model returns a final text response without tool calls, before returning to the caller.

How does this single-agent loop connect to the M2 golden test suite?

Every completed loop execution emits structured traces that evaluate precision, recall, and hallucination metrics against your golden eval dataset.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.