Input and Output
Following is the gRPC API definition for the Rasa Action Server. The API is defined in theproto/action_webhook.proto
file in the Rasa SDK repository.
action_webhook.proto
Streaming custom actions (WebhookStream)
New in Rasa SDK 3.17 / Rasa Pro 3.17
WebhookStream instead of the unary Webhook RPC.
The server streams WebhookStreamEvent messages in order:
Rasa maps
chunk_start, chunk, and chunk_end to the output channel’s streaming methods (send_response_chunk_start, send_response_chunk, send_response_chunk_end).
Barge-in (AckStreamChunks)
When a user interrupts a streaming custom action on a voice channel, Rasa sends a unary AckStreamChunks call with the active response_id from the in-flight stream. The action server calls cancel_stream() on the matching dispatcher so subsequent chunks are dropped, drains the action until it finishes naturally, and then yields final_result with any Rasa events the action returns.
If the action does not complete within the barge-in timeout (default 30 seconds, configurable via the ACTION_SERVER_STREAM_BARGE_IN_TIMEOUT_SECONDS environment variable on the action server), the SDK yields an empty final_result so Rasa can finish the barge-in handler and cancel a hung action.
See the SDK dispatcher reference for action-author guidance.
Error Handling
When Rasa server is communicating with the action server over gRPC protocol, and an error occurs, the action server should return appropriate error message containing proper gRPC status code and details. Following are the possible error scenarios and the expected error response from the action server.Rasa Python action server error handling supportRasa Python action server provided by Rasa in the for of Rasa SDK
is already handling these error scenarios and returning appropriate error messages
to the Rasa server. If you are using a custom action server, you need to handle these error scenarios accordingly.
Custom action is not found
In case that the action server does not find the custom action, it should return:- an error with gRPC status code
NOT_FOUND - details in the error message in the format of:
action_name is the name of the action that was not found,
message is a human-readable error message,
and resource_type is the type of the resource that was not found.
Custom action failed during execution
In case that the custom action fails during execution, it should return:- an error with gRPC status code
INTERNAL - details in the error message in the format of:
action_name is the name of the action that failed,
and message is a human-readable error message.
Domain is not found
In case that the action server does not find the domain, which corresponds to thedomain_digest of the assistant, it should return:
- an error with gRPC status code
NOT_FOUND - details in the error message in the format of:
action_name is the name of the action which was targeted for invocation,
message is a human-readable error message,
and resource_type is the type of the resource that was not found.