Skip to content
Projects

About

A 36-chapter full-stack AI agent course covering everything from the ReAct loop and Claude Code reverse engineering to the MCP/A2A protocols, RAG, DSPy, and production observability—all delivered as runnable Python files.

Security & Privacy

How these counts are measured

Measured star growth

in 24h
-1
in 7 days
+1
in 15 days
+3
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README_EN.md

Original

🤖 AI Agent Full-Stack Learning Course

Master AI Agent core theory and engineering from zero to one
37 Chapters · 22,000+ Lines of Code · 60+ Runnable Examples · Interview-Ready

Python Chapters License Update

🇨🇳 中文 README


🔗 Quick Links

Live Site GitHub RAG Deep Dive MCP Protocol

🌐 No installation — read in your browser: agent-study-ruddy.vercel.app · All 37 chapters · Dark blueprint theme · Mobile-friendly


📖 Overview

A career- and product-engineering-oriented AI Agent full-stack course. It spans Agent fundamentals and code agents, RAG, MCP 2026-07-28, A2A v1.0, Responses API tool orchestration, streaming UI, evaluation, security, and observability — 37 topics across 7 tiers. Each chapter is a standalone runnable .py file: a lecture and executable code in one.

Target audience: New graduates, career switchers, and any developer looking to systematically master AI Agents.


🗺️ Course Roadmap (37 Chapters · 7 Tiers)

Tier 1: Foundations ── Tier 2: Engineering ── Tier 3: Deep Tech ── Tier 4: Production
   Ch0-3                   Ch4-7                  Ch8-12               Ch13-18

Tier 5: Advanced Arch ── Tier 6: Reinforcement ── Tier 7: Expert
  Ch19-24                    Ch25-28                   Ch29-36

Tier 1: Agent Foundations

Ch Topic Key Technologies
Ch0 Course Overview & Setup Learning roadmap, dependency installation, API key config
Ch1 Your First Agent Handwritten ReAct loop, Function Calling principles
Ch2 Agent Core Components Planner, memory systems (short/long/working term), tool design golden rules
Ch3 Agent Architecture Types ReAct / Plan-Execute / Reflexion comparison

Tier 2: Engineering Practice & Frameworks

Ch Topic Key Technologies
Ch4 Mainstream Frameworks LangChain Agent + LangGraph state machine
Ch5 Multi-Agent Systems Writer+Reviewer collaboration, crewAI style
Ch6 Evaluation & Testing Eval frameworks, LLM-as-Judge, production checklist
Ch7 Interview Preparation 20 high-frequency questions + project guide + interview flow

Tier 3: Deep Technical Analysis

Ch Topic Key Technologies
Ch8 Claude Code Architecture nO main loop, h2A Steering, context compaction, SubAgent
Ch9 RAG Deep Dive Chunking strategies, Embedding selection, RRF, Cross-Encoder, production modes
Ch10 MCP Protocol Explained JSON-RPC, primitives (Tools/Resources/Prompts), capability negotiation
Ch11 Tool Calling Internals OpenAI vs Anthropic, streaming assembly, strict mode
Ch12 Agent Production Infrastructure OpenClaw architecture, Harness, production checklist

Tier 4: Production Engineering

Ch Topic Key Technologies
Ch13 FastAPI Agent Service REST API, SSE streaming, WebSocket, production deployment
Ch14 SQLite Persistence 5-table schema, WAL mode, session/task/user management
Ch15 Google A2A Protocol AgentCard, Task, Artifact, multi-agent collaboration
Ch16 MemGPT/Letta Memory Core Memory, Heartbeat, Sleep-Time, Filesystem Memory
Ch17 Computer Use Screenshot-Action Loop, coordinate calculation, security sandbox
Ch18 Agent Security & Guardrails Prompt Injection, privilege levels, input sanitization, 4-layer defense

Tier 5: Advanced Architecture & Optimization

Ch Topic Key Technologies
Ch19 Agentic Workflow Patterns Reflection / Routing / Orchestrator-Worker / Evaluator-Optimizer (7 patterns)
Ch20 Context Engineering Context Rot, budget management, XML-structured prompts, Skill.md
Ch21 Streaming & Real-time Architecture EventBus, dynamic interrupts, backpressure, StateManager Reducer
Ch22 DSPy Auto-Optimization Signature→Module→Optimizer, automatic few-shot, LangChain complement
Ch23 Code Agent Architecture Survey CodeAct / ACI / Plan-Execute, SWE-bench, Agentless findings
Ch24 Agent Observability Tracing Span tree, dashboards, LangSmith vs LangFuse, alerting

Tier 6: Foundational Reinforcement

Ch Topic Key Technologies
Ch25 Vector Database Selection Chroma / Pinecone / Milvus / Qdrant comparison, Embedding trade-offs
Ch26 Model Routing Strategies Threshold / Cascade / Semantic / Cost-Aware (4 strategies)
Ch27 Agent Prompt Engineering System Prompt 6-module template, tool description scoring card
Ch28 Semantic Caching & Token Optimization Exact→Semantic→LLM three-tier cache, token budget management

Tier 7: Expert Level

Ch Topic Key Technologies
Ch29 Multi-Modal Agent Vision + text joint reasoning, multi-modal tool calling
Ch30 Agent Reliability Engineering Circuit breaker, exponential backoff retry, idempotency, degradation
Ch31 Agent Benchmarking in Depth GAIA / AgentBench / WebArena / ClawBench / tau-bench / SWE-bench
Ch32 Self-Improving Agent Bad case collection → auto prompt optimization → eval validation
Ch33 Prompt Caching & Inference Optimization Anthropic Cache, KV sharing, speculative decoding
Ch34 Model Fine-tuning for Function Calling LoRA, fine-tuning data preparation, cost-benefit analysis
Ch35 Data Flywheel Interaction collection → bad case detection → auto-triggered improvement
Ch36 Agent Defense in Depth Canary Token, layered isolation, behavioral sandbox

🚀 Quick Start

1. Clone the Repository

git clone https://github.com/Callous-0923/agent-study.git
cd agent-study

2. Check Environment

python chapter_00_overview/00_course_overview.py

3. Install Dependencies

Open chapter_00_overview/00_course_overview.py, change install = False to install = True, then run:

python chapter_00_overview/00_course_overview.py

4. Configure API Key (only needed for Ch1-5)

Create a .env file in the project root:

OPENAI_API_KEY=sk-your-api-key-here
OPENAI_BASE_URL=https://api.openai.com/v1
LLM_MODEL=gpt-5.6-terra

You can also use other providers (DeepSeek, Qwen, etc.) by changing OPENAI_BASE_URL and LLM_MODEL.

5. Start Learning (most chapters require no API key!)

# No API key needed — run directly
python chapter_08_claude_code/08_claude_code_architecture.py
python chapter_10_mcp/10_mcp_deepdive.py
python chapter_14_sqlite/14_sqlite_agent_storage.py
python chapter_19_workflow_patterns/19_workflow_patterns.py
python chapter_21_streaming/21_streaming_architecture.py
python chapter_24_observability/24_observability.py
python chapter_26_model_routing/26_model_routing.py
python chapter_28_cache/28_cache.py

📦 Dependencies

Dependency Chapters Description
openai Ch1-3 OpenAI API calls
langchain + langgraph Ch4-5 Agent framework hands-on
fastapi + uvicorn Ch13 Agent service deployment
pydantic Ch13 Data model validation
python-dotenv Ch0 Environment variable management

Optionally run pip install -e ".[agents]" for follow-up exercises using the OpenAI Agents SDK. Core examples continue to use the Responses API or offline teaching implementations.

Note: Chapters 8-12 and 14-28 mostly rely on the Python standard library (sqlite3, asyncio, hashlib, etc.) — no extra installation needed.


🎯 Learning Paths

Path 1: From Scratch (recommended for beginners)

Follow Ch0 → Ch36 in order, 1-2 hours per chapter.

Path 2: Interview Cram (key chapters)

  • Ch7: 20 high-frequency interview questions + process
  • Ch8: Claude Code architecture (industry-grade Agent design)
  • Ch9: RAG deep dive
  • Ch10 + Ch15: MCP & A2A dual protocols
  • Ch11: Tool Calling internals
  • Ch18: Agent security (demo vs. production engineer differentiator)
  • Ch19: Workflow design patterns (universal system design framework)
  • Ch26: Model routing (evaluate quality, latency, and cost on private workloads)

Path 3: Build Products

  • Ch13: FastAPI service
  • Ch14: SQLite persistence
  • Ch11 + Ch21: Tool Search/PTC + streaming UI, approvals, and Realtime
  • Ch12 + Ch24: Production checklist + observability
  • Ch26 + Ch28: Cost optimization (routing + caching)

🧠 Core Technology Coverage

Tool Calling Internals  ★★★★★  OpenAI/Anthropic + Tool Search/PTC + streaming assembly
MCP Protocol            ★★★★★  2026-07-28 stateless core + routing/MRTR/cache
A2A Protocol            ★★★★★  v1.0 AgentCard/Task/Artifact + standard stream events
Claude Code Architecture★★★★★  nO/h2A/Compaction/SubAgent reverse analysis
RAG Full-Stack          ★★★★   Chunking/Embedding/RRF/Cross-Encoder/Production
Model Routing           ★★★★   4 strategies + cost comparison experiments (94% savings)
Semantic Caching        ★★★★   Three-tier cache + Token budget management
Agent Security          ★★★★   Prompt Injection + privilege levels + 4-layer defense
DSPy Auto-Optimization  ★★★★   Signature/Module/Optimizer + LangChain complement
Agentic Workflow        ★★★★   7 design patterns + system design answer framework
Context Engineering     ★★★★   Context Rot principles + XML Prompt + budget management
Streaming Architecture  ★★★★   EventBus + dynamic interrupts + backpressure
Observability           ★★★★   Tracing Span tree + LangSmith vs LangFuse
MemGPT Memory           ★★★★   Core Memory/Heartbeat/Sleep-Time/Filesystem
Code Agents             ★★★    CodeAct/ACI/Plan-Execute + SWE-bench
Vector Databases        ★★★    Chroma/Pinecone/Milvus/Qdrant + Embedding strategies
FastAPI Service         ★★★    REST/SSE/WebSocket + production deployment
SQLite Persistence      ★★★    5-table Schema + WAL + audit queries
Computer Use            ★★★    Screenshot-Action Loop + security sandbox

📁 Project Structure

agent-study/
├── README.md
├── README_EN.md
├── .gitignore
├── chapter_00_overview/              🚀 Course overview + setup
├── chapter_01_fundamentals/          📖 First Agent (handwritten ReAct)
├── chapter_02_components/            🧩 Planner + Memory + Tool design
├── chapter_03_types/                 🎯 ReAct / Plan-Execute / Reflexion
├── chapter_04_frameworks/            🔧 LangChain + LangGraph
├── chapter_05_multi_agent/           🤝 Multi-agent collaboration
├── chapter_06_evaluation/            📊 Evaluation + testing strategies
├── chapter_07_interview/             🎓 20 interview questions + career guide
├── chapter_08_claude_code/           🏗️ Claude Code architecture reverse engineering
├── chapter_09_rag_deepdive/          🔍 RAG deep dive (Chunking, Embedding, Production)
├── chapter_10_mcp/                   🔌 MCP protocol complete implementation
├── chapter_11_tool_calling/          ⚙️ Tool Calling internals
├── chapter_12_infrastructure/        🏭 OpenClaw/Harness/Production infrastructure
├── chapter_13_fastapi/               🌐 FastAPI Agent service
├── chapter_14_sqlite/                💾 SQLite persistence
├── chapter_15_a2a/                   🤖 Google A2A protocol
├── chapter_16_memgpt/                🧠 MemGPT/Letta memory architecture
├── chapter_17_computer_use/          🖥️ Computer Use + GUI
├── chapter_18_security/              🛡️ Agent security & guardrails
├── chapter_19_workflow_patterns/     🏷️ Agentic Workflow design patterns
├── chapter_20_context_engineering/   📐 Context Engineering
├── chapter_21_streaming/             📡 EventBus real-time architecture
├── chapter_22_dspy/                  🔬 DSPy auto-optimization
├── chapter_23_code_agents/           📊 Code Agent architecture survey
├── chapter_24_observability/         📈 Observability (LangSmith/LangFuse)
├── chapter_25_vectordb/              🗄️ Vector database selection
├── chapter_26_model_routing/         🔀 Model routing & cost optimization
├── chapter_27_prompt_eng/            ✍️ Agent Prompt engineering
├── chapter_28_cache/                 ⚡ Semantic caching & token optimization
├── chapter_29_multimodal/            👁️ Multi-Modal Agent
├── chapter_30_reliability/           🛡️ Agent reliability engineering
├── chapter_31_benchmarks/            📊 Agent benchmarking in depth
├── chapter_32_self_improving/        🔄 Self-Improving Agent
├── chapter_33_prompt_cache/          💾 Prompt Caching & inference optimization
├── chapter_34_finetune/              🎯 Model fine-tuning for Function Calling
├── chapter_35_data_flywheel/         🔁 Data flywheel
└── chapter_36_defense/               🏰 Agent defense in depth

✨ Features

  • 📝 Lecture-as-Code: Each .py file is both a complete lecture (module-level docstring) and runnable code
  • 🤖 No API Key Needed: Chapters 8-28 mostly use only the standard library — run directly
  • 🎤 Interview-Oriented: Each chapter highlights key interview topics with answer frameworks and scoring points
  • 🔗 Cross-Referenced: Chapters form a complete knowledge network through cross-references
  • 📊 Runnable Demos: Every chapter includes complete demonstration output
  • 🇨🇳 Chinese-first with English README available

🌟 References


📄 License

MIT License — Free to use, modify, and distribute.


If this project helps you, please give it a ⭐ Star!
37 Chapters · 7 Tiers · Verified 2026.08 · Issues and PRs welcome

Explore related projects

Loading…