p
hi
t
Thanks for reaching out, adit-kulkarni. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi — welcome to LiveKit support! How can I help you today? You can tell me: • What you’re trying to build or fix (brief description), • Any error messages, SDK/language, and environment (browser, mobile, server), • Room ID, session details, or steps to reproduce (if relevant). If you’re not sure where to start, say whether you need help with: connecting to a room, audio/video issues, recording, TURN/STUN, authentication, or billing.
p
i have an ios frontend and am using a python agent. i have added the "gemini-2.5-flash-native-audio-preview-09-2025" model and want to add a tool call. my tool call should simply creare a feedback card to correct the user's speech if they have said something wrong. when the tool call is complete, what is the appropriate channel to listen for this update and trigger my frontend ios to create a visual display from the result of the tool call
t
Thanks — you're asking which channel to listen on in your iOS frontend so a Python agent's tool call (that creates a feedback card) can trigger a visual display. Use LiveKit's RPC/data channel: have the Python agent publish a JSON RPC-style data packet when the tool finishes, and register an RPC/data handler on the iOS client to receive it. Recommended flow (concise): 1. Python agent (tool) — on completion publish data:
Copy code
await context.room.local_participant.publish_data(
  json.dumps({
    "method": "create_feedback_card",
    "params": {"message": corrected_text}
  }),
  kind=rtc.DataPacketKind.RELIABLE
)
1. iOS frontend — register a handler for that RPC/data and update UI on the main thread:
Copy code
room.localParticipant?.registerRPCHandler { [weak self] invocation in
  guard invocation.method == "create_feedback_card",
        let params = invocation.params as? [String:Any],
        let message = params["message"] as? String else { return }
  DispatchQueue.main.async {
    self?.createFeedbackCard(message: message)
  }
}
Notes: • Use
DataPacketKind.RELIABLE
for guaranteed delivery of the feedback card payload. • Ensure the agent has permission to publish data and the iOS participant is connected and listening. • If you want lower latency and can tolerate drops,
UNRELIABLE
is an option, but
RELIABLE
is recommended for UI updates. If you want, I can: • Share a complete minimal Python agent tool snippet that includes error handling, or • Show how to parse additional fields (e.g., confidence, timestamps) in the iOS handler. Which would you prefer? Sources: Tool definition and use | LiveKit docs