cat ./series/ai-agents-tu-zero
Roadmap 25 bài về AI agents cho senior dev đã hiểu LLM: control loop, tool use, planning, memory, multi-agent, eval, production. Code from scratch trước, framework sau. Pitfall storytelling thay vì tutorial sạch.
Read intro: AI Agents từ zero: Series Plan- [1/27] Agent là gì: LLM cộng tools cộng memory cộng loop Bài 1 series AI Agents từ zero. Định nghĩa agent từ góc nhìn dev, 4 thành phần cốt lõi (LLM, tools, memory, control loop), so sánh với chatbot, RPA, traditional code, kèm pseudocode tối giản và pitfall đầu tiên thường gặp.
- [2/27] Tool use cơ bản: function calling, JSON schema, error handling Bài 2 series AI Agents. Cách định nghĩa tool cho LLM, viết JSON schema rõ ràng, handle error đúng cách, và pattern idempotency cho tool có thể retry an toàn.
- [3/27] Control loop: ReAct, agentic loop, điều kiện dừng Bài 3 series AI Agents. Vòng lặp cốt lõi của agent: structure, stop conditions, max_iterations, token budget, early termination khi detect loop.
- [4/27] Memory cho agent: context window, scratchpad, summarization Bài 4 series AI Agents. Quản lý memory: short-term history, scratchpad notes LLM tự viết, summarization khi vượt context window, long-term store với vector DB.
- [5/27] Build agent từ đầu: 100 dòng Python với Anthropic SDK Bài 5 series AI Agents. Hands-on: code agent đầy đủ ~100 dòng Python với Anthropic SDK Claude Sonnet 4.6. Tools file system + shell. Walk-through từng phần code, demo task thực tế.
- [6/27] ReAct: thought, action, observation cycle Bài 6 series AI Agents. Pattern ReAct, LLM nghĩ trước khi hành động, observation kết quả, lặp. Original paper, why it works, code implementation, khi nào skip với modern model.
- [7/27] Plan-and-Execute: tách planning khỏi execution Bài 7 series AI Agents. Pattern Plan-and-Execute, LLM lên plan đa-bước trước, executor chạy từng bước. Khác ReAct ở chỗ planning là phase riêng.
- [8/27] Tree of Thoughts và tree search cho agent Bài 8 series AI Agents. Tree of Thoughts (ToT), explore nhiều branch of thought song song, evaluate, pick best. Compute-intensive nhưng giải được task ReAct fail.
- [9/27] Self-reflection: critic, verifier, retry pattern Bài 9 series AI Agents. Agent tự đánh giá output trước khi return. Critic pattern, verifier pattern, retry với feedback. Reflexion paper baseline.
- [10/27] Chain-of-Thought so với structured reasoning Bài 10 series AI Agents. CoT prompting vs explicit reasoning steps trong structured output. Khi nào prompt 'think step by step' đủ, khi nào cần schema. Era reasoning model (o1, R1, Claude thinking).
- [11/27] Tool design: schema, validation, idempotency Bài 11 series AI Agents. Sâu hơn bài 2: nguyên tắc thiết kế tool tốt, schema design pattern, validation layer, idempotency keys, atomic vs partial action.
- [12/27] Code execution sandbox: subprocess, Docker, e2b Bài 12 series AI Agents. Cho agent chạy code do LLM viết, an toàn thế nào. Compare subprocess, Docker, e2b cloud sandbox. Security model từng option.
- [13/27] Browser automation cho agent: Playwright và computer use Bài 13 series AI Agents. Cho agent dùng browser: Playwright (DOM-based) vs Computer Use (vision + click). Use cases, code, cost compare.
- [14/27] RAG cho agents: retrieval trong vòng lặp, không phải QA Bài 14 series AI Agents. RAG cho agent khác RAG cho QA: retrieval là một tool trong loop, agent quyết định khi nào search và query gì. Multi-hop retrieval.
- [15/27] MCP (Model Context Protocol): chuẩn hoá tool layer Bài 15 series AI Agents. MCP, protocol Anthropic open-source để chuẩn hoá tool/resource/prompt layer. Architecture, server vs client, real-world use cases.
- [16/27] Multi-agent patterns: supervisor, handoff, debate Bài 16 series AI Agents. Khi nào nhiều agent tốt hơn một. 3 pattern: supervisor (1 boss), handoff (chuyền turn), debate (đối đáp). Trade-off compute vs quality.
- [17/27] Agent communication: shared state so với message passing Bài 17 series AI Agents. Hai cách multi-agent giao tiếp: shared state (blackboard) vs message passing (queue/RPC). Pros/cons, code patterns, state consistency.
- [18/27] Specialized agent roles: planner, executor, reviewer Bài 18 series AI Agents. Pattern role-based: planner (plan), executor (run), reviewer (verify). Khi nào worth chia role, prompt template từng role, tradeoff cost vs quality.
- [19/27] LangGraph, CrewAI, AutoGen: framework so sánh Bài 19 series AI Agents. Compare 3 framework multi-agent phổ biến. LangGraph (state graph), CrewAI (role-based), AutoGen (Microsoft event-driven). Khi nào dùng cái nào, khi nào skip framework.
- [20/27] Case study: Anthropic SDK agents và Claude Code agents Bài 20 series AI Agents. Phân tích 2 real-world implementation: Anthropic Agent SDK và Claude Code subagent system. Architecture, control flow, design lessons từ practice.
- [21/27] Eval cho agent: trace, replay, golden set, regression Bài 21 series AI Agents. Eval agent khó hơn eval LLM: nondeterministic, multi-step, có tool. 4 kỹ thuật: trace logging, replay, golden set, regression suite.
- [22/27] Cost và latency: token budget, streaming, prompt caching Bài 22 series AI Agents. Optimize cost (token, model tier) và latency (streaming, caching, parallelism). Concrete numbers từ Claude Sonnet 4.6 và Haiku 4.5.
- [23/27] Failure modes: hallucination, infinite loop, hijacking Bài 23 series AI Agents. Catalog các fail mode thực tế: hallucination, infinite loop, goal hijacking, sandbagging. Detection signals và mitigation strategies.
- [24/27] Security: prompt injection, tool sandboxing, secrets Bài 24 series AI Agents. 3 attack surface: prompt injection (chiếm via input), tool sandboxing (chiếm via output), secrets (chiếm via tool call). Mitigation tactics và least-privilege design.
- [25/27] On-call cho agent: monitoring, alerts, rollback, A/B test Bài 25 series AI Agents (bài cuối). Vận hành agent trong production: metrics, alerts, dashboards, rollout strategy, rollback plan, A/B test framework. Closing the loop.
- [26/27] OpenClaw: open-source agent framework đang dẫn đầu 2026 Bài 26 bonus AI Agents series. Deep-dive OpenClaw, framework agent open-source nổi nhất 2026 (Peter Steinberger, 347K stars). Kiến trúc, agent-loop, multi-model proxy, lessons từ vụ Anthropic third-party ban tháng 4.
- [27/27] Hermes Agent: AI tự học, persistent memory, chạy trên $5 VPS Bài 27 bonus AI Agents series. Deep-dive Hermes Agent từ Nous Research (Feb 2026, 140K+ stars). Self-evolving skills, FTS5 persistent memory, multi-channel (Telegram/Discord/Slack/CLI), self-host trên VPS rẻ. Lessons design self-improving agent.