RTVIProcessor
Core coordinator for RTVI protocol communication
The RTVIProcessor
is the main coordinator for RTVI protocol communication between clients and your Pipecat application. It manages service configuration, handles client actions, and coordinates function calls.
Basic Usage
The RTVIProcessor needs to be initialized with a configuration and added to your pipeline. The configuration defines what services and configuration options are available to clients.
Client Ready State
Clients must also indicate they are ready to communicate and send/receive tracks. This is done by the client sending a client-ready
message. The RTVIProcessor
handles that message and emits an on_client_ready
callback.
When using the Pipecat client SDKs, the Daily Transport will send a client-ready message automatically upon receiving tracks from the bot.
Bot Ready State
The bot must be marked as ready before it can receive client messages.
When building a client/server application, the bot can be marked as ready once the client is ready to communicate. This can be done automatically or manually. An example is to handle the on_client_ready
event and mark the bot as ready when the client is ready.
When the bot is marked ready, it sends a bot-ready message to the client containing:
- The RTVI protocol version
- Current service configuration
- Available actions
Services
Services represent configurable components of your application. Each service can have multiple options that clients can control.
Registering Services
To make a service available to clients, you need to:
- Define the option handler function(s)
- Create an RTVIService instance
- Register it with the RTVIProcessor using
register_service()
Defining Services
Create a service with configurable options:
The service handler is called whenever the option changes:
- Receives the processor instance
- Gets the service name
- Contains the new option configuration
- Can validate and apply changes
- Can send errors if needed
Option Types
Services support multiple option types for different configuration needs:
Available option types:
bool
- True/false flagsnumber
- Numeric valuesstring
- Text valuesarray
- Lists of valuesobject
- Complex structured data
Option Handlers
Option handlers process configuration changes. A handler receives:
- The processor instance
- The service name
- The option configuration with new value
Actions
Actions are functions that clients can trigger. They can accept arguments and return results.
Learn how to use RTVI Actions in the Client SDK documentation.
Registering Actions
To make an action available to clients, you need to:
- Define the action handler function
- Create an RTVIAction instance
- Register it with the RTVIProcessor using
register_action()
Basic Actions
Register a simple action:
The action handler receives:
- The processor instance
- The service name
- Any provided arguments
Actions with Arguments
Actions can accept typed arguments from clients:
Function Calls
Handle LLM function calls with client interaction:
The function call process:
- LLM requests a function call
- Processor notifies client
- Client executes function
- Result is returned to LLM
- Conversation continues
Error Handling
Send error messages to clients in different ways:
Error types include:
- Configuration errors
- Action execution errors
- Function call errors
- Protocol errors
- Fatal vs non-fatal errors
Bot Control
Control bot state and handle interruptions:
Bot control features:
- Ready state management
- Client synchronization
- Graceful interruption
- Error recovery
Next Steps
Frame Processors
Learn about the specialized processors that work alongside RTVIProcessor