Class ReActAgentTemplate
A template for creating agents using the ReAct (Reasoning + Acting) pattern.
ReAct agents explicitly reason about each step before taking action, making them excellent for complex, multi-step tasks requiring tools.
public sealed class ReActAgentTemplate : AgentTemplate
- Inheritance
-
ReActAgentTemplate
- Inherited Members
Examples
var agent = new ReActAgentTemplate()
.WithModel(model)
.WithTools(calculatorTool, searchTool, fileTool)
.WithVerboseThinking(true)
.Build();
var result = await agent.RunAsync("Research the topic and summarize findings");
Remarks
The ReAct pattern interleaves:
- Thought: Reasoning about what to do next
- Action: Executing a tool or taking an action
- Observation: Processing the result
Properties
- TemplateName
Gets the template name.
Methods
- ConfigureBuilder(AgentBuilder)
Configures the agent builder with template-specific settings.
- ForTask(string)
Sets a description of the typical tasks this agent handles.
- WithMaxSteps(int)
Sets the maximum reasoning steps.
- WithModel(LM)
Sets the model for the agent.
- WithTool(ITool)
Adds a single tool.
- WithTools(params ITool[])
Adds tools for the agent to use.
- WithVerboseThinking(bool)
Sets whether to show verbose thinking in output.