Dashboard
Lessons
Lesson 6: When to Use Tools, Code, or ReAct Agents

Lesson 6: When to Use Tools, Code, or ReAct Agents

Skills
Generative AI
Prompt Engineering

Why This Lesson Matters

Language models are powerful—but they can’t do everything in their heads. Some tasks require external knowledge, live data, or step-by-step execution.

Knowing when to extend the model’s capabilities with tools like search, code interpreters, or APIs is key to building real-world workflows that scale.

When Prompting Isn’t Enough

  • Live data retrieval: Model knowledge cutoff makes static LLMs outdated
  • Math / logic precision: LLMs may hallucinate or miscalculate without code
  • Data parsing / analysis: Requires structured logic or programmatic output
  • Multi-step decisions: Needs memory or chaining of outputs
  • Task automation: Requires acting, not just suggesting

Reasoning vs. Acting

Reasoning = Thinking step-by-step within the model (e.g., Chain of Thought)

Acting = Performing an external task, such as:

  • Searching the web
  • Running code
  • Calling an API
  • Updating a file
  • Communicating with another agent

Together, this is known as ReAct: Reason + Act prompting.

Example Scenarios

1. Search Required

Task: “Get the latest Apple earnings report summary.”
Plain prompt fails (static knowledge). ReAct search returns real-time info.

2. Code Execution

Task: “How many Rs are in the word ‘strawberry’?”
LLMs may hallucinate. Writing code to count letters gives reliable output.

3. Workflow Automation

Task: “Summarize each customer support ticket and log to Airtable.”
Requires calling APIs, chaining prompts, and possibly memory.

Tool Types You Might Use

  • Search APIs: Live data, product info, citations
  • Code Interpreters: Math, logic, data manipulation
  • Database/API connectors: Store, update, or retrieve records
  • Browser tools: Navigate websites, click buttons, extract data

When to Use ReAct (Reason + Act)

Use ReAct when:

  • Your task depends on current info (news, pricing, etc.)
  • You need programmatic thinking (math, filters, logic)
  • The model needs to check, confirm, or revise before answering
  • You're using a toolchain (e.g., LangChain, Crew AI, ChatGPT with browsing)

Try This Prompt Challenge

👉 Use ReAct to find and summarize factual information:

Task: You want to verify the current CEO of a public company.
Challenge: Write a ReAct-style prompt that tells the model to search for the result, extract the name, and write a short intro about the executive.

Recap

Some problems require thinking. Others require tools. ReAct prompting bridges both—letting your AI reason through a problem and take action to solve it.

Understanding when and how to use tools is what separates hobbyist prompting from real-world AI workflows.

Next Lesson Next Lesson
Table of contents
Teacher
Matthew Berman
All
Matthew Berman
lessons

https://forwardfuture.ai/lessons/lesson-6-when-to-use-tools-code-or-react-agents