← explainer-hub

explainer-hub · LLM agents

Illustrated Guide to AI Agents

把 Maarten 的圖解 newsletter(why)對上 HandsOnLLM 的 TinyAgent 教材 repo(how):同一條 Agent 心智模型,兩種載體。

兩個來源,一條主線

第一個連結不是 GitHub codebase,是 Substack 圖解長文;第二個才是 O'Reilly 書配套碼庫。兩者是「概念地圖 → 動手組裝」。

Source A · Newsletter · 2025-03

A Visual Guide to LLM Agents

  • 形式:約 60+ 自訂圖的長文
  • 目標:講清 Agent 是什麼、有哪些零件
  • 主軸:Memory · Tools · Planning · Multi-Agent
  • 產出:心智模型,無可 clone runtime
Source B · Repo · 2026

An-Illustrated-Guide-To-AI-Agents

  • 形式:Jupyter + PyPI illustrated-agents
  • 目標:從零組出可跑的 TinyAgent
  • 主軸:每章加一塊模組(memory / tools / ReAct…)
  • 產出:可 Colab/本機跑的教學 runtime

一句話:Newsletter 定義 Augmented LLM 與 agentic 程度;repo 用純 Python(OpenAI-compatible endpoint)把 Memory / Tools / Planning 嵌進同一個 autonomy loop。

零件對映:點選切換

把 newsletter 三大件對到 repo 實際類別與章節。點 tab 看細節。

Newsletter

Short-term:塞 context 或 LLM 摘要。Long-term:向量庫 + RAG。對應 CoALA 式記憶分類。

→

Repo · Ch4

Memory、TrimmingMemory、SummarizationMemory、LongTermMemory(embedding + cosine)。

src/illustrated_agents/memory.py

TinyAgent autonomy loop

核心在 agent.py:模組邊界清楚,迴圈就是 Thought → parse → Action → Observation,直到 final_answer。

LLM.generate planner.parse · tools.parse tools.execute OBSERVATION → memory final_answer
  1. 01
    memory.add(user)寫入任務;可帶 image(Ch9 multimodal)。
  2. 02
    LLM.generate純 urllib 打 OpenAI-compatible /chat/completions;可掛 tools schema。
  3. 03
    parse文字 JSON 的 ReAct,或原生 tool_calls 的 NativeReAct。
  4. 04
    execute → observe結果回寫 memory;trajectory 記錄步驟;達 max_steps 或 final_answer 結束。

章節路線圖

建議順序:先 newsletter 心智模型,再 Ch1→Ch10。Ch5 / Ch6 有多本 notebook,照 README 順序走。

概念 ↔ 實作速查

NewsletterRepo 落地
Augmented LLMLLM + tools + memory
Short / long-term memoryTrimming / Summarization / LongTermMemory
Function calling & MCPCh5 Tools · MCP · Skills
ReActReAct prompt + regex parse
ReflexionReflexion.reflect() 每 N 步注入矯正
Coding agentCh10:讀寫檔 + execute_python CLI

強項、限制、建議用法

強項

  • 圖解 + 模組化,學習曲線平緩
  • 真的從零組,不是只包框架
  • 涵蓋 MCP、native tool calling、skills、coding agent
  • Colab 免費路徑清楚

限制

  • 教材型 runtime,非 production orchestration
  • 評測/多代理章相對輕
  • execute_python 有 timeout,非完整 sandbox 敘事
  • 教學迭代痕跡(偶有重複命名)

建議:當「底層原理課」。產品多代理再接 CrewAI / AutoGen / 自家 orchestrator。讀完 newsletter → 跑 Ch1–10 → 對照自己系統的 memory / tools / planner 邊界。