Chain-of-thought prompting asks a language model to work through a problem in intermediate steps rather than give only a final answer. It can help an agent reason about possible actions and their outcomes; planning builds on this by ordering actions to reach a goal. section 10.2 section 10.2.2
A simple zero-shot approach needs no worked examples: include “Let’s think step by step” in the prompt, followed by the problem. You can also ask for a final answer in a single statement. Example-based chain-of-thought prompts require more effort to prepare for a particular class of problem; the simpler zero-shot approach is more general but may be less effective. section 10.2.2
Listing 10.11 cot.jinja2
system:
You are an expert in solving time travel problems.
You are given a time travel problem and you have to solve it.
Let's think step by step. #1
Please finalize your answer in a single statement. #2
user:
{{statement}} #3
This prompt template combines the step-by-step instruction, a request for a final statement, and a placeholder for the problem. section 10.2.2
Check a time-travel answer
Give the model a time-travel problem and ask it to work through the jumps and elapsed days step by step. In a test flow, send the problem to the reasoning prompt, then pass its predicted answer, the problem, and an expected answer to a separate evaluation prompt for scoring. A detailed explanation is not proof of correctness: one model broke down the problem but still answered incorrectly. When the correct answer is known, ask the model to review its mistake and suggest feedback for similar problems. section 10.2.2 section 11.4
Reasoning can support task planning and evaluation, but it also adds response-time overhead. For a real-time assistant or a well-defined workflow, less reasoning may be preferable; for a complex task, breaking the work into steps may be useful. section 1.2 section 11.5.2




















