Skip to content

Commit 5606fb3

Browse files
authored
Update thoughts.mdx
1 parent 430e1a5 commit 5606fb3

File tree

1 file changed

+18
-78
lines changed

1 file changed

+18
-78
lines changed

units/en/unit1/thoughts.mdx

Lines changed: 18 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# Thought: Internal Reasoning and the ReAct Approach
23

34
<Tip>
@@ -6,68 +7,10 @@ In this section, we dive into the inner workings of an AI agent—its ability to
67

78
Thoughts represent the **Agent's internal reasoning and planning processes** to solve the task.
89

9-
This utilises the agent's Large Language Model (LLM) capacity **to analyze information when presented in its prompt**.
10-
11-
Think of it as the agent's internal dialogue, where it considers the task at hand and strategizes its approach.
12-
13-
The Agent's thoughts are responsible for assessing current observations and decide what the next action(s) should be.
14-
15-
Through this process, the agent can **break down complex problems into smaller, more manageable steps**, reflect on past experiences, and continuously adjust its plans based on new information.
16-
17-
Here are some examples of common thoughts:
18-
19-
| Type of Thought | Example |
20-
|----------------|---------|
21-
| Planning | "I need to break this task into three steps: 1) gather data, 2) analyze trends, 3) generate report" |
22-
| Analysis | "Based on the error message, the issue appears to be with the database connection parameters" |
23-
| Decision Making | "Given the user's budget constraints, I should recommend the mid-tier option" |
24-
| Problem Solving | "To optimize this code, I should first profile it to identify bottlenecks" |
25-
| Memory Integration | "The user mentioned their preference for Python earlier, so I'll provide examples in Python" |
26-
| Self-Reflection | "My last approach didn't work well, I should try a different strategy" |
27-
| Goal Setting | "To complete this task, I need to first establish the acceptance criteria" |
28-
| Prioritization | "The security vulnerability should be addressed before adding new features" |
29-
30-
> **Note:** In the case of LLMs fine-tuned for function-calling, the thought process is optional.
31-
> *In case you're not familiar with function-calling, there will be more details in the Actions section.*
32-
33-
## The ReAct Approach
10+
This utilises the agent's Large Language Model (LLM) capacity **to analyze information when presented in its prompt** — essentially, its inner monologue as it works through a problem.
3411

35-
A key method is the **ReAct approach**, which is the concatenation of "Reasoning" (Think) with "Acting" (Act).
12+
The Agent's thoughts help it assess current observations and decide what the next action(s) should be. Through this process, the agent can **break down complex problems into smaller, more manageable steps**, reflect on past experiences, and continuously adjust its plans based on new information.
3613

37-
ReAct is a simple prompting technique that appends "Let's think step by step" before letting the LLM decode the next tokens.
38-
39-
Indeed, prompting the model to think "step by step" encourages the decoding process toward next tokens **that generate a plan**, rather than a final solution, since the model is encouraged to **decompose** the problem into *sub-tasks*.
40-
41-
This allows the model to consider sub-steps in more detail, which in general leads to less errors than trying to generate the final solution directly.
42-
43-
<figure>
44-
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/ReAct.png" alt="ReAct"/>
45-
<figcaption>The (d) is an example of ReAct approach where we prompt "Let's think step by step"
46-
</figcaption>
47-
</figure>
48-
49-
<Tip>
50-
We have recently seen a lot of interest for reasoning strategies. This is what's behind models like Deepseek R1 or OpenAI's o1, which have been fine-tuned to "think before answering".
51-
52-
These models have been trained to always include specific _thinking_ sections (enclosed between `<think>` and `</think>` special tokens). This is not just a prompting technique like ReAct, but a training method where the model learns to generate these sections after analyzing thousands of examples that show what we expect it to do.
53-
</Tip>
54-
55-
---
56-
Now that we better understand the Thought process, let's go deeper on the second part of the process: Act.
57-
58-
# Thought: Internal Reasoning, Chain-of-Thought (CoT), and the ReAct Approach
59-
60-
<Tip>
61-
In this section, we dive into the inner workings of an AI agent—its ability to reason and plan. We’ll explore how the agent leverages internal dialogue to analyze information, break down complex problems into manageable steps, and decide what action to take next. We also clarify the distinction between two powerful prompting techniques: **Chain-of-Thought (CoT)** and **ReAct**.
62-
</Tip>
63-
64-
Thoughts represent the **Agent's internal reasoning and planning processes** to solve a task.
65-
66-
This leverages the agent's Large Language Model (LLM) capacity **to analyze information presented in its prompt** — essentially, its inner monologue as it works through a problem.
67-
68-
The Agent's thoughts help it assess current observations and decide what the next action(s) should be. This process allows the agent to **break down complex problems into manageable sub-tasks**, reflect on past experience, and adapt plans based on new information.
69-
70-
---
7114

7215
## 🧠 Examples of Common Thought Types
7316

@@ -82,10 +25,8 @@ The Agent's thoughts help it assess current observations and decide what the nex
8225
| Goal Setting | "To complete this task, I need to first establish the acceptance criteria" |
8326
| Prioritization | "The security vulnerability should be addressed before adding new features" |
8427

85-
> **Note:** In the case of LLMs fine-tuned for function-calling, the thought process is optional.
86-
> If you're not familiar with function-calling yet, more details will come in the Actions section.
28+
> **Note:** In the case of LLMs fine-tuned for function-calling, the thought process is optional. More details will be covered in the Actions section.
8729
88-
---
8930

9031
## 🔗 Chain-of-Thought (CoT)
9132

@@ -97,21 +38,25 @@ It typically starts with:
9738
This approach helps the model **reason internally**, especially for logical or mathematical tasks, **without interacting with external tools**.
9839

9940
### ✅ Example (CoT)
100-
10141
```
10242
Question: What is 15% of 200?
10343
Thought: Let's think step by step. 10% of 200 is 20, and 5% of 200 is 10, so 15% is 30.
10444
Answer: 30
10545
```
10646

107-
---
10847

10948
## ⚙️ ReAct: Reasoning + Acting
11049

111-
**ReAct** stands for **Reasoning and Acting**. It extends CoT by introducing **external actions** between thoughts. This includes using tools (e.g., calculator, search engine) to gather information, followed by observations that feed into the next reasoning step.
50+
A key method is the **ReAct approach**, which combines "Reasoning" (Think) with "Acting" (Act).
11251

113-
### 🔄 Example (ReAct)
52+
ReAct is a prompting technique that encourages the model to think step-by-step and interleave actions (like using tools) between reasoning steps.
11453

54+
This enables the agent to solve complex multi-step tasks by alternating between:
55+
- Thought: internal reasoning
56+
- Action: tool usage
57+
- Observation: receiving tool output
58+
59+
### 🔄 Example (ReAct)
11560
```
11661
Thought: I need to find the latest weather in Paris.
11762
Action: Search["weather in Paris"]
@@ -127,22 +72,17 @@ Action: Finish["It's 18°C and cloudy in Paris."]
12772
</figcaption>
12873
</figure>
12974

130-
---
13175

13276
## 🔁 Comparison: ReAct vs. CoT
13377

134-
| Feature | CoT | ReAct |
135-
|----------------------|-----------------------------|------------------------------------|
136-
| Step-by-step logic | Yes | Yes |
137-
| Uses external tools | No | Yes (Actions + Observations) |
138-
| Best for | Logic, math, internal tasks | Multi-step tasks requiring info |
78+
| Feature | Chain-of-Thought (CoT) | ReAct |
79+
|----------------------|-----------------------------|-------------------------------------|
80+
| Step-by-step logic | Yes | ✅ Yes |
81+
| External tools | ❌ No |Yes (Actions + Observations) |
82+
| Best suited for | Logic, math, internal tasks | Info-seeking, dynamic multi-step tasks |
13983

14084
<Tip>
141-
Recent models like Deepseek R1 or OpenAI’s o1 were fine-tuned to think before answering. They often use structured tokens like `<think>` and `</think>` to explicitly separate the reasoning phase from the final answer.
85+
Recent models like **Deepseek R1** or **OpenAI’s o1** were fine-tuned to *think before answering*. They use structured tokens like `<think>` and `</think>` to explicitly separate the reasoning phase from the final answer.
14286

14387
Unlike ReAct or CoT — which are prompting strategies — this is a **training-level technique**, where the model learns to think via examples.
14488
</Tip>
145-
146-
---
147-
148-
Now that we understand internal reasoning and the ReAct method, let’s move on to the second part of the loop: **Act**.

0 commit comments

Comments
 (0)