liveBook · Manning

Multi-step reasoning

As explained in AI Agents in Action

Reasoning is the process of deriving conclusions, plans, or solutions by relating information through intermediate steps.

Reasoning derives a solution by thinking through a problem and relating actions to their possible outcomes. In agent systems, it annotates workflows by helping an agent consider problems and evaluate solutions. Planning extends reasoning by ordering actions and selecting parameters to achieve a goal. section 1.2 section 10.2

Reasoning can appear in several forms and application settings:

  • Single-path reasoning follows one approach; sequential reasoning works through task steps; multipath reasoning explores several strategies. section 1.2
  • Prompt engineering can elicit reasoning behavior from a chat-completion LLM, even though the model was not originally designed to reason or plan. section 10.0 section 10.2
  • Reasoning improves complex task handling but adds a thinking cycle and can increase response time, so simpler workflows may use little or none. section 11.5.2

Eliciting step-by-step reasoning

A zero-shot prompt can ask an LLM to solve a difficult time-travel problem and include the phrase “Let’s think step by step.” A prompt-flow configuration sends the problem to one LLM prompt, then sends the predicted answer and expected answer to an evaluation prompt. The resulting score helps assess the solution. section 10.2.2

Reasoning still needs feedback

In the time-travel problem, Alex spends six days in the past, jumps fifty years forward for twenty days, and returns before the battle ends. An o1-preview response breaks the timeline down clearly but still reaches the wrong answer. Supplying the correct answer lets a follow-up prompt generate feedback about relative time frames, relevant periods, continuity, careful reading, and timeline visualization. section 11.4

Listing 10.10 zero-shot-CoT-prompting flow
   Inputs:
        statement  : the statement problem to be solved
        expected : the expected solution to the problem

   LLM: cot (the prompt used to solve the problem)
        inputs: statement
        outputs: the predicted answer given the problem statement

   LLM: evaluate_answer (the prompt used to evaluate the solution)
        inputs:
               statement: -> input.statement
               expected: -> input.expected
               predicted: -> output.cot

         outputs: a score of how well the problem was answered


    Outputs:
        statement: -> input.statement
        expected: -> input.expected
        predicted: -> output.cot
        evaluation_score: output.evaluate_answer

    ### Example Output
   {
       "evaluation_score": "1",     #1
       "expected": "After the final jump, 
           Max finds himself in the year 1980 and 
   he is 75 years old.",     #2
       "predicted": "Max starts in… 
           Therefore, after the final jump, 
           Max is 75 years old and in the year 1980.",     #3
       "statement": "In a complex time travel …"     #4
   }

Inspect the zero-shot chain-of-thought flow, including its inputs, prediction step, evaluation prompt, and output score. section 10.2.2

How AI Agents in Action covers it

How deep it goes
Defines reasoning, distinguishes it from planning, and demonstrates prompting and feedback, but does not detail model internals.
Examples
Demonstrates zero-shot prompts, time-travel puzzles, prompt-flow evaluations, logical puzzles, riddles, and hypothetical experiments.
What it assumes
Assumes familiarity with LLM prompting and agent components while introducing reasoning, planning, evaluation, and feedback distinctions.
What you can do after
Apply reasoning prompts in VS Code prompt flow and evaluate predictions with follow-up prompts and feedback.
How it connects
Connects reasoning with planning, evaluation, feedback, prompt engineering, memory, and tool use.

Also explained in

Compare how 10 books explain multi-step reasoning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action. The section links point to the parts of the book it draws on.