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).
ReAct (Reason + Act) — the agent interleaves Thought → Action → Observation after every step. Next step is decided from the latest observation. Good for reactive tasks that depend on each step's result.
Plan-and-Execute (BabyAGI style) — split into 2 LLMs:
1. Planner: reads the goal → generates the full plan (task list) upfront.
2. Executor: executes each step per the plan; can call tools or use a smaller LLM.
3. (optional) Replanner: after each step, checks whether the plan still holds and adjusts.
Example: goal "Write a report on Vietnam's EV market".
- ReAct: Thought "need to search VN EV" → search → Observation → Thought "need VinFast data" → Action → ... (can drift).
- Plan-and-Execute: Plan ["1. Research VN EV market size", "2. Analyze VinFast share", "3. Compare Tesla/BYD entry", "4. Outline report", "5. Write sections"] → execute step by step.
Comparison:
| ReAct | Plan-and-Execute | |
|---|---|---|
| Structure | Low | High |
| Cost | Moderate | Higher (planner uses strong model) |
| Speed | Sequential, slow | Can parallelize execution |
| Recovery | Good (adapts on observation) | Weaker (needs replan) |
| Focus drift | Easy to drift | Plan keeps it anchored |
| Complex multi-step | Weak | Strong |
| Reactive/exploratory | Strong | Weak |
Use Plan-and-Execute when: ≥5 predictable steps, progress measurement matters, plan needs auditing, sub-steps are parallelizable (research agents, long-form writing, code migration).
Use ReAct when: ≤5 unpredictable steps, heavy adaptation to results (debug, tool-assisted Q&A).
Hybrid in practice (best of both):
- Outer layer uses Plan-and-Execute for the macro plan.
- Each step uses ReAct for micro-decisions.
- e.g. OpenAI Deep Research, Claude Research, Devin.
Frameworks: LangGraph (state machine, any pattern), CrewAI (role-based, lean toward plan-execute), AutoGen (multi-agent), LlamaIndex Agent (ReAct default).