liveBook · Manning

Chain-of-thought prompting

As explained in AI Agents for Offensive Security

A prompting and reasoning technique that elicits intermediate steps to connect a problem statement with a conclusion or action.

Chain-of-thought (CoT) prompting asks an AI model to break a complex problem into smaller intermediate steps before reaching a conclusion or selecting an action. This decomposition is presented as a way to improve accuracy without additional model training, and as a foundation for reasoning within agent workflows. section 2.3.1

Arithmetic decomposition

For a cake with eight slices, give away two slices twice, then receive one back: 8 − 2 = 6, 6 − 2 = 4, and 4 + 1 = 5. The intermediate operations make the final answer traceable rather than a detached generated number. section 2.3.1

In a ReAct-style agent, CoT belongs in planning: it reasons from objectives, the agent’s current knowledge, defined boundaries, hypotheses, and operational or security posture to choose a reconnaissance strategy. Planning should lead to explicit actions, followed by observation and durable recording rather than an untracked stream of model output. section 4.2.2 section 2.3.1

Use CoT as a controlled planning stage in an agent pipeline:

  • Supply the objective, components under evaluation, authorized boundaries, relevant hypotheses, and security posture. section 4.2.2
  • Translate the plan into specific, bounded tool actions rather than treating reasoning as action itself. section 2.3.1 section 4.2.2
  • Interpret returned data, then save outputs and context in artifacts so later sessions can retrieve essential findings. section 4.2.2 section 2.3.1
  • Keep recon actions safe and authorized; even low-impact requests can appear in a target’s logs. section 4.2.2
Table 4.1. The ReAct pipeline summary
Stage
Purpose
What our passive recon agent does
Plan
Decide what to examine.
Generate a small list of likely subdomains for the target.
Act
Gather data safely.
Resolve DNS and send a single HEAD / request.
Observe
Interpret results.
Extract headers and capture lightweight TLS hints.
Record
Preserve context.
Append a JSONL artifact to recon.jsonl with timestamps and notes.

The ReAct pipeline places chain-of-thought reasoning in Plan and connects it to bounded data gathering, interpretation, and JSONL recordkeeping. section 4.2.2

How AI Agents for Offensive Security covers it

How deep it goes
Defines stepwise reasoning and situates it in ReAct planning, without specifying a prompt template or internal model mechanics.
Examples
Uses a cake-slice arithmetic problem and a reconnaissance pipeline that plans, probes, observes, and records JSONL findings.
What it assumes
Introduces the reasoning method from a simple arithmetic example while assuming familiarity with agent components and reconnaissance objectives.
What you can do after
Apply it via a ReAct agent to select bounded reconnaissance actions and preserve resulting context as artifacts.
How it connects
Connects chain-of-thought prompting to AI agents, ReAct, tools, memory, artifacts, and agent controllers.

Also explained in

Compare how 29 books explain chain-of-thought prompting →

Related concepts

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