PromptisePromptise
PlatformSoonEnterprise
DocsGitHub
Talk to usGet started
Promptise - AI Framework LogoPromptise

The full-stack framework for agentic systems. Build with the framework. Run it on the platform. Launch it with our engineers.

pip install promptise

[01] Product

  • Framework
  • Platform (coming soon)
  • Enterprise
  • How it works
  • Contact

[02] Framework

  • The Agent
  • The Interface
  • The Harness

[03] Resources

  • Documentation
  • GitHub
  • Why Promptise
  • Use cases
  • Roadmap
  • Guides
  • Learning Paths
  • Questions

[04] Company

  • About
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Subprocessors

© 2026 Promptise by Manser Ventures. All rights reserved.

hello@promptise.com
← Guides> Agent reasoning patterns

AI Agent Reasoning Patterns in Python: From ReAct to Debate

How AI agent reasoning patterns work, from ReAct to plan-and-execute, reflection, debate and code-action, and how to choose and switch them in Python.

Level
Intermediate
Reading time
15 min
Published
Oct 15, 2026
Last updated
Oct 24, 2026
Tested with
Promptise 1.9.0
By
Promptise Team
  • Agent Reasoning Patterns
  • ReAct
  • Self-Correction and Reflection
Contents · 13 sections↓
  1. 01What are agent reasoning patterns?
  2. 02How do the nine reasoning patterns in Promptise work?
  3. 03What you need
  4. 04How to compare agent reasoning patterns, step by step
  5. 05How does the ReAct pattern work, and when are managed and verify better?
  6. 06How do plan-and-execute patterns work: peoatr and research?
  7. 07How does a reflection agent work: deliberate?
  8. 08How does LLM debate work: proposer, critic and judge?
  9. 09When do autonomous and code-action fit?
  10. 10Which reasoning pattern should you use?
  11. 11What to watch out for
  12. 12Frequently asked questions
  13. 13Where to go next

Agent reasoning patterns are the shapes an AI agent's work can take between a question and an answer: the ReAct loop of think, call a tool, read the result; a plan before acting; a self-check or a reflection before answering; a critic that argues with the first draft; a program instead of a loop. Promptise Foundry ships nine of them behind one argument, agent_pattern. In this guide you'll learn what each pattern does, run them on the same expense question against a real MCP server, and read the replies and the cost of each. By the end you'll know which pattern to try first and what each extra step buys. Every snippet runs on Promptise Foundry 1.9.0 with GPT-5 mini, and every output is what it printed.

[01]

What are agent reasoning patterns?

A reasoning pattern decides which model calls happen, in what order, with what instructions, and when the agent stops. The baseline is ReAct, from the 2022 paper ReAct: Synergizing Reasoning and Acting in Language Models: one model, one loop, tools in between. Every other pattern adds steps around that loop or replaces it:

  • Self-check: the model checks its own work, in the same response or in a separate step.

  • Plan-and-execute: a planning step writes subgoals, the acting step works through them.

  • Reflection: after acting, a step reviews what happened, names mistakes, and decides whether to go on.

  • Debate: one step proposes, another attacks the proposal, a third judges.

  • Code as action: the model writes a program that calls the tools, and the program's output is the answer.

  • Self-directed: the model picks its own next step from a menu.

Each extra step is another model call, more tokens and more waiting. A step is worth it only if it catches mistakes the loop would make on your questions. The pattern's name doesn't tell you that; trying it on your own questions does.


[02]

How do the nine reasoning patterns in Promptise work?

In Promptise Foundry every agent runs on the Reasoning Graph, and build_agent(agent_pattern=...) picks the graph. These are the nine names it accepts (promptise.agent.AGENT_PATTERNS), and what each builds:

agent_pattern

Steps

What it does

react (default)

reason

One node with your tools loops until the model answers, up to max_agent_iterations rounds (25 by default). After 6 tool results it swaps the transcript for a ledger of facts

managed

reason

The same loop with the facts ledger from the first call, with the same round limit

verify

reason

The same loop, told to answer in PLAN, SOLVE, VERIFY sections; 6 rounds at most

code-action

reason

The model writes one Python program that calls the tools, run in a Docker sandbox

peoatr

plan, act, think, reflect, answer

Structured plan, a tool loop, structured analysis and reflection that route back or on, then a separate answer step

research

search, verify, synthesize

A tool loop, a model that checks the findings against the tool results and can send the run back to search (twice at most), then a separate step that writes the answer

autonomous

agent

The model picks reason (a full tool loop), analyze or synthesize at each step, up to 15 steps; synthesize writes the answer

deliberate

think, plan, act, observe, reflect, answer

Think and plan first, a tool loop, then a reflection that can route back to act or plan, and a separate answer step

debate

proposer, critic, judge, answer

A proposer with your tools answers, a critic scores it and can send it back, a judge passes or fails it, and a separate step writes the answer

Every multi-stage pattern returns structured output from the steps that decide where to go next (a plan with a quality score, a critique with a severity, a verdict with pass or fail), so those decisions actually route. Every stage has a budget, and every multi-stage pattern ends with a step whose only job is to write the reply.

The steps behind each of the nine agent_pattern names: react, managed, verify and code-action run one reason step and autonomous one agent step, while research, peoatr, deliberate and debate chain several steps that can send the run back and end with a separate step that only writes the reply.
FigureThe steps each of the nine built-in reasoning patterns runs between a question and an answer

A runtime process takes the same names: ProcessConfig(agent_pattern="research") gives a run started by a cron schedule or a webhook the research graph. An unknown name fails when the config is created.

You can also pass a graph of your own instead of a name. The plan-and-execute guide builds a plan, act, verify, reflect graph node by node; this guide stays with the built-ins.


[03]

What you need

  • Python 3.10 or newer.

  • Promptise Foundry 1.9.0 or newer. The sandbox extra and Docker are needed only for code-action.

  • An API key for a model provider. The examples use openai:gpt-5-mini.

>_Terminal
pip install "promptise[sandbox]>=1.9.0"
export OPENAI_API_KEY="sk-..."

[04]

How to compare agent reasoning patterns, step by step

Step 01

Give the agent an expense policy to apply

A useful comparison needs a question a pattern can get wrong. This MCP server holds one employee's September expense claims and the company's reimbursement rules, as text, the way policies are written. One rule has a trap: meals are capped at $60 per day, and Dana has two meal claims on September 5th.

Pythonexpenses_server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from promptise.mcp.server import MCPServer

server = MCPServer("expenses")

# Sample data: one employee's September expense claims and the policy.
CLAIMS = {
    "EX-101": {"employee": "Dana", "category": "meals", "date": "2026-09-02", "amount": 48.50, "receipt": True},
    "EX-102": {"employee": "Dana", "category": "taxi", "date": "2026-09-02", "amount": 32.00, "receipt": False},
    "EX-103": {"employee": "Dana", "category": "hotel", "date": "2026-09-03", "amount": 412.00, "receipt": True, "nights": 2},
    "EX-104": {"employee": "Dana", "category": "meals", "date": "2026-09-03", "amount": 74.20, "receipt": True},
    "EX-105": {"employee": "Dana", "category": "gift", "date": "2026-09-04", "amount": 55.00, "receipt": True},
    "EX-106": {"employee": "Dana", "category": "taxi", "date": "2026-09-04", "amount": 18.40, "receipt": False},
    "EX-107": {"employee": "Dana", "category": "meals", "date": "2026-09-05", "amount": 59.90, "receipt": True},
    "EX-108": {"employee": "Dana", "category": "taxi", "date": "2026-09-05", "amount": 41.75, "receipt": True},
    "EX-109": {"employee": "Dana", "category": "meals", "date": "2026-09-05", "amount": 14.30, "receipt": True},
}

POLICY = {
    "meals": "Meals are reimbursed up to $60.00 per day. Anything above that is not reimbursed.",
    "taxi": "Taxis are reimbursed in full with a receipt. Without a receipt, at most $25.00 per ride.",
    "hotel": "Hotels are reimbursed up to $180.00 per night.",
    "gift": "Gifts for clients are not reimbursable.",
}


@server.tool()
async def list_claims(employee: str, month: str) -> list[str]:
    """List the IDs of an employee's expense claims for a month, e.g. "2026-09".

    Args:
        employee: The employee's first name.
        month: The month as YYYY-MM.
    """
    return [cid for cid, c in CLAIMS.items() if c["employee"] == employee and c["date"].startswith(month)]


@server.tool()
async def get_claim(claim_id: str) -> dict:
    """Get one expense claim: category, date, amount in USD, receipt, and nights for hotels.

    Args:
        claim_id: A claim ID from list_claims, e.g. "EX-101".
    """
    if claim_id not in CLAIMS:
        raise ValueError(f"No claim {claim_id}")
    return {"id": claim_id, **CLAIMS[claim_id]}


@server.tool()
async def get_policy(category: str) -> str:
    """Get the reimbursement rule for an expense category: meals, taxi, hotel or gift.

    Args:
        category: The expense category.
    """
    if category not in POLICY:
        raise ValueError(f"No policy for {category}")
    return POLICY[category]


if __name__ == "__main__":
    server.run()
Step 02

Compute the right answers in plain Python

Before you judge a pattern, know the answer. Compute it straight from the data, so a reply that only looks right can't fool you:

Pythontruth.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""The right answers, computed straight from the server's data."""
from collections import defaultdict

from expenses_server import CLAIMS

meals_by_day = defaultdict(float)
paid = {}
for cid, c in CLAIMS.items():
    if c["category"] == "meals":
        meals_by_day[c["date"]] += c["amount"]
    elif c["category"] == "taxi":
        paid[cid] = c["amount"] if c["receipt"] else min(c["amount"], 25.00)
    elif c["category"] == "hotel":
        paid[cid] = min(c["amount"], 180.00 * c["nights"])
    elif c["category"] == "gift":
        paid[cid] = 0.0
meals = sum(min(total, 60.00) for total in meals_by_day.values())

print("EX-108:", CLAIMS["EX-108"]["category"], f"${CLAIMS['EX-108']['amount']:.2f}")
print(f"EX-103 reimbursed: ${paid['EX-103']:.2f}")
print(f"September total reimbursed: ${meals + sum(paid.values()):.2f}")
print(f"(capping meals per claim instead of per day gives ${sum(min(c['amount'], 60) for c in CLAIMS.values() if c['category'] == 'meals') + sum(paid.values()):.2f})")
>_Terminal
python truth.py
Output
EX-108: taxi $41.75
EX-103 reimbursed: $360.00
September total reimbursed: $613.65
(capping meals per claim instead of per day gives $627.85)

The last line is the trap. Apply the meal cap to each claim instead of each day, and you get $627.85. That's the mistake to look for in every reply below.

Step 03

Switch the reasoning pattern with one argument

One script runs any pattern. It counts model calls and tokens with a small LangChain callback, which sees every model call whatever the pattern, and prints the path the agent took through its graph:

Pythonusage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from langchain_core.callbacks import BaseCallbackHandler


class Usage(BaseCallbackHandler):
    """Count model calls and tokens for one run."""

    def __init__(self):
        self.calls = self.input_tokens = self.output_tokens = 0

    def on_llm_end(self, response, **kwargs):
        self.calls += 1
        usage = response.generations[0][0].message.usage_metadata or {}
        self.input_tokens += usage.get("input_tokens", 0)
        self.output_tokens += usage.get("output_tokens", 0)

    def __str__(self):
        return f"{self.calls} model calls, {self.input_tokens:,} input + {self.output_tokens:,} output tokens"
Pythonrun_pattern.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import asyncio
import sys
import time

from promptise import build_agent
from promptise.config import StdioServerSpec

from usage import Usage

QUESTION = "How much will Dana be reimbursed in total for her September 2026 expense claims?"


async def main(pattern: str):
    agent = await build_agent(
        model="openai:gpt-5-mini",
        servers={"expenses": StdioServerSpec(command=sys.executable, args=["expenses_server.py"])},
        agent_pattern=pattern,
    )
    try:
        usage = Usage()
        start = time.perf_counter()
        result = await agent.ainvoke(
            {"messages": [{"role": "user", "content": QUESTION}]},
            config={"callbacks": [usage]},
        )
        print(">>>", result["messages"][-1].content)
        print("path:", " -> ".join(agent.last_report.nodes_visited))
        print(f"usage: {usage}, {time.perf_counter() - start:.1f} s")
    finally:
        await agent.shutdown()


asyncio.run(main(sys.argv[1] if len(sys.argv) > 1 else "react"))
>_Terminal
python run_pattern.py react
Output
>>> Dana will be reimbursed a total of $613.65.

Breakdown
- Meals (policy: up to $60.00 per day)
  - 2026-09-02 (EX-101): $48.50 → reimbursed $48.50
  - 2026-09-03 (EX-104): $74.20 → daily cap $60.00 reimbursed
  - 2026-09-05 (EX-107 $59.90 + EX-109 $14.30 = $74.20) → daily cap $60.00 reimbursed
  - Meals total reimbursed: $168.50

- Taxis (policy: full with receipt; without receipt at most $25.00 per ride)
  - EX-102 (09-02, no receipt, $32.00) → reimbursed $25.00
  - EX-106 (09-04, no receipt, $18.40) → reimbursed $18.40
  - EX-108 (09-05, receipt, $41.75) → reimbursed $41.75
  - Taxis total reimbursed: $85.15

- Hotel (policy: up to $180.00 per night)
  - EX-103 (2 nights, $412.00) → cap = 2 × $180 = $360.00 reimbursed

- Gift (EX-105, $55.00) — gifts are not reimbursable → $0.00

Total reimbursed = $168.50 + $85.15 + $360.00 = $613.65.
path: reason -> reason -> reason -> reason
usage: 4 model calls, 2,961 input + 2,178 output tokens, 27.4 s

The path shows the ReAct loop: the same reason node four times, three rounds of tool calls and one round that answered. This reply is right, with the meal cap applied per day. Run the same command again, and now and then you get this:

Output
>>> I calculated reimbursements using the company rules (meals: up to $60/day; taxis: full with receipt, otherwise max $25/ride; hotels: up to $180/night; gifts: not reimbursable).
…
- EX-107 (meals, $59.90) → $59.90
- EX-108 (taxi, $41.75, receipt) → $41.75
- EX-109 (meals, $14.30) → $14.30

Total reimbursement = $627.85.
path: reason -> reason -> reason -> reason
usage: 4 model calls, 2,961 input + 1,390 output tokens, 23.8 s

Same path, same tool calls, and the trap: EX-107 and EX-109 are both meals on September 5th, together $74.20, and this run capped each claim at $60 instead of the day. It even quotes the rule as "up to $60/day" and then doesn't apply it. Nothing in the reply tells you which run you got. That's why you compare against truth.py, and why you run each question more than once before you trust a pattern.

Step 04

Run the same question through every pattern

Change the argument to send the same question through a different graph:

>_Terminal
for pattern in react managed verify peoatr research autonomous deliberate debate; do
  python run_pattern.py "$pattern"
done

Read three things in each run: the answer against truth.py, the path, and the usage line. The sections below go through the patterns family by family, with real replies.


[05]

How does the ReAct pattern work, and when are managed and verify better?

The ReAct agent is the default for good reasons. On lookups, single rules and gather-then-add-up questions it's usually right, and it's the fastest and cheapest pattern: four model calls in the run above. Its weakness is the one every single-loop agent has: the node that gathered the data also does the reasoning, in the same context, in one pass. When it misreads a rule, nothing gets a second look.

The two variants change the prompt, not the shape:

  • managed replaces the tool transcript with a deduplicated ledger of facts from the first call, so long loops stay small. It costs about the same as ReAct. The context engineering guide covers that idea in depth.

  • verify makes the model write PLAN, SOLVE and VERIFY sections in its answer, for a little more output. It has a limit of its own: the node gets 6 rounds, and a model that fetches one item per round can run out and raise GraphIterationLimitError before it answers.

A self-check written by the same model in the same response checks the arithmetic it did, not the reading of the rule it chose. Here is a verify run that fell into the trap, trimmed:

>_Terminal
python run_pattern.py verify
Output
>>> PLAN
…
- EX-107 (meals) $59.90 → under $60 → reimbursed $59.90
- EX-108 (taxi) $41.75, receipt → reimbursed in full → $41.75
- EX-109 (meals) $14.30 → reimbursed $14.30
…
VERIFY
Grouped check:
- Meals total = 48.50 + 60.00 + 59.90 + 14.30 = 182.70
- Taxi total = 25.00 + 18.40 + 41.75 = 85.15
- Hotel total = 360.00
- Gift total = 0.00
Sum = 182.70 + 85.15 + 360.00 + 0.00 = 627.85 — matches the earlier sum.

FINAL ANSWER
Dana will be reimbursed a total of $627.85 for her September 2026 expense claims.
path: reason -> reason -> reason -> reason
usage: 4 model calls, 3,335 input + 1,820 output tokens, 22.8 s

The VERIFY section added up the same wrong numbers a second way and found they matched. It checked the sum, not the rule. If the loop misreads rules on your questions, a separate step is the better fix.


[06]

How do plan-and-execute patterns work: peoatr and research?

peoatr is the full plan-and-execute pattern: a structured plan with a quality score, a tool loop for the active subgoal, a structured think step that decides between another tool call and reflection, a reflect step that routes to answer, replan or continue, and an answer step that writes the reply from what was gathered. It suits multi-step work where order matters, and it costs several times ReAct's model calls. That is the ReAct vs plan-and-execute trade in short: ReAct decides one step at a time, while plan-and-execute writes the plan first and pays for the extra calls.

research is the lightest of the multi-stage patterns. It's a tool loop, then a verify step, then a synthesize step that writes the answer:

>_Terminal
python run_pattern.py research
Output
>>> Total reimbursed: $613.65

Breakdown (sources: claim records EX-101…EX-109 and company policies returned by the policy API):

- Meals (policy: up to $60.00/day)
  - 2026-09-02 EX-101: $48.50 → reimbursed $48.50
  - 2026-09-03 EX-104: $74.20 → reimbursed $60.00 (capped)
  - 2026-09-05 EX-107 + EX-109: $59.90 + $14.30 = $74.20 → reimbursed $60.00 (capped)
  - Meals total reimbursed = $48.50 + $60.00 + $60.00 = $168.50
…
Grand total = Meals $168.50 + Taxis $85.15 + Hotel $360.00 + Gifts $0.00 = $613.65

If you’d like, I can export a one-line journal entry or a CSV with the per-claim reimbursed amounts (including claim IDs).
path: search -> search -> search -> verify -> synthesize
usage: 5 model calls, 5,364 input + 3,693 output tokens, 41.0 s

The verify step is a model call that compares the findings with the tool results and returns a verdict. A failed verdict sends the run back to search with the issues listed, twice at most. Here it passed, because the findings were already right, so the verify call was insurance paid on this run. On questions the loop gets right, that's the usual case: the check costs a call every time and changes the path only when it finds something.

The synthesize step is where the answer gets its shape: grouped by category, with the per-day meal cap spelled out. Separating "gather" from "write the answer" is what makes research a good first step up from ReAct when the loop misapplies rules. The plan-and-execute guide builds a graph like this by hand, with a check written in code that costs no model call.


[07]

How does a reflection agent work: deliberate?

A reflection agent reviews its own work, names its mistakes and decides whether to go on. deliberate chains think, plan, act, observe and reflect, and ends with an answer step. Here's a run, trimmed in the middle:

>_Terminal
python run_pattern.py deliberate
Output
>>> Dana’s total reimbursable amount for September 2026 = $613.65 (USD).
…
- EX-107 + EX-109 (meals, 9/05): combined $59.90 + $14.30 = $74.20 → capped at $60.00.
  - I applied the daily $60 cap to the day total and prorated the $60 across the two claims in proportion to their amounts:
    - EX-107 reimb = 60 * (59.90 / 74.20) = $48.44
    - EX-109 reimb = 60 * (14.30 / 74.20) = $11.56
    (rounded to cents; the day still totals $60.00)
…
Notes / assumptions
- All amounts are USD (as provided).
- I applied the $60/day meal cap to each day’s meal total and prorated that cap across same-day meal claims proportionally; rounding was to nearest cent. If you prefer a different allocation method (e.g., first-claim-first-paid) or a specific cents-rounding rule, I can recompute and show that alternative.
path: think -> plan -> act -> act -> act -> act -> observe -> reflect -> answer
usage: 9 model calls, 15,414 input + 9,850 output tokens, 116.5 s

A complete answer, with the meal cap applied per day, and a path that shows every stage: think, plan, four act rounds, observe, reflect, answer. The plan and reflect steps return structured output, so the reflection can send the agent back to act or to a new plan. Here it didn't need to.

The reply also shows what a planning step adds that nobody asked for: a per-claim proration of the meal cap that isn't in the policy. A planner decides what a complete answer looks like, and sometimes it decides more than you wanted. deliberate is the slowest pattern here and used about five times ReAct's tokens in these runs. Keep it for careful, slow work where cost doesn't matter.

If you want a reflection that carries over between runs rather than within one, the self-improving agent guide covers lessons an agent keeps.


[08]

How does LLM debate work: proposer, critic and judge?

Debate is self-critique with separate roles. A proposer answers with the agent's tools, a critic scores the answer and sends it back when the severity is above 0.3, and a judge passes or fails it (a fail also sends it back). An answer step then writes the reply. The critic and the judge get three rounds each. Here is debate on the same question, trimmed:

>_Terminal
python run_pattern.py debate
Output
>>> Short answer: Dana will be reimbursed a total of USD 613.65.
…
Meal-cap grouping and application (explicit method)
- Assumption used: group meal claims by calendar date and sum same-day meal amounts, then apply the policy daily cap of $60.00.
…
Assumptions and recommended checks
- Assumed calendar-date grouping in local time for applying the daily meal cap and no special travel-day/per-diem exceptions. If your finance policy treats travel days (check-in/check-out) differently or uses timezone boundaries, the meal totals and hotel-night treatment could change.
- Assumed the hotel claim’s nights = 2 (as shown in the claim data). Please confirm the hotel-night count agrees with your records and that there are no company exceptions or per-diem overrides.
…
path: proposer -> proposer -> proposer -> proposer -> critic -> judge -> answer
usage: 7 model calls, 8,789 input + 6,596 output tokens, 76.1 s

The proposer fetched the claims and policies (four proposer rounds in the path), the critic and judge let the draft through, and the answer step wrote the reply. The math is right. The reply is also full of assumptions and checks for the reader, because a critic pushes the answer toward covering every objection. Debate can even offer two totals and ask the reader to choose, when a rule leaves room for doubt. Whether that's diligence or noise depends on your reader.

On questions the plain loop already gets right, the argument has little to find. Debate pays when a critic can find something, which takes a task with room for disagreement or a critic with a check of its own. If you want separate agents with their own tools rather than roles inside one graph, see the multi-agent system guide.


[09]

When do autonomous and code-action fit?

autonomous lets the model choose each step from a menu: reason (with tools), analyze or synthesize. A chosen reason step runs its whole tool loop, the routing exchange stays out of the conversation, and when the agent decides it's done, synthesize writes the answer if it hasn't already. Every path is one node, agent, because the choices happen inside it. Bring your own node pool when you want the model to choose between steps of your own.

code-action has the model write one Python program that calls the tools in a Docker sandbox, and the program's printed result is the answer. It shines on large, structured data, where one program replaces dozens of tool calls and no tool results crowd the context. It's a poor fit for rules written as sentences. The program has to decide how to turn "up to $60.00 per day" into a number before it has read the policy, so it guesses, for example with a regular expression for "up to $X". A wrong guess prints a wrong total as confidently as a right one, and raises no error. The code-action agent guide shows the pattern on structured order data, and the code execution sandbox guide covers the container.


[10]

Which reasoning pattern should you use?

If the task is

Try

Why

A lookup, a single rule, or gather and add up

react (the default)

Fastest and cheapest; check it against known answers, because it can misread a rule now and then

Long tool loops that re-fetch facts

managed

Same loop with a bounded facts ledger

Rules the loop keeps misapplying

research

The lightest pattern with a separate answer step, and a check that can send it back

Multi-step work where order matters

peoatr

Plans, reflects and routes, for several times the model calls

Exact computation over large structured data

code-action

One program, no tool results in the context; needs Docker, and guesses on rules written as sentences

A check you can write as code

A custom graph with a code check

Free, fast, and it can't be talked into passing

An answer that should survive a critic

debate

Expect longer, more hedged replies

Open-ended work where the model picks the steps

autonomous

Bring your own node pool for your own steps

Careful, slow work where cost doesn't matter

deliberate

The most thorough reply, and the most tokens

Start with ReAct, run your own questions through it several times, and move to another pattern only when you see the mistake that pattern's extra step would catch. The prompt testing guide shows how to turn questions like these into a test you can rerun whenever you change the pattern or the model.


[11]

What to watch out for

  • One run proves little. A pattern that answers right once can answer wrong on the next run, and the wrong reply looks the same. Run each question several times, and compare with an answer you computed yourself.

  • The checks are paid for on every run. Research's verify step, debate's critic and judge, and the reflection steps are a model call each, whether they find something or not.

  • A right number isn't always a clean answer. Multi-stage patterns write long replies, planners add what nobody asked for, and a critic can push the answer toward hedging. Read the replies, not only a score.

  • Every stage has a budget. verify gets 6 tool rounds, and react and managed get the run's max_agent_iterations. The multi-stage patterns cap each stage (for example max_act_steps, max_search_steps, max_rounds) and hand over to the answer step when one is used up, so a long task can end with a partial answer rather than an error.

  • And the whole run has one. build_agent(max_agent_iterations=25) caps the node executions of a run, and a limit of N allows exactly N. A run that reaches the limit raises GraphIterationLimitError. Raise it for patterns with many stages and long tool loops.

  • Code-action needs Docker and the right kind of task. On rules written as prose it guesses, and its wrong answers look like right ones.


[12]

Frequently asked questions

What are agent reasoning patterns?

The control flow of an AI agent: which model calls happen, in what order, with which instructions and tools, and when the agent stops. ReAct, plan-and-execute, reflection, self-critique, debate and code-as-action are the common ones.

What is the ReAct pattern?

Reason plus act: the model decides on a tool call, sees the result, and repeats until it can answer. It's the default in most agent frameworks, including Promptise, and on tool tasks like the one in this guide it's the fastest and cheapest pattern that answers well.

Does a reflection step make an agent more accurate?

Only when it finds something to fix. A reflection step is a model call on every run, and on questions the loop already answers right it rarely changes the path. Test it on the questions your loop actually gets wrong, and keep it if it catches those mistakes.

Does multi-agent debate improve LLM accuracy?

Sometimes, when the critic can find real problems. On a question the plain loop already gets right, a debate costs more model calls and tokens and tends to produce longer, more hedged replies. It helps most when the task leaves room for disagreement or the critic has a check of its own.

Which agent reasoning pattern should I use?

Start with the default ReAct loop and test it on your own questions, several runs each. If it misapplies rules on gather-then-compute questions, add a separate answer step, and research is the lightest way to do that. If it computes over large structured data, try code-action. Add planning, reflection or debate when a run shows the mistake they'd catch, or when the cost doesn't matter.


[13]

Where to go next

  • Reasoning Patterns and Prebuilt Patterns: every agent_pattern and its factory function.

  • Reasoning Graph and Nodes: the engine and every node type, including the reasoning nodes used above.

  • Building Custom Reasoning: graph shapes from pipelines to parallel research.

  • Code-Action Agents in Python: the code-action pattern over an MCP server.

  • Plan-and-Execute Agents in Python: build plan, act, verify and reflect by hand, with a check written in code.

  • ReAct Agent Pattern: the default loop explained step by step.

  • Reasoning Effort for AI Agents: when a model's own reasoning setting helps and when it hurts.

  • Context Engineering for AI Agents: what the ledger behind managed saves on long runs.

  • Best LLM for AI Agents: the other half of the accuracy question.

Contents

  1. 01What are agent reasoning patterns?
  2. 02How do the nine reasoning patterns in Promptise work?
  3. 03What you need
  4. 04How to compare agent reasoning patterns, step by step
  5. 05How does the ReAct pattern work, and when are managed and verify better?
  6. 06How do plan-and-execute patterns work: peoatr and research?
  7. 07How does a reflection agent work: deliberate?
  8. 08How does LLM debate work: proposer, critic and judge?
  9. 09When do autonomous and code-action fit?
  10. 10Which reasoning pattern should you use?
  11. 11What to watch out for
  12. 12Frequently asked questions
  13. 13Where to go next

Learning paths

Want more structure? Paths put guides in order, like a short course.

See the paths →

> Agent reasoning patterns

Related guides

All guides in this topic →
  • // 01Intermediate · 8 minReAct Agent From Scratch in Python: The Reason-Act LoopBuild a ReAct agent from scratch in Python: the Thought, Action, Observation loop, a 60-line controller with a real trace, and how it maps to tool calling.
  • // 02Advanced · 15 minPlan-and-Execute Agents in Python: Beyond the ReAct LoopBuild a plan, act, verify, reflect agent in Python with the Promptise Reasoning Graph, then compare it with ReAct on one task: accuracy, calls, tokens.
  • // 03Advanced · 15 minCode-Action Agents in Python: One Program vs 37 Tool CallsBuild a code-action agent in Python over an MCP server: the model writes one program that calls your tools in a Docker sandbox, within a budget you set.
  • // 04Intermediate · 22 minSelf-Improving AI Agent: Learn From Tool Failures in PythonBuild a self-improving AI agent in Python that learns from failed tool calls without fine-tuning, and keep bad lessons, leaks and poisoned rules out.
  • // 05Advanced · 16 minSelf-Modifying AI Agent in Python: Open Mode & LimitsBuild a self-modifying AI agent in Python with Promptise open mode: meta-tools, hot reload, the guardrails that bound it, and the limits to plan for.
  • // 06Beginner · 14 minReAct Agent Pattern: Tool Execution Loop Explained SimplyThe ReAct agent pattern explained simply: what an agent does after it calls a tool, a loop written by hand, the same agent in Promptise, where it breaks.

Keep going.

Browse every guide by topic and level, or follow a learning path that puts them in order.

All guidesLearning paths