Mastering AI Agent Paradigms: ReAct, Plan‑and‑Execute, Reflection & Multi‑Agent Workflows

This guide explains the core engineering paradigms behind AI agents—including ReAct, Plan‑and‑Execute, Reflection, Multi‑Agent systems, A2A communication, and Agentic Workflows—detailing their concepts, advantages, implementation components, and a concrete troubleshooting example with step‑by‑step code snippets.

Java Tech Enthusiast
Java Tech Enthusiast
Java Tech Enthusiast
Mastering AI Agent Paradigms: ReAct, Plan‑and‑Execute, Reflection & Multi‑Agent Workflows

ReAct Paradigm

ReAct (Reasoning + Acting) combines chain‑of‑thought reasoning with external tool calls. Each iteration consists of three steps:

Reasoning : the LLM generates a thought based on the current history and task goal.

Acting : the LLM invokes a tool or API (e.g., query_monitor, send_email).

Observation : the environment returns the tool’s result, which is appended to the history for the next reasoning step.

Advantages : reduces hallucinations, improves success on complex tasks, provides a transparent execution trace. Limitations : each loop adds latency and the overall performance depends on the reliability of the integrated tools.

ReAct Example – Diagnosing a Slow Service

The following illustrates a realistic incident where an AI agent must investigate a slowdown in the user-service API and notify its owner.

Thought : Retrieve this morning’s monitoring data for user-service.

query_monitor(service="user-service", time="morning")

Observation : CPU spiked to 98 % and many slow‑SQL alerts appeared.

Thought : Because of slow SQL, query the slow‑SQL logs.

query_slow_sql(service="user-service", time="09:00-09:30")

Observation : The query SELECT * FROM users WHERE age > 20 ORDER BY created_at DESC performed a full table scan.

Thought : Identify the service owner to send a report. query_service_owner(service="user-service") Observation : Owner is "王建国" (email [email protected]).

Thought : Compose and send the diagnostic email.

send_email(to="[email protected]", subject="user-service 故障排查", body="发现由于缺少索引导致慢查询…")

Observation : Email sent successfully.

Thought : Task completed; return the final answer to the user.

If a static plan were used instead of ReAct, the agent would follow a fixed sequence and fail when the root cause differs from the plan.

Implementing ReAct

History : a unified log of past thoughts, actions, and observations that provides memory for the LLM.

Real‑time Environment Input : signals such as alerts, user feedback, or other external variables.

LLM Reasoning Module : generates thoughts and decides actions based on the history and real‑time inputs.

Tools & Skills : atomic tool calls (e.g., query_monitor) and higher‑level skills that compose multiple tools into a reusable capability (e.g., a diagnose_service_performance skill).

Feedback Observation : captures tool results and appends them to the history for the next iteration.

A typical round‑by‑round prompt looks like:

已知:当前历史上下文:{历史上下文}
实时环境输入:{实时环境输入}
用户目标:"排查 user-service 变慢原因并通知负责人"
请做出下一步的决策,你必须最少使用一个工具来实现该决策。

Plan‑and‑Execute Paradigm

Proposed by LangChain in 2023, this paradigm separates planning from execution. The LLM first produces a complete step‑by‑step plan, then an executor carries out each step sequentially.

Pros : clear roadmap, avoids the “lost in loop” problem of ReAct for long‑running projects.

Cons : static workflow; any change in the environment may require replanning, reducing efficiency.

Reflection Paradigm

Reflection adds self‑correction to an agent. Three main implementations are:

Reflexion : after a failure, the agent records a natural‑language reflection in a memory buffer for future attempts.

Self‑Refine : the agent critiques its own output and iteratively improves it, typically boosting quality by ~20 %.

CRITIC : external tools (search, code execution) verify the output, and the agent revises based on factual feedback.

Reflection is usually layered on top of ReAct or Plan‑and‑Execute, enhancing robustness at the cost of extra LLM calls.

Multi‑Agent Systems

Multiple agents collaborate to solve a complex task, each specializing in a role.

Orchestrator‑Subagent : a central orchestrator creates a global plan and distributes subtasks to specialized sub‑agents.

Peer‑to‑Peer : agents converse as equals, useful for debate‑style verification (e.g., code review).

Advantages: parallelism, specialization, fault isolation. Drawbacks: communication overhead, coordination complexity, higher cost due to multiple LLM calls.

A2A (Agent‑to‑Agent) Communication Protocol

When scaling to multi‑agent teams, natural‑language chat becomes inefficient and error‑prone. A2A defines a structured, schema‑driven contract (typically JSON) that agents exchange, analogous to microservice APIs. A minimal payload includes fields such as TaskID, Dependencies, and AcceptanceCriteria. This deterministic format reduces token consumption and eliminates parsing ambiguities.

Agentic Workflows

Coined by Andrew Ng, Agentic Workflows integrate the four patterns above into a production‑grade pipeline:

Reflection – self‑check.

Tool Use – ReAct‑style acting.

Planning – Plan‑and‑Execute style global plan.

Multi‑agent Collaboration – orchestrated teamwork.

The idea is to treat AI agents like backend services, chaining reasoning, memory, reflection, and collaboration into an industrial‑strength workflow.

ReActAI AgentMulti-agentA2Aagentic workflowsPlan-and-Execute
Java Tech Enthusiast
Written by

Java Tech Enthusiast

Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.