ReAct Sub Agent | Rasa Documentation

Build your first agent in just a few minutes with Rasa Copilot.

On this page

ReAct Sub Agents are currently in beta and are available starting from Rasa 3.14.0.

ReAct sub agents are built-in autonomous agents that can dynamically utilize MCP (Model Context Protocol) tools and custom tools defined in Python code to complete tasks. They follow a ReAct ( re asoning + act ing) loop: a large language model (LLM) chooses which tools to invoke based on the ongoing conversation context.

Two types of ReAct sub agents are currently supported:

  1. General-purpose ReAct Sub Agent: Handles open-ended tasks and requires explicit completion signaling
  2. Task-specific ReAct Sub Agent: Focuses on filling specific slots with automatic completion based on exit conditions

General-purpose ReAct Sub Agent

A general-purpose ReAct sub agent is designed for open-ended, exploratory tasks where the agent itself determines when the task is complete. Unlike task-specific agents that have predefined exit conditions, general-purpose agents require explicit completion signaling through a built-in task_completed tool.

Key Characteristics

The task_completed Tool

General-purpose ReAct sub agents have access to a built-in task_completed tool that ends the ReAct loop and returns control to the flow. The tool is registered automatically and always uses the name task_completed so the runtime can recognize completion. The tool has no parameters. When calling task_completed, the model should include a short, natural user-facing message in the same response. This message appears directly to the user and serves as a brief closing line for that turn.

You can change or replace this tool by subclassing MCPOpenAgent and overriding get_task_completed_tool().

Tool definition

task_completed tool schema

{
  "type": "function",
  "function": {
    "name": "task_completed",
    "description": "Call this tool exactly once when your primary task is FULLY completed. This tool accepts no arguments. You MUST also include text in the same response: a natural, conversational follow-up to the user's last message (e.g. acknowledge their choice, wish them well, close warmly). Do NOT summarize what you did or what happened in the conversation. Do NOT include any inner thoughts or explanations. A response with only the tool call and no text is invalid. Keep it short and natural.",
    "parameters": {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    },
    "strict": true
  }
}

How Completion Works

  1. Agent decision: The ReAct sub agent autonomously determines when its primary task is complete and the execution loop should finish.
  2. Tool call: When ready to complete, the model calls the task_completed tool once. The tool has no parameters; the closing line for the user is agent message in the same turn (a short follow-up to the user’s last message—not a recap of the whole conversation, and not a message argument on the tool).
  3. Completion signal: The task_completed call terminates the ReAct sub agent’s execution loop. If the model also invoked other MCP tools in that same response, Rasa still processes those tool results before the run completes. The run ends with status completed.
  4. User response: The user sees the streamed agent message from that turn. The tool itself only returns a fixed internal result (Task completed); that value is not a user-facing parameter.
  5. Control return: Control returns to the main flow, which can then proceed to the next step.

Task-specific ReAct Sub Agent

A task-specific ReAct sub agent is designed for structured data collection tasks where specific slots need to be filled with values. Unlike general-purpose agents that determine their own completion, task-specific agents automatically complete when predefined exit conditions are met, making them ideal for appointment booking, form filling, or data collection scenarios.

Key Characteristics

The set_slot_<slot_name> Tools

Task-specific ReAct sub agents automatically receive built-in set_slot_<slot_name> tools for each slot mentioned in the exit_if conditions. These tools are dynamically generated based on the slot definitions and cannot be disabled.

Configuration

ReAct sub agents extend the basic sub agent configuration with additional settings.

Configuration Section

The configuration section is optional in the ReAct sub agent's config.yml file and provides additional customization options for LLM and connection settings.

Customization

ReAct sub agents can be customized in two ways:

Key Differences Between General-Purpose and Task-Specific ReAct Sub Agents

Category General-Purpose Task-Specific
Purpose Open-ended exploratory conversations where the agent determines when it is done Goal-oriented tasks that need to fill specific slots with values
Completion Requires calling a task_completed tool to finish its execution loop Automatically completes when exit conditions are met
Exit Conditions Explicit signaling of completion via the task_completed tool Completion determined by evaluating the exit_if conditions
Built-in Slot Tools No automatic slot-setting tools Automatically gets set_slot_<slot_name> tools for each slot mentioned in the exit conditions
Final response The model sends agent message (short closing follow-up to the user’s last message) in the same turn as a task_completed tool call; the tool has no parameters and only signals that the run is done Completes silently without sending a response, allowing the flow to continue to the next step