In many cases, you can call tools of an MCP (Model Context Protocol) server directly from your flow steps as an alternative to writing custom actions.
Directly invoking MCP tools is often a simpler and more maintainable way to integrate with external APIs, databases, or services.
Consider this approach before implementing a custom action.
See Calling an MCP Tool for more details.
Running Custom Actions Directly by the Assistant
New in 3.10You can now run Python custom actions directly on the Rasa Assistant without the need for a separate Action Server.
Benefits of Direct Custom Action Execution
- Simplified Architecture: Removes the need for a separate Action Server, reducing the complexity of your architecture and deployment process.
- Lower Latency: Improves response times by eliminating the network roundtrips required to communicate with an external Action Server.
- Unified Environment: Executes all components of your assistant within the same environment, making debugging and local development smoother.
- Cost Efficiency: Reduces infrastructure costs as there is no need to maintain an additional server for handling custom actions.
Disadvantages of Direct Custom Action Execution
- Higher Effort To Secure Rasa Environment: The Rasa assistant will need access to the same sensitive resources required by the custom actions to access remote services (i.e. tokens, credentials), which may introduce security risks. Therefore, the Rasa instance should be secured properly by running in a more protected environment.
How to Configure the Feature
To use this feature, you need to update theaction_endpoint section of the endpoints.yml file.
Add the actions_module field and specify the path to your custom actions Python package.
This package will be imported and used directly by the Rasa Assistant to run the actions.
For example, consider this is your project structure:
actions_module field in the endpoints.yml file as follows:
endpoints.yml
url field, which you would typically use for pointing to an external Action Server.
If both url and actions_module are specified, actions_module will be prioritized.
Every time you update the custom actions code, you must restart the Rasa Assistant to reflect the changes via the
rasa run or rasa inspect commands.Streaming custom actions
New in Rasa Pro 3.17 / Rasa SDK 3.17
How to write a streaming action
Use theCollectingDispatcher streaming API in your actionβs run method:
Where streaming is supported
Real-time streaming requires a streaming-capable action executor and a streaming output channel. See Built-in output channels with streaming support. Rasa Pro supports streaming custom actions on:
Configure gRPC in
endpoints.yml:
endpoints.yml
endpoints.yml
HTTP action server fallback
If your action server is reached over HTTP or HTTPS, streaming degrades automatically:- Rasa calls the action via a single HTTP POST to the
/webhookendpoint β there is no streaming HTTP API equivalent to gRPCβsWebhookStream. - Inside the SDK,
stream_chunk()calls accumulate internally because no streaming sink is attached. - When
stream_end()runs, each accumulated chunk is replayed as anutter_message()in the HTTP response payload. - Rasa delivers the full set of responses to the user after the action finishes.
stream_start / stream_chunk / stream_end sequence works on every transport; only the delivery timing changes.