dspy-react

Installation
SKILL.md

Build Tool-Using Agents with dspy.ReAct

Guide the user through building agents that reason step-by-step and call tools to accomplish tasks. dspy.ReAct implements the Reasoning-Action-Observation loop -- the agent thinks about what to do, calls a tool, observes the result, and repeats until it has an answer.

Gather context first

Before generating code, ask:

  1. What tools does the agent need? Describe what each tool does and what data source it connects to (e.g., "a web search tool that calls the Serper API", "a database lookup for user accounts by email").
  2. How many steps might the agent need per query? One or two lookups (simple) or multi-step research chains (complex)? This determines max_iters.
  3. What are the agent's inputs? Just a question, or also context like user ID, session state, or a system prompt?
  4. What outputs do you need? A plain answer field, or structured fields like confidence, sources, or category?

What is ReAct

dspy.ReAct implements the Reasoning-Action-Observation loop as an optimizable module. The agent reasons about what to do, calls a tool, observes the result, and repeats until it has enough information to answer. DSPy handles the loop mechanics and prompt construction.

When to use ReAct

Installs
6
GitHub Stars
11
First Seen
Mar 17, 2026
dspy-react — lebsral/dspy-programming-not-prompting-lms-skills