smolagents/docs/source/conceptual_guides/react.md

2.2 KiB

ReAct agents

One shot agent

This agent has a planning step, then generates python code to execute all its actions at once. It natively handles different input and output types for its tools, thus it is the recommended choice for multimodal tasks.

React agents

This is the go-to agent to solve reasoning tasks, since the ReAct framework (Yao et al., 2022) makes it really efficient to think on the basis of its previous observations.

We implement two versions of JsonAgent:

  • [JsonAgent] generates tool calls as a JSON in its output.
  • [CodeAgent] is a new type of JsonAgent that generates its tool calls as blobs of code, which works really well for LLMs that have strong coding performance.

[!TIP] Read Open-source LLMs as LangChain Agents blog post to learn more about ReAct agents.

Framework of a React Agent