/rasa-agent-skills:rasa-setting-up-react-agentsfrom rasa-agent-skills
Configures ReAct sub agents in a Rasa CALM assistant that dynamically select MCP tools. Covers agent types, prompt customization, tool filtering, custom Python tools, and input/output processing.
Ships in rasa-agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
ReAct sub agents are built-in autonomous agents that dynamically choose which MCP tools to invoke based on conversation context. They operate in a ReAct (Reasoning + Acting) loop — the agent reasons about the user's request, picks a tool, observes the result, and repeats until the task is done.
MCP servers must be defined in endpoints.yml before configuring a ReAct sub agent.
See the rasa-configuring-mcp-server skill for server setup and authentication.
This feature is in beta and available starting from Rasa 3.14.0.
endpoints.yml (see rasa-configuring-mcp-server
skill).config.yml
(see "Directory structure" and "Configuration").call step
(see "Invoking from a flow").Each ReAct sub agent lives in its own subdirectory under sub_agents/. Both
rasa train and rasa run scan this directory by default; pass --sub-agents <path>
to either command to use a different directory.
The agent name must be unique across all sub agents and all flow IDs.
your_project/
├── config.yml
├── endpoints.yml
├── domain/
├── data/flows/
└── sub_agents/
└── stock_explorer/
├── config.yml # required
├── prompt_template.jinja2 # optional
└── custom_agent.py # optional
The sub agent's config.yml connects the agent to one or more MCP servers defined in
endpoints.yml. The protocol defaults to RASA — do not set it to A2A.
# sub_agents/stock_explorer/config.yml
agent:
name: stock_explorer
description: "Agent that helps users research and analyze stock options"
configuration:
llm: # optional, default model is provided by Rasa codebase
model_group: my_llm
prompt_template: sub_agents/stock_explorer/prompt_template.jinja2 # optional
timeout: 30 # optional, seconds before timing out
max_retries: 3 # optional, MCP connection retries
include_date_time: true # optional, default: true
timezone: "America/New_York" # optional, default: "UTC"
connections:
mcp_servers:
- name: trade_server
include_tools:
- find_symbol
- get_company_news
- fetch_live_price
| Key | Required | Description |
|---|---|---|
agent.name | yes | Unique name — must not clash with any flow ID or other sub agent |
agent.description | yes | Brief description of the agent's capabilities |
configuration.llm | no | LLM to power the agent's reasoning. Has a default model |
configuration.prompt_template | no | Path to a Jinja2 prompt template |
configuration.timeout | no | Seconds before timing out. No timeout by default |
configuration.max_retries | no | MCP connection retry attempts. Default: 3 |
configuration.include_date_time | no | Include current date/time in prompts. Default: true |
configuration.timezone | no | IANA timezone (e.g. "UTC", "Europe/London"). Default: "UTC" |
configuration.module | no | Python class path for customization |
connections.mcp_servers | yes | List of MCP servers this agent connects to. At least one required |
For each MCP server entry under connections.mcp_servers, use include_tools or
exclude_tools to control which tools the agent can access. These are mutually
exclusive — use one or the other per server, never both.
include_tools — only these tools are available to the agent.exclude_tools — all tools except these are available.connections:
mcp_servers:
- name: trade_server
include_tools:
- find_symbol
- get_company_news
- name: analytics_server
exclude_tools:
- admin_analytics
Rasa supports two types of ReAct sub agents. Choose based on how the agent signals completion.
| General-purpose | Task-specific | |
|---|---|---|
| When to use | Open-ended tasks where the agent decides when it's done | Structured data collection (form filling, booking) |
| Completion | Agent calls a built-in task_completed tool | Automatic when exit_if slot conditions are met |
| Built-in tools | task_completed only | set_slot_<slot_name> for each slot in exit_if |
| Final response | Sends a summary message to the user | Completes silently — flow continues to next step |
| Base class | MCPOpenAgent | MCPTaskAgent |
The agent runs autonomously until it calls task_completed:
flows:
stock_research:
description: helps research and analyze stock investment options
steps:
- call: stock_explorer
The agent runs until the specified slot conditions are met. Rasa automatically provides
set_slot_<slot_name> tools for each slot in exit_if:
flows:
appointment_booking:
description: helps users book appointments
steps:
- call: booking_agent
exit_if:
- slots.appointment_time is not null
- collect: final_confirmation
Customization is optional. Only create a custom class when you need to:
Create a Jinja2 file and reference it in configuration.prompt_template. Available
variables:
{{ description }} — the agent's description from config.yml.{{ slots.<slot_name> }} — any slot value.{{ conversation_history }} — full dialogue transcript.{{ current_datetime }} — datetime object (when include_date_time is enabled).
Use methods like {{ current_datetime.strftime("%d %B, %Y") }}.sub_agents/stock_explorer/custom_agent.py).MCPOpenAgent (general-purpose) or MCPTaskAgent (task-specific).process_input, process_output, and/or get_custom_tool_definitions.configuration.module to the class.from rasa.agents.protocol.mcp.mcp_open_agent import MCPOpenAgent
from rasa.agents.schemas import AgentInput, AgentOutput, AgentToolResult
from rasa.sdk.events import SlotSet
class StockAnalysisAgent(MCPOpenAgent):
async def process_input(self, input: AgentInput) -> AgentInput:
input.slots = [s for s in input.slots if s.name in {"portfolio_id", "risk_level"}]
return input
async def process_output(self, output: AgentOutput) -> AgentOutput:
if output.structured_results:
results = output.structured_results[-1]
output.events = output.events or []
output.events.append(SlotSet("analysis_result", results))
return output
# sub_agents/stock_explorer/config.yml
agent:
name: stock_explorer
description: "Agent that helps users research and analyze stock options"
configuration:
module: "sub_agents.stock_explorer.custom_agent.StockAnalysisAgent"
connections:
mcp_servers:
- name: trade_server
process_input(input: AgentInput) -> AgentInput — modify what the agent receives.
Key fields on AgentInput:
| Field | Type | What to do with it |
|---|---|---|
slots | List[AgentInputSlot] | Filter to only relevant slots |
user_message | str | Rewrite or augment the user message |
conversation_history | str | Trim or redact sensitive history |
metadata | Dict[str, Any] | Inject custom metadata |
process_output(output: AgentOutput) -> AgentOutput — modify what comes back
into Rasa. Key fields on AgentOutput:
| Field | Type | What to do with it |
|---|---|---|
events | Optional[List[SlotSet]] | Add SlotSet events to store data in Rasa slots |
structured_results | Optional[List] | Read raw results from agent tool calls |
response_message | Optional[str] | Rewrite the message sent to the user |
Implement get_custom_tool_definitions to add Python tools alongside MCP tools. Each
tool definition follows the OpenAI function calling spec and must include a
tool_executor key pointing to an async method.
The tool_executor method receives arguments as a dict and must return an
AgentToolResult:
| Field | Type | Description |
|---|---|---|
tool_name | str | Name of the tool |
result | Optional[str] | The tool's output |
is_error | bool | Whether the execution failed. Default: False |
error_message | Optional[str] | Error details if execution failed |
Tool executors must be async. Do not use blocking calls (time.sleep,
synchronous requests). Use httpx.AsyncClient, asyncio.to_thread, etc.
from typing import Any, Dict, List
class StockAnalysisAgent(MCPOpenAgent):
def get_custom_tool_definitions(self) -> List[Dict[str, Any]]:
return [{
"type": "function",
"function": {
"name": "recommend_stocks",
"description": "Analyze results and return stock recommendations",
"parameters": {
"type": "object",
"properties": {
"search_results": {
"type": "string",
"description": "The search results to analyze",
},
},
"required": ["search_results"],
"additionalProperties": False,
},
"strict": True,
},
"tool_executor": self._recommend_stocks,
}]
async def _recommend_stocks(self, arguments: Dict[str, Any]) -> AgentToolResult:
results = arguments["search_results"]
return AgentToolResult(tool_name="recommend_stocks", result=results)
exit_if with general-purpose agents — exit_if is only for task-specific
agents. General-purpose agents signal completion via task_completed.include_tools and exclude_tools on the same server — these are mutually
exclusive per MCP server entry. Using both causes a validation error.name under connections.mcp_servers must
exactly match a name in endpoints.yml.time.sleep or synchronous HTTP clients blocks the event loop.configuration.timezone must be a valid IANA timezone name.
Invalid values raise a ValidationError during agent initialization.INPUT_REQUIRED.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub rasahq/rasa-agent-skills --plugin rasa-agent-skills18 skills in this plugin
/rasa-building-flowsBuilds conversation flows for Rasa CALM assistants using YAML. Use when creating or editing flows, designing flow architecture, adding branching logic, writing flow and collect step descriptions, or connecting flows with call and link steps.
/rasa-building-skillsBuilds skills (capabilities) for a Rasa CALM assistant. Use when the user asks to create, add, or build a skill, capability, or feature for their Rasa assistant.
/rasa-calling-mcp-tools-from-flowsCalls MCP tools directly from Rasa flow steps. Use when invoking an MCP tool via a call step, mapping slot values to tool parameters, or extracting tool results into slots. This replaces custom action code for simple API integrations.
/rasa-configuring-assistantConfigures config.yml and endpoints.yml for Rasa CALM assistants. Covers pipeline (command generators, flow retrieval), policies (FlowPolicy), action endpoint, and language settings. Use when setting up a new project or modifying pipeline components.
/rasa-configuring-mcp-serverConfigures MCP (Model Context Protocol) servers in a Rasa CALM assistant. Use when defining MCP servers in endpoints.yml, setting up authentication (API key, OAuth 2.0, pre-issued token), or connecting to multiple external services.
/rasa-configuring-model-groupsConfigures model_groups in endpoints.yml for LLM and embedding providers. Covers single and multi-deployment setups, routing strategies, failover, self-hosted models, and caching. Use when adding or changing LLM providers or setting up multi-LLM routing.