ReAct (Reason + Act) — agent xen kẽ Thought → Action → Observation sau mỗi bước. Quyết định bước tiếp theo dựa trên observation gần nhất. Phù hợp task reactive, phụ thuộc kết quả từng bước.
Plan-and-Execute (BabyAGI style) — agent chia thành 2 LLM:
1. Planner: đọc goal → sinh toàn bộ plan từng bước (list tasks) upfront.
2. Executor: thực thi từng step theo plan; có thể gọi tool hoặc dùng LLM nhỏ hơn.
3. (tuỳ chọn) Replanner: sau mỗi step, kiểm tra plan còn đúng không; adjust nếu cần.
Ví dụ: goal "Viết báo cáo về thị trường EV Việt Nam".
- ReAct: Thought "tôi cần search EV VN" → Action search → Observation → Thought "cần tra VinFast" → Action → ... (có thể lạc hướng).
- Plan-and-Execute: Plan ["1. Research EV market size VN", "2. Analyze VinFast share", "3. Compare Tesla/BYD entry", "4. Outline report", "5. Write sections"] → execute từng step.
So sánh:
| ReAct | Plan-and-Execute | |
|---|---|---|
| Structured | Low | High |
| Cost | Moderate | Higher (planner dùng model mạnh) |
| Speed | Sequential, slow | Có thể parallel execute |
| Recover | Tốt (adapt theo observation) | Kém hơn (cần replan) |
| Lost focus | Dễ lạc | Khó lạc vì có plan rõ |
| Complex multi-step | Kém | Tốt |
| Reactive/exploratory | Tốt | Kém |
Khi dùng Plan-and-Execute: task ≥5 bước có thể dự đoán, đo lường progress quan trọng, cần audit plan, có thể parallelize sub-steps (research agent, long-form writing, code migration).
Khi dùng ReAct: task ≤5 bước không lường trước được, cần adapt mạnh theo kết quả (debug, Q&A với tool search).
Hybrid thực tế (best of both):
- Dùng Plan-and-Execute ở layer ngoài cho macro plan.
- Mỗi step dùng ReAct cho micro-decisions trong khi execute.
- Ví dụ: OpenAI Deep Research, Claude Research, Devin dùng pattern này.
Framework: LangGraph (state machine, pattern nào cũng code được), CrewAI (role-based, lean về plan-execute), AutoGen (multi-agent), LlamaIndex Agent (ReAct mặc định).