How to Test LiveKit RPC and Voice Agent UI Sync - Zian AI

How to Test LiveKit RPC and Voice Agent UI Sync

Quick answer: Test LiveKit RPC and UI sync at three levels: unit-test the UI tool call with LiveKit’s pytest or Vitest helpers, integration-test the RPC, lk.transcription and lk.agent.state channels with a headless participant in a real room, then assert timing. Keep payloads under 15 KiB and pass every timeout explicitly (docs: 10 seconds; livekit-client 2.25.0: 15).

Read on 24 November 2026 against livekit-agents 1.8.13 (Python, released 18 November 2026), the livekit 1.2.1 Python RTC SDK that release pins, livekit-api 1.2.3, and livekit-client 2.25.0 (JavaScript, released 20 November 2026). Node.js agents are on @livekit/agents 1.10.1. Every Python snippet below was executed or import-checked, and each section says exactly what it was run against.

A voice agent with a screen has two outputs that must agree: what it says and what the screen shows. LiveKit moves UI state four ways: remote procedure calls (RPC) for actions that need an answer, text streams on lk.transcription for captions, participant attributes such as lk.agent.state for the speaking indicator, and data packets for anything high-frequency. Each fails differently, and none of LiveKit’s first-party testing tools exercises all four over WebRTC to a React, Swift or Kotlin frontend. This page is the test plan for that gap.

Where Zian fits: an AI agents platform, not a voice framework

If you are building on LiveKit because you need a custom screen experience, the plan on this page is the work. If what you actually need is an agent that answers calls 24/7, qualifies, books and follows up, Zian is the platform that skips that build. Zian AI is a standalone AI sales and reception agents platform, not a phone system (carrier / CPaaS / contact centre) and not an add-on to one. Nor is it a framework you assemble and test yourself.

Zian’s agents answer inbound calls as an AI receptionist, run outbound follow-up, handle answering machines and voicemail, work in 30+ languages with voice cloning, and can be deployed as a private model on your own infrastructure. Its PrecisionPitch AI™ engine split-tests scripts against real outcomes, and Zian reports 64,521+ qualified sales appointments set. Zian is in a partnership-application beta; each of its three listed plans, including Intel + Widgets (Free Forever), starts with a partnership application, and no prices are published. If you want the outcome without running any platform, LeadsNow.ai is the done-for-you option: a pay-per-result managed appointment-setting service that runs on Zian, with 50,769+ appointments set and leads answered in under 60 seconds, 24/7.

How can I test LiveKit RPC events and visual UI synchronisation for a voice agent?

Split the job by what each level can physically see. LiveKit’s unit-test page is explicit that “Testing doesn’t make a LiveKit room connection”, and that get_job_context() “is unavailable in test environments and raises a RuntimeError when called”. The forwarding pattern LiveKit documents for sending a tool call to the frontend starts with get_job_context().room. So a unit test can prove the agent decided to update the screen with the right arguments, but it can never prove the screen updated. That needs a room.

Level What runs What it proves What it cannot see Cost per run
1. Unit test (pytest / Vitest) AgentSession.run() in text mode, UI tools mocked with mock_tools The UI tool was called, with the right arguments, and the agent’s next sentence matches the tool’s result, including on failure The RPC hop, payload limits, timeouts, transcription timing, attribute updates. No room exists Seconds; LLM tokens only (none with a scripted LLM)
2. Integration test (headless participant) Your real agent dispatched into a LiveKit room, plus a Python participant that registers the frontend’s RPC methods and records every event The RPC arrives with a payload that fits, the frontend’s answer gets back, captions and state arrive, and in which order Rendering. It proves the data reached a client, not that your components drew it One room session; real call minutes if audio is on
3. Timing assertions (on the level-2 log) Pure functions over the recorded, timestamped event log The screen changed before the agent said it had; the state indicator settled; interim captions were replaced by finals Anything not in the log, so log every channel Free once the log exists

Run level 1 on every commit and level 2 on every merge and before each release. A test level only proves what it executed: a unit test that mocked the UI tool has proved nothing about the frontend. That is the same principle as our plan for testing an AI voice agent before go-live, applied to the data path instead of the audio path.

What are LiveKit’s RPC limits today, and where do the docs and the SDK disagree?

LiveKit’s RPC page is short and precise. Method names “can be any string, up to 64 bytes long (UTF-8)”. Requests and responses “support a string payload, with a maximum size of 15KiB (UTF-8)”. performRpc times out, and “The default timeout is 10 seconds”. Handlers that want to return a custom error throw an RpcError with a numeric code, and “Codes 1001-1999 are reserved for LiveKit internal errors”. Any other exception in a handler reaches the caller as “a generic 1500 Application Error”.

The client SDK has moved on from parts of that page, and a test plan has to be written against what the SDK does. Here is each limit, the documented value, what the source we read says, and how to assert it.

Limit LiveKit RPC docs (read 24 Nov 2026) SDK source / release notes How to assert it
Method name Up to 64 bytes, UTF-8 Not checked separately in the files we read Keep names short and ASCII (ui.showBookingCard); a unit test over your method-name constants
Payload size 15KiB (UTF-8), request and response livekit-client 2.25.0: 15,360 bytes enforced only when the remote peer is on the original (v1) protocol; newer peers get the payload as a data stream on topic lk.rpc_request. v2.19.0 (13 May 2026) added support for “infinite payload length” Assert the UTF-8 byte length of your worst-case payload is at or under 15,360 unless every peer is on a v2-capable SDK
Default response timeout 10 seconds livekit-client 2.25.0: responseTimeout defaults to 15,000 ms; release v2.15.10 (14 October 2025) raised the total to 15 s and the connection timeout to 7 s. The Rust core’s main branch also defaults to 15 s Always pass a timeout; never let a test depend on a default the docs and the SDK disagree on
Minimum timeout Not stated livekit-client docstring: values under 8,000 ms are “automatically clamped to 8000ms”; in the 2.25.0 source the clamp applies to the deadline sent to the handler Assert on the error code you actually receive, not on the number you passed
Acknowledgement (connection) timeout Not stated as a number 7,000 ms in livekit-client 2.25.0; Python perform_rpc(max_round_trip_latency=...) “Defaults to 7 seconds” A recipient that never acknowledges takes up to 7 s to surface as 1501; your tool must not leave the caller in silence that long
Error codes 1400–1404 and 1500–1505 livekit-client 2.24.1 (14 November 2026) added 1506 CONNECTION_CLOSED, raised when the local participant disconnects; the Python SDK we read (1.2.1) has no 1506 Match on the codes your SDK version defines; treat unknown codes as failures, not as success
Who may call “Hidden participants cannot call RPC methods” LiveKit’s Agent Console page says observers join as hidden participants and that “sending text and executing RPC calls is permitted” Do not make your test harness a hidden participant if it needs to call the agent; if you need an observer, test the call path once both ways

Two of those rows deserve a sentence each. The 1506 code matters for UI tests because, before livekit-client 2.24.1, a pending call “stayed pending until its responseTimeout, then rejected with RESPONSE_TIMEOUT” when the caller disconnected (release notes, v2.24.1). A test that asserts 1502 on disconnect will start failing on upgrade, which is the right outcome but a confusing one. And the hidden-participant rows are two LiveKit pages that disagree on their face; we have not resolved that on LiveKit’s behalf, so the matrix below tells you to test it.

Which LiveKit channel should drive which part of the UI?

The easiest UI-sync bug to write is a channel used for a job it was not built for: state pushed through attributes ten times a second, or a caption stream read once and then read again. LiveKit documents a limit and a delivery rule for each channel, and each one is a test.

Channel Typical UI job Documented limit Delivery rule that matters for tests
RPC (performRpc / perform_rpc) Show a booking card, open a form, ask the browser for location; any action that needs an answer 15KiB payload, 64-byte method name (docs) One caller, one recipient, one response or one error code
Text streams, topic lk.transcription Live captions for the caller and the agent sendText has “no limit on string size”; receivers cap at max_payload_byte_length, default 5 GB Interim and final streams share a segment_id; “Replace interim messages with the final message when lk.transcription_final is true”. Late joiners get nothing already in flight; no persistence
Participant attribute lk.agent.state The listening / thinking / speaking indicator Attributes 64 KiB combined across keys and values; metadata 512 KiB Attributes “are not suitable for high-frequency updates (more than once every few seconds)”. The agent SDK writes this one for you
Custom participant attributes Which tool is running, a toggle the user flips Same 64 KiB Needs canUpdateOwnMetadata in the token to write; delete a key by setting it to an empty string
Data packets Cursor-speed or progress updates Reliable: up to 15KiB per packet. Lossy: 1,300 bytes recommended, to stay inside a 1,400-byte MTU Reliable is “best-effort”: a receiver that is briefly disconnected misses the packet, and the server does not buffer it

There is one honest tension in that table. LiveKit says attributes are not for updates more often than every few seconds, yet its own agent state indicator is an attribute that can change several times inside one turn. Reading livekit-agents 1.8.13’s room_io.py, the SDK cancels an in-flight lk.agent.state update when a newer state arrives, so the last update a frontend receives is the latest state, and intermediate states can be skipped. Write your tests the same way: assert that the indicator settles on listening or idle after the agent stops talking, and never assert that the frontend saw thinking on a fast turn.

The Said-Equals-Shown Matrix: every UI event, how it fails, how to assert it

This is the matrix to copy into your test plan. Each row is one event type and one failure mode, with the level that can catch it and the assertion that proves it. Every limit in it is sourced to LiveKit’s own documentation or SDK source in the table at the end of this page.

Event type Failure mode Level How to assert it
Agent→frontend RPC Wrong tool or wrong arguments (date in the wrong year, wrong service) 1 is_function_call(name=..., arguments=...) with the UI tool mocked
Agent→frontend RPC Agent says “it’s on your screen” when the RPC failed 1 Mock the tool to raise; assert is_error on the output and that the next message does not claim success
Agent→frontend RPC Method not registered yet when the agent calls (1400) 2 Dispatch the agent only after the harness has registered; add one test that calls before registration and expects 1400
Agent→frontend RPC Payload over 15 KiB on a v1 peer (1402 request / 1504 response) 1 and 2 Byte-length assertion on the worst-case payload; one level-2 test with an oversized payload expecting the error
Agent→frontend RPC Frontend handler slow or crashed (1502, 1500) 2 A harness handler that sleeps past the timeout, and one that throws; assert the code and that the agent recovers in speech
Agent→frontend RPC Recipient not in the room (1401) or never acknowledges (1501) 2 Call an identity that is not in the room and expect 1401; a missed acknowledgement is hard to provoke, so assert that your tool’s own timeout and spoken fallback fire before the 7 s acknowledgement window ends
Frontend→agent RPC Agent not registered, or the caller is a hidden participant 2 Call the agent’s method from a visible harness and from a hidden one; record both outcomes
Caption stream lk.transcription Duplicated lines (interim and final both rendered) 3 Fold by lk.segment_id, keep the final; assert one line per segment
Caption stream Caption shows words the agent never spoke (after an interruption) 2 and 3 Interrupt mid-sentence; assert the final caption is a prefix of the scripted reply, not the whole reply
Caption stream Read fails partway (sender left, full reconnect) 2 Catch rtc.StreamError in Python; assert it is logged, never swallowed
Agent state lk.agent.state Indicator stuck on speaking or thinking 3 Last state after the last caption is listening or idle, within a budget you set
Agent state UI depends on a raw state that is skipped on fast turns 3 Assert only settled states; use the getters canListen and isFinished in the UI
Any channel UI updates after the agent claims it has (the voice runs ahead of the screen) 3 The Claim-After-Render rule below: RPC arrival time is at or before the first caption containing the claim

The Claim-After-Render rule is the one assertion we would keep if we could keep only one: the agent may only say the screen has changed after the RPC that changes it has returned. Everything else in the matrix is a limit or an error code. This rule is about trust, because a caller who is told to “tap the green button” before it exists will stop believing the agent.

Unit tests: assert the UI tool call without a room

The pattern LiveKit documents for forwarding a tool call to the frontend is a @function_tool that reaches get_job_context().room and calls perform_rpc. Here is that pattern as a booking-card tool, written against livekit-agents 1.8.13.

import json
from livekit.agents import Agent, RunContext, function_tool, get_job_context
from livekit.agents.llm import ToolError


class Assistant(Agent):
    def __init__(self) -> None:
        super().__init__(instructions="You book appointments and show a booking card on screen.")

    @function_tool()
    async def show_booking_card(self, context: RunContext, slot_iso: str, service: str) -> str:
        """Show the booking card for the chosen slot in the caller's app."""
        room = get_job_context().room  # raises RuntimeError under the test framework
        identity = next(iter(room.remote_participants))
        try:
            return await room.local_participant.perform_rpc(
                destination_identity=identity,
                method="ui.showBookingCard",
                payload=json.dumps({"slot": slot_iso, "service": service}),
                response_timeout=5.0,
            )
        except Exception:
            raise ToolError("The booking card could not be shown")

Because the test framework has no room, you mock the tool. LiveKit’s mock_tools helper overrides one or more tools for an agent class inside a with block; “Returning an Error from a mock makes the tool raise”. That gives you both halves of the Claim-After-Render rule at level 1: the success path, and the path where the screen could not be updated.

import pytest
from livekit.agents import AgentSession, mock_tools
from agent import Assistant
from fake_llm import ScriptedLLM

ARGS = {"slot_iso": "2026-11-24T10:00:00+11:00", "service": "consult"}


@pytest.mark.asyncio
async def test_ui_tool_called_with_right_arguments() -> None:
    async with AgentSession(llm=ScriptedLLM()) as session:
        await session.start(Assistant())
        with mock_tools(Assistant, {"show_booking_card": lambda slot_iso, service: '{"shown": true}'}):
            result = await session.run(user_input="Book me Tuesday at 10")
        result.expect.next_event().is_function_call(name="show_booking_card", arguments=ARGS)
        out = result.expect.next_event().is_function_call_output()
        assert out.event().item.is_error is False
        msg = result.expect.next_event().is_message(role="assistant")
        assert "on screen" in msg.event().item.text_content
        result.expect.no_more_events()


@pytest.mark.asyncio
async def test_ui_rpc_failure_is_spoken_honestly() -> None:
    async with AgentSession(llm=ScriptedLLM()) as session:
        await session.start(Assistant())
        with mock_tools(Assistant, {"show_booking_card": lambda: RuntimeError("1502 Response timeout")}):
            result = await session.run(user_input="Book me Tuesday at 10")
        result.expect.next_event().is_function_call(name="show_booking_card")
        out = result.expect.next_event().is_function_call_output()
        assert out.event().item.is_error is True
        msg = result.expect.next_event().is_message(role="assistant")
        text = msg.event().item.text_content.lower()
        assert "couldn't" in text or "could not" in text, text  # the reply admits the failure

What we ran it against: these tests ran under pytest 9.2.0 and pytest-asyncio 1.5.0 on livekit-agents 1.8.13, and both passed. To make them run offline and deterministically, ScriptedLLM is a short stub of llm.LLM that calls the tool on the first turn and answers from the tool’s output on the second. In your own suite, pass inference.LLM(...) as LiveKit’s examples do, and add a .judge(llm, intent=...) on the message instead of the substring check. As a negative control, the same test with the slot year changed to 2025 raised an AssertionError, so the argument check is doing work. A second control, a stub that answered “Done, it’s on your screen now.” after the failed call, made the honesty test fail, so that check is doing work too.

One finding from running it is worth knowing before you rely on a green suite. We ran a third test with the tool not mocked. The real tool hit get_job_context(), the RuntimeError was caught by the framework, and the tool output the model saw was the string “An internal error occurred”. The turn then completed normally, so a test that only asserts is_function_call passes even though the UI path is broken. Always assert is_function_call_output() and its is_error flag as well. In the same 1.8.13 source, get_job_context(required=False) returns None instead of raising, which is a cleaner seam if you would rather inject a fake room than mock the whole tool.

The payload limit is a level-1 test with a trap in it. Python’s json.dumps escapes non-ASCII by default, so a two-byte “é” goes on the wire as six bytes (\u00e9). Assert len(payload.encode("utf-8")) of the exact string you send against 15,360, and pass ensure_ascii=False. In our run, a booking payload with 8,000 accented characters had fewer than 15,360 characters but more than 15,360 bytes: the case a character count misses.

For the general mechanics of tool calls, timeouts and what the caller hears while a function runs, see our comparison of voice agent APIs with built-in function calling; it records that LiveKit function tools have no framework timeout unless you add one, which is why the RPC tool above passes response_timeout itself.

Integration tests: a headless participant that stands in for the frontend

Level 2 needs a real room and something on the other side that behaves like your frontend. A headless Python participant does that well: it joins with a token, registers the same RPC method names as your React or mobile app, listens to lk.transcription, watches lk.agent.state, and timestamps everything. Dispatch your agent explicitly through the token’s room configuration so it joins after the harness has registered its methods, which removes the 1400 race from every test except the one that is meant to provoke it.

# Headless "frontend" participant for an integration test (livekit 1.2.1 / livekit-api 1.2.3).
import asyncio, json, os, time
from livekit import api, rtc

EVENTS: list[dict] = []          # every UI-relevant event, timestamped on arrival


def log(kind: str, **kw) -> None:
    EVENTS.append({"t": time.monotonic(), "kind": kind, **kw})


async def join(room_name: str, agent_name: str) -> rtc.Room:
    token = (api.AccessToken()            # reads LIVEKIT_API_KEY / LIVEKIT_API_SECRET
             .with_identity("ui-harness")
             .with_grants(api.VideoGrants(room_join=True, room=room_name))
             .with_room_config(api.RoomConfiguration(
                 agents=[api.RoomAgentDispatch(agent_name=agent_name)]))
             .to_jwt())
    room = rtc.Room()

    @room.on("participant_attributes_changed")
    def _attrs(changed: dict, participant: rtc.Participant) -> None:
        if "lk.agent.state" in changed:
            log("state", value=changed["lk.agent.state"])

    def _on_transcript(reader: rtc.TextStreamReader, identity: str) -> None:
        async def read() -> None:
            a = reader.info.attributes or {}
            try:
                text = await reader.read_all()
            except rtc.StreamError as e:
                log("stream_error", error=str(e)); return
            log("transcript", who=identity, text=text, segment=a.get("lk.segment_id"),
                final=a.get("lk.transcription_final") == "true")
        asyncio.create_task(read())

    room.register_text_stream_handler("lk.transcription", _on_transcript)
    await room.connect(os.environ["LIVEKIT_URL"], token)

    @room.local_participant.register_rpc_method("ui.showBookingCard")
    async def _show(data: rtc.RpcInvocationData) -> str:
        log("rpc", method="ui.showBookingCard", payload=json.loads(data.payload),
            timeout=data.response_timeout)
        return json.dumps({"shown": True})

    return room

Three details in that file come straight from LiveKit’s pages. The Python text-stream handler is a plain function that starts a task, and “nothing acts on a failure you don’t catch”, so the rtc.StreamError branch is not optional. A reader “can only be consumed once”, so read it in full or incrementally, never both. And Python has no pre-registration on the room, so the method is registered on local_participant right after connecting; the JavaScript SDK can register before joining, which is what your real frontend should do.

What we ran it against: we did not run the harness against a LiveKit server for this page. We imported it under livekit 1.2.1 and livekit-api 1.2.3 and checked every SDK call it makes against the installed signatures (register_rpc_method, register_text_stream_handler, TextStreamReader.read_all, AccessToken.with_room_config, RoomAgentDispatch). Treat it as a starting file that needs one run against your own project before it becomes a gate.

Your test then drives one scripted turn (for example, text on the lk.chat topic the agent listens to), waits for the state to settle, and hands EVENTS to the level-3 checks. Repeat with audio on before release: with audio output disabled, LiveKit says text responses are sent “without speech synchronization”, so caption timing is only real with speech.

Timing assertions that catch a UI lagging the voice

Level 3 is pure functions over the event log, so they run in CI on the log your harness just wrote and again on logs saved from staging when a tester reports “the card showed up late”.

# Pure checks over the harness event log, so they can run against a saved log too.
def final_agent_text(events, agent_identity):
    segs = {}
    for e in events:                       # a later final replaces interim text per segment
        if e["kind"] == "transcript" and e["who"] == agent_identity:
            if e["final"] or e["segment"] not in segs:
                segs[e["segment"]] = e["text"]
    return " ".join(segs.values())


def assert_ui_before_claim(events, agent_identity, phrase, max_lead_s=0.0):
    rpc = next((e for e in events if e["kind"] == "rpc"), None)
    claim = next((e for e in events if e["kind"] == "transcript" and e["who"] == agent_identity
                  and phrase in e["text"]), None)
    assert claim is not None, f"agent never said {phrase!r}"
    assert rpc is not None, f"agent said {phrase!r} but no UI RPC arrived"
    lead = rpc["t"] - claim["t"]
    assert lead <= max_lead_s, f"UI updated {lead:.2f}s after the agent claimed it"
    return -lead


def assert_state_settles(events, expected=("listening", "idle"), within_s=3.0):
    states = [e for e in events if e["kind"] == "state"]
    assert states, "no lk.agent.state change observed"
    last_speech = max((e["t"] for e in events if e["kind"] == "transcript"), default=states[0]["t"])
    after = [e for e in states if e["t"] >= last_speech]
    assert after and after[-1]["value"] in expected, f"state ended as {states[-1]['value']}"
    assert after[-1]["t"] - last_speech <= within_s, "state took too long to settle"

What we ran it against: two hand-built JSONL logs. In the good log the RPC arrives at 0.42 s and the final caption containing “on screen” closes at 1.90 s; the check passed with 1.48 s to spare, and the interim caption “Your booking card” was correctly replaced by its final. In the bad log the agent says the card is on screen at 1.90 s and the RPC arrives at 3.40 s; the check failed with “UI updated 1.50s after the agent claimed it”, and the settle check failed because the last state was still speaking. The 3-second settle budget in our example is ours, not LiveKit’s: set it from your own measured turns. One limit of the harness as written: it timestamps a caption when its stream closes, and in livekit-agents 1.8.13 the agent’s speech for a segment is one text stream that closes when the segment ends, so the check can pass when the card arrives after the claim was spoken but before the sentence finished. For a stricter check, read the stream incrementally (async for chunk in reader) and timestamp the chunk that completes the phrase.

Three timing facts from LiveKit shape what those budgets mean. Captions for agent speech are synchronised to playback by default, “displaying text word by word as it speaks”, and if the agent is interrupted, the transcription “stops and is truncated to match the spoken output”, so the timestamp of a caption is close to when the caller heard it. Word-level timing depends on the TTS: LiveKit lists Cartesia, ElevenLabs, Rime and Speechify plugins as supporting word-level transcription timing, and says other providers, including LiveKit Inference, are aligned at the sentence level. And an RPC to a recipient that never acknowledges can take the full 7-second acknowledgement window to fail, which is far longer than a caller will sit in silence, so give the tool its own short timeout and a spoken fallback.

Record the caller-side clock, not the agent’s: LiveKit’s simulation docs note that the agent measures when it started producing audio and the caller when they heard it, and “The difference between the two is what the user perceives.”

What LiveKit’s simulations and Agent Console can and cannot do for UI sync

LiveKit’s Agent Simulations run your real agent against an LLM-driven simulated user, in text mode by default or over audio, and they now support Node.js agents (@livekit/agents 1.6.0 or later) as well as Python (1.6.6 or later), with LiveKit CLI v2.19.0 or later. They are the right tool for whole-conversation outcomes, and the wrong tool for the frontend data path. The simulated user “joins with the identity simulation-” followed by the job ID “and a single attribute, lk.simulator, set to true”, and the simulator does not set job metadata, room metadata or participant attributes. We could not find any statement, on the three simulation pages we read on 24 November 2026 (the overview, Write a scenario and Run in CI), that the simulated user registers your frontend’s RPC methods. Until LiveKit says otherwise, treat a UI-RPC tool as untested in a simulation, and use the session-scoped form of mock_tools (Python only) so the tool returns a deterministic result there. The reasons voice agent evals pass while real calls fail apply here too: a simulation that mocked the UI has said nothing about the UI.

Simulations also have a budget: 15 run in parallel per run by default, 30 per project, and the free Build plan includes 350 text turns and 60 audio turns a month, after which new runs of that type fail.

Agent Console is the interactive tool, and it can fire RPCs at your agent, but its own page says “only outbound RPC calls are supported from the console”, with responding to inbound calls promised “In an upcoming release”. So it can test frontend→agent methods by hand; it cannot yet stand in for a frontend that answers the agent. That is the sentence on LiveKit’s pages that most weakens this page’s case for a hand-built harness, and when that release ships, re-check whether the console covers your agent→frontend rows.

LiveKit’s third testing tool, the CLI Agent Debugger, prints each turn’s tool calls with their arguments and results, and by default “doesn’t connect to a LiveKit room”. It sits at level 1: it shows that the UI tool fired, not that a frontend received it.

Rather not build and maintain this harness? Zian runs AI sales and reception agents across voice calls, SMS, email, WhatsApp, Instagram DMs and Facebook Messenger, with API and CRM integrations (HubSpot, Salesforce, HighLevel, Zapier), in a partnership-application beta.

Apply For Partnership

Frequently asked questions

Can I unit test a LiveKit tool that calls perform_rpc?

Yes, but not the RPC itself. LiveKit’s unit-test documentation says testing doesn’t make a LiveKit room connection and that get_job_context() raises a RuntimeError in test environments. Mock the tool with mock_tools, assert its name and arguments, and assert whether its output is an error. Test the RPC hop itself with a headless participant in a real room.

What is the maximum RPC payload size in LiveKit?

LiveKit’s RPC page says 15 KiB (UTF-8) for requests and responses, and 64 bytes for method names. livekit-client 2.25.0 enforces 15,360 bytes only when the other peer is on the original v1 protocol, and sends larger payloads to newer peers as a data stream. Keep payloads under 15 KiB unless every peer is on a v2-capable SDK, and count bytes, not characters.

What is the default performRpc timeout?

LiveKit’s RPC page says 10 seconds. The livekit-client 2.25.0 source defaults to 15,000 ms with a 7,000 ms acknowledgement timeout, a change its v2.15.10 release notes describe, and its docstring says values under 8,000 ms are clamped. Because the two disagree, pass a timeout on every call and assert on the error code you receive.

Why does my frontend RPC fail with error 1400?

Code 1400 is UNSUPPORTED_METHOD: the method was not registered at the destination when the call arrived. In tests it usually means the agent called before the frontend registered. Register before joining in JavaScript, or straight after connecting in Python, and dispatch the agent only after registration.

How do I show the agent’s listening, thinking and speaking state in my UI?

Read the lk.agent.state participant attribute, or use the SDK getters such as canListen and isFinished. The agent reports initializing, idle, listening, thinking and speaking; the client adds connecting, pre-connect-buffering, disconnected and failed. In tests, assert the state the indicator settles on, because livekit-agents 1.8.13 cancels an in-flight state update when a newer state arrives.

Do LiveKit Agent Simulations test my UI RPC calls?

Not as far as LiveKit documents. The simulated user is a standard participant with a single lk.simulator attribute, and the simulator sets no job metadata, room metadata or participant attributes. We found no mention of RPC on the simulation pages we read on 24 November 2026. Mock UI tools in simulations and test the RPC path with a headless participant.

Where every figure on this page comes from

Figure Who published it Link Date read
Method names up to 64 bytes; payload 15KiB; default timeout 10 seconds; codes 1001–1999 reserved; 1500 for uncaught handler errors; built-in codes 1400–1404 and 1500–1505; hidden participants cannot call RPC LiveKit docs.livekit.io/transport/data/rpc 24 November 2026
responseTimeout default 15,000 ms; 7,000 ms acknowledgement timeout; 8,000 ms clamp; 15,360-byte v1 limit; v2 RPC over data streams; error 1506 LiveKit (livekit-client 2.25.0 source, published to npm 20 November 2026) github.com/livekit/client-sdk-js 24 November 2026
15 s total and 7 s connection timeout (v2.15.10, 14 Oct 2025); clamp under 8 s (v2.15.11); “infinite payload length” (v2.19.0, 13 May 2026); 1506 CONNECTION_CLOSED (v2.24.1, 14 Nov 2026) LiveKit (client-sdk-js release notes) github.com/livekit/client-sdk-js/releases 24 November 2026
Python max_round_trip_latency defaults to 7 seconds; Python error codes (no 1506) LiveKit (livekit Python SDK 1.2.1 and 1.3.0 source) github.com/livekit/python-sdks 24 November 2026
Rust core RPC default response timeout 15 s and round-trip 7 s (main branch) LiveKit (rust-sdks, livekit-rpc crate) github.com/livekit/rust-sdks 24 November 2026
Forwarding tool calls via RPC with get_job_context().room and response_timeout LiveKit docs.livekit.io/agents/logic/tools/forwarding 24 November 2026
Testing makes no room connection; get_job_context() raises RuntimeError; mock_tools; returning an Error makes the tool raise LiveKit docs.livekit.io/testing/unit-tests 24 November 2026
lk.transcription topic; lk.transcribed_track_id, lk.segment_id, lk.transcription_final; synchronised and truncated on interruption; word-level timing for Cartesia, ElevenLabs, Rime, Speechify; no speech synchronisation with audio off LiveKit docs.livekit.io/agents/multimodality/text 24 November 2026
sendText no size limit; 5 GB default receive cap; read once; StreamError; no mid-stream join; no persistence LiveKit docs.livekit.io/transport/data/text-streams 24 November 2026
Attributes 64 KiB; metadata 512 KiB; not for updates more than once every few seconds; canUpdateOwnMetadata LiveKit docs.livekit.io/transport/data/state/participant-attributes 24 November 2026
Reliable packets up to 15KiB; lossy 1,300 bytes within a 1,400-byte MTU; reliable is best-effort LiveKit docs.livekit.io/transport/data/packets 24 November 2026
Agent states and getters (canListen, isFinished); lk.agent.state attribute LiveKit docs.livekit.io/frontends/build/agent-state 24 November 2026
Agent-side states initializing, idle, listening, thinking, speaking; in-flight state update cancelled by a newer one; get_job_context(required=False) LiveKit (livekit-agents 1.8.13 source, PyPI 18 November 2026) pypi.org/project/livekit-agents 24 November 2026
Simulations: Node.js 1.6.0+ and Python 1.6.6+, CLI v2.19.0; 15 per run, 30 per project; simulated user has one attribute; no metadata or attributes set LiveKit docs.livekit.io/testing/simulations 24 November 2026
Build plan: 350 text turns and 60 audio turns of simulation a month LiveKit docs.livekit.io/deploy/admin/quotas-and-limits 24 November 2026
Agent Console: outbound RPC only; observers may send text and execute RPC LiveKit docs.livekit.io/testing/agent-console 24 November 2026
The Said-Equals-Shown Matrix, the Claim-After-Render rule, the three-level plan, the 3-second settle budget, and the test results reported above (unit tests, payload test, fixture logs) Zian AI, original to this page Run on livekit-agents 1.8.13, livekit 1.2.1, pytest 9.2.0; reproduce with the code shown 24 November 2026
Zian capabilities and 64,521+ appointments; LeadsNow.ai pay-per-result, 50,769+ appointments, under 60 seconds 24/7 Zian AI; LeadsNow.ai zian.ai; leadsnow.ai 24 November 2026

Want the agent without owning the test rig? Zian’s AI receptionist and appointment setters answer, qualify, book and follow up across calls, SMS, email, WhatsApp, Instagram DMs and Facebook Messenger, in 30+ languages.

Apply For Partnership

Related Blogs

Related from Zian AI