# 第二章 推理、规划与提示词工程

智能体的核心能力不只有“会想”，还包括“会拆解、会行动、会复盘、会受约束”。本章围绕五个可组合的能力层展开：局部推理展开（CoT）、搜索与规划（ToT/GoT）、推理-行动闭环（ReAct）、反思修正（Reflexion）以及行为编排（Prompt Engineering）。它们不是严格的单线进阶关系，而是面向不同任务复杂度和系统约束的组合工具箱。

## 学习目标

完成本章后，你将能够：

1. **区分** 不同推理与规划技术各自解决的问题边界
2. **组合** CoT、ToT/GoT、ReAct 与 Reflexion 构建任务闭环
3. **编写** 结构化的智能体提示词，明确角色、约束、工具与上下文
4. **评估** 不同能力层在准确性、可控性与成本上的取舍

## 章节地图

本章按照“推理展开 → 搜索规划 → 行动执行 → 反思修正 → 提示词编排”的结构展开，但这些内容更适合被理解为同一智能体栈中的并列能力层：

* [2.1 思维链与线性推理](/agentic_ai_guide/di-yi-bu-fen-dan-ti-zhi-neng-jia-gou/02_reasoning/2.1_cot.md)：解决单次回答中的步骤展开与局部推理问题
* [2.2 任务分解与规划算法](/agentic_ai_guide/di-yi-bu-fen-dan-ti-zhi-neng-jia-gou/02_reasoning/2.2_decomposition.md)：把复杂目标拆成可搜索、可排序、可并行的子问题
* [2.3 ReAct：推理与行动的统一](/agentic_ai_guide/di-yi-bu-fen-dan-ti-zhi-neng-jia-gou/02_reasoning/2.3_react.md)：把推理与工具调用串成执行闭环
* [2.4 反思与自我修正](/agentic_ai_guide/di-yi-bu-fen-dan-ti-zhi-neng-jia-gou/02_reasoning/2.4_reflexion.md)：在失败、评估与反馈中积累可复用经验
* [2.5 智能体提示词工程](/agentic_ai_guide/di-yi-bu-fen-dan-ti-zhi-neng-jia-gou/02_reasoning/2.5_prompt_engineering.md)：用角色、约束、工具、示例与缓存策略把前述能力组织起来

***

**下一节**: [2.1 思维链与线性推理](/agentic_ai_guide/di-yi-bu-fen-dan-ti-zhi-neng-jia-gou/02_reasoning/2.1_cot.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeasy.gitbook.io/agentic_ai_guide/di-yi-bu-fen-dan-ti-zhi-neng-jia-gou/02_reasoning.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
