CoachnestCoachnest
Sign InGet Started
Back to course

Prompt Engineering Mastery: From Fundamentals to Production

…
—
Contents
1

What Is Prompt Engineering?

ReadingFree
2

How Large Language Models Actually Work

ReadingFree
3

Tokens, Context Windows, Temperature & Sampling

Reading11m
4

The Anatomy of a Great Prompt

Reading13m
5

Module 1 Knowledge Check

Quiz8m
6

Zero-Shot, One-Shot & Few-Shot Prompting

Reading12m
7

Role & Persona Prompting

Reading9m
8

Instruction Clarity, Delimiters & Decomposition

Reading11m
9

Controlling the Output Format

Reading10m
10

Module 2 Knowledge Check

Quiz8m
11

Chain-of-Thought Prompting

Reading12m
12

Self-Consistency & Tree-of-Thought

Reading11m

ReAct — Reasoning + Acting with Tools

Reading12m
14

Structured Output with JSON Schemas

Reading11m
15

Module 3 Knowledge Check

Quiz8m
16

Retrieval-Augmented Generation (RAG)

Reading13m
17

Prompt Templates, Variables & Chaining

Reading11m
18

Tool / Function Calling Patterns

Reading12m
19

Project — Build a Customer Support Assistant

Reading14m
20

Module 4 Knowledge Check

Quiz8m
21

Evaluating Prompt Quality

Reading12m
22

Prompt Injection & Security

Reading12m
23

Reducing Hallucinations

Reading10m
24

Cost, Latency & Optimization

Reading10m
25

Final Assessment — Prompt Engineering Mastery

Quiz15m
←→navigate lessons
Chapter 3 of 5·Module 3 · Advanced Reasoning & Structured Output
Lesson 13 of 25Reading12 min

ReAct — Reasoning + Acting with Tools

#ReAct — Reasoning + Acting with Tools¶

LLMs can't do reliable math, fetch live data, or run code. ReAct lets them use tools by interleaving reasoning with actions.

The Loop¶

Thought → reason about what to do next Action → call a tool (search, calculator, API) Observation → tool result is fed back in Thought → reason about the observation ... repeat until ... Answer → final response

Example Trace¶

text
10 lines
1Question: What is the population of France divided by 2?
2
3Thought: I need the current population of France. I'll search.
4Action: search("population of France 2024")
5Observation: ~68 million
6Thought: Now divide by 2 using the calculator.
7Action: calculator("68000000 / 2")
8Observation: 34000000
9Thought: I have the answer.
10Answer: About 34 million.

The model reasons about which tool to use, the system actually executes the tool, and the result is injected back as an observation. The LLM never does the math itself — it orchestrates.

Why It Works¶

  • Reasoning decides the plan and recovers from errors.
  • Acting grounds the model in real, current, exact data — directly attacking hallucination.

This pattern is the backbone of modern agents.

Modern Form: Native Tool / Function Calling¶

You rarely hand-parse "Action:" strings today. Provider APIs expose tool/function calling: you declare tools with JSON schemas; the model returns a structured request to call one; you execute it and return the result; it continues. Same ReAct loop, robust transport. (Hands-on in Module 4.)

Designing Good Tools¶

PrincipleWhy
Few, well-named toolsThe model picks correctly more often
Clear descriptions + when to useThe description is the prompt for tool selection
Validate tool inputsThe model can produce malformed args
Return concise observationsHuge tool outputs blow the context window

Mental model: The LLM is the brain that plans; tools are the hands that act. ReAct is how they coordinate.

Previous

Self-Consistency & Tree-of-Thought

Next

Structured Output with JSON Schemas

Use ← → arrow keys to navigate between lessons