Skip to content

tertiarycourses/C1382-Agentic-Coding-with-Claude-Code

Repository files navigation

RAG Course Materials Chatbot

Sample code for the Agentic Coding with Claude Code course by Tertiary Courses.

Live Demo: https://alfredang.github.io/C1382-Agentic-Coding-with-Claude-Code/

A Retrieval-Augmented Generation chatbot for course materials, powered by the Claude Agent SDK. It loads course documents, builds a vector store with ChromaDB, and provides intelligent Q&A with source attribution — all authenticated through your Claude Code subscription (no API key needed).

Screenshot

RAG Chatbot UI

Features: Dark/light theme toggle, sidebar with course listing and quick-start prompts, markdown-rendered responses with source attribution, session-based conversation history.

Prerequisites

  • Python 3.13+
  • uv — Python package manager
  • Claude Code CLI — installed and authenticated (npm install -g @anthropic-ai/claude-code, then claude to log in)

Setup

git clone https://github.com/alfredang/rag-claude-code-starting.git
cd rag-claude-code-starting
uv sync

Important: Do NOT set ANTHROPIC_API_KEY in your environment or .env file. The Claude Agent SDK authenticates via the Claude Code CLI's OAuth token. Setting an API key will override this and cause errors.

Running

./run.sh

Or manually:

cd backend
uv run uvicorn app:app --reload --port 8002

Open http://localhost:8002 in your browser.

How It Works

  1. Course documents (.txt files in docs/) are parsed into sentence-aware chunks and stored in ChromaDB
  2. When a user asks a question, the Claude Agent SDK spawns a Claude instance with an MCP server exposing a search_course_content tool
  3. Claude decides when and how to search the vector store, enabling multi-turn reasoning over results
  4. Responses include source links back to specific course lessons

Adding Course Documents

Place .txt files in the docs/ directory following this format:

Course Title: [name]
Course Link: [URL]
Course Instructor: [name]

Lesson 0: [title]
Lesson Link: [URL]
[content...]

Lesson 1: [title]
[content...]

Documents are automatically loaded on server startup.

API Endpoints

Method Endpoint Description
POST /api/query Send a question, get an answer with sources
POST /api/new-chat Start a new conversation session
GET /api/courses Get loaded course stats

Tech Stack

  • Claude Agent SDK — LLM integration via Claude Code CLI OAuth
  • FastAPI — Backend API server
  • ChromaDB — Vector database for semantic search
  • Sentence Transformers (all-MiniLM-L6-v2) — Text embeddings
  • Vanilla HTML/JS/CSS — Frontend (no build step)

About

Sample code for Agentic Coding with Claude Code course — RAG chatbot powered by Claude Agent SDK, FastAPI, and ChromaDB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors