important-garden-60239
09/10/2025, 11:43 AMtall-airline-16756
09/10/2025, 11:43 AMtall-airline-16756
09/10/2025, 11:44 AMlocalParticipant.registerRpcMethod
. These methods are designed to handle incoming requests and can even update the agent’s behavior on the fly, such as changing voice settings or input/output modalities.
• Performing RPC Requests: Participants can call these methods using performRpc
, sending data (like JSON) to the intended participant and waiting for a response.
• Real-World Use Cases: This can be super helpful for things like updating UI elements, switching between audio and text input, or sending notifications to the frontend.
• Error Handling: RPC also includes structured error handling and response timeouts to keep communication smooth and reliable.
If you'd like, I’d be more than happy to share detailed examples and best practices to help you get started. Just let me know!
Sources: packages/livekit-rtc/README.md | README.md | Remote method calls (RPC) | LiveKit Docs | agent/main.py | Docs::Homeimportant-garden-60239
09/10/2025, 11:45 AMtall-airline-16756
09/10/2025, 11:46 AMlocalParticipant.registerRpcMethod
to set up a handler for a method name, such as client.updateForm
. This way, your frontend knows what to do when it receives the call.
2. Invoke RPC from the Backend: From your Python backend, use perform_rpc
to send the update. For example:
await room.local_participant.perform_rpc(
destination_identity=client_identity,
method="client.updateForm",
payload=json.dumps({"action": "updateField", "field": "role", "value": "Engineer"})
)
1. Handle Updates in the Frontend: Once the frontend receives this, you can process the payload to update your DOM, React state, or any other UI components accordingly.
If you'd like, I’m here to help with more detailed examples or to walk you through your specific setup. Just let me know!
Sources: complex-agents/role-playing/agents/base_agent.py | Docs::Home | agent-console/app/_components/participant-action-panel.tsx | Docs::Home | livekit-rtc/livekit/rtc/participant.py