The chapter expands the prompt engineer’s toolkit beyond basic structure, templates, examples, and aggregation by introducing higher-level patterns that shape how a model reasons and interacts. The main idea is that some problems are better solved by making reasoning explicit, generating prompts from descriptions, or looping through evidence and action rather than relying on a single direct request.
Chain of thought is presented as a way to expose intermediate reasoning so multistep decisions become auditable and easier to verify, especially when using standard models or when the reasoning logic is specialized to a domain. The chapter shows that direct prompts can produce correct answers without revealing how they were reached, while zero-shot and few-shot variants of chain of thought make the logic visible and, when necessary, teach domain-specific decision rules through a worked example. It also notes that if a reasoning-capable model is already doing internal reasoning, explicit chain-of-thought instructions usually add cost without benefit.
Meta prompting uses a prompt to generate a reusable prompt template, which is useful when a team repeatedly solves the same kind of task and can describe the desired structure clearly. ReAct goes further by combining reasoning with action and observation, making it suitable for investigations where new information must be gathered step by step before drawing a conclusion. Across all three patterns, the chapter emphasizes judgment: use the more advanced pattern when it materially improves reasoning, traceability, or information gathering, and prefer simpler prompting when the task is straightforward or the overhead is not justified.
Advanced pattern selection: comparison of CoT, meta prompting, and ReAct, showing how each pattern differs by reasoning visibility, prompt design requirements, and dependence on iterative interaction with external systems
ReAct loop. The model reasons from current evidence, proposes one action to resolve an information gap, receives the observation as new context, then reasons again. The loop repeats until a conclusion is supported by sufficient evidence.
Summary
CoT makes intermediate reasoning steps explicit and auditable. Use it on nonreasoning models or when the reasoning pattern itself is domain-specific and outside the model’s training distribution.
Meta prompting uses a prompt to design a prompt template. Applying the structural elements, linguistic elements, and prompt patterns framework as the specification language produces structurally sound templates in one pass.
ReAct structures agentic workflows as thought-action-observation loops, giving a model a principled way to incorporate real-world observations before committing to a conclusion.
In pattern selection, use CoT when multistep reasoning must be auditable, meta prompting when prompt design is itself the recurring task, and ReAct when a diagnosis or decision requires iterating on information that cannot all be provided up front.
FAQ
What is the main purpose of the advanced prompt patterns in Chapter 9?They operate at a higher level of abstraction than basic prompt structure or templates: they change how reasoning or generation is organized, not just what the model says.What is chain of thought (CoT) prompting?CoT prompting asks the model to make intermediate reasoning steps explicit before giving a final answer, which improves multistep reasoning and makes the logic auditable.When should I use explicit CoT prompting instead of a reasoning model?Use explicit CoT when you are using a nonreasoning model, or when the reasoning pattern is domain-specific and needs to be demonstrated with examples. If the model already supports internal reasoning mode, explicit CoT usually adds token cost without benefit.Why is few-shot CoT useful for domain-specific tasks?A few-shot CoT example can teach both the domain rules and the reasoning pattern together, especially when the decision criteria are too specific to state fully in instructions alone.What problem does meta prompting solve?Meta prompting uses a prompt to generate a prompt template, helping teams quickly create reusable prompts for recurring tasks without hand-designing every template.What makes a good meta prompt?A good meta prompt is precise about the target template, includes the needed structural elements, uses clear parameter names, and enforces any required output structure or constraints.When is meta prompting a better choice than writing the prompt directly?Use meta prompting when the task is recurring, the prompt design problem is stable, and the requirements are clear enough to describe precisely. For one-off or changing tasks, writing the prompt directly is simpler.What is ReAct?ReAct stands for reasoning and acting. It structures agent workflows as a loop of thought, action, and observation, allowing the model to incorporate new evidence before concluding.When should ReAct be used instead of CoT?Use ReAct when the model needs real-world information that cannot be provided all at once, or when the next investigation step depends on what the previous step reveals. If all relevant information is available up front, CoT is usually enough.How do I choose between CoT, meta prompting, and ReAct?Choose CoT for auditable multistep reasoning, meta prompting for generating reusable templates, and ReAct for iterative investigations that depend on external observations. If the task is simple, a direct prompt may be the best choice.
pro $24.99 per month
access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!