How to monitor a LiveKit booking agent in production
LiveKit agent monitoring for booking and reception lines. Send every session out over OpenTelemetry and find the calls that went wrong in the words.
LiveKit agent monitoring for booking and reception lines. Send every session out over OpenTelemetry and find the calls that went wrong in the words.
On a booking line, the call that loses you a customer usually has fine latency. The agent confirmed an appointment the calendar never offered, or read a phone number back wrong. Most LiveKit agent monitoring wouldn't notice, because it watches time to first token, end-of-turn delay and interruptions. Amiril, which is what we build, reads agent traces and points you at the runs that went wrong. With no setup, it flags a call where the agent states a time or a phone number that no tool returned and the caller never said.
The failures that cost a booking line are ordinary ones, and builders describe them on LiveKit's own forum. A team building in Norwegian wrote that their realtime model "struggles a lot" with phone numbers. It got stuck in a loop where the caller says 12345 and the agent asks "did you say 12346?" Another builder found the agent offering a Sunday appointment when the availability tool had returned Thursday, Friday and Saturday, in half of their test cases.
Then there's the agent that asks for the same detail three times until the caller gets short with it, and the caller who asks for a person, twice, while the agent keeps going with the booking.
LiveKit's own answer is Agent insights. Pick a session and you get the transcript, the spans, the logs and the audio lined up on one timeline, with dashboards alongside for latency, traffic and usage per agent. A made-up appointment doesn't move any of those dashboards, since the tool calls go through and the response times are ordinary. It keeps that data for 30 days after the session ends and then deletes it. LiveKit staff have said of exporting it that "the request to export data is a common one we see". It also has no opinion about which session you ought to be opening, so in practice you open the one somebody complained about.
Past that, people tend to reach for a general trace store or a call QA product. Langfuse is a trace store that publishes a LiveKit guide, and once the data is in you write your own queries. Cekura and Roark are call QA products, where you define metrics and every call is scored against them. Cekura vs Amiril goes through where each one acts.
LiveKit Agents already traces every session with OpenTelemetry, so all you have to do is give it somewhere to send the spans.
pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
from livekit.agents.telemetry import set_tracer_provider
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import ReadableSpan, SpanProcessor, TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
class FlushWhenJobEnds(SpanProcessor):
"""Sends a job's spans when its root span ends, the last span the job records."""
def __init__(self, provider: TracerProvider) -> None:
self.provider = provider
def on_end(self, span: ReadableSpan) -> None:
if span.name == "job_entrypoint":
self.provider.force_flush()
def start_tracing() -> TracerProvider:
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
provider.add_span_processor(FlushWhenJobEnds(provider))
set_tracer_provider(provider)
return providerCall start_tracing() from the setup_fnc you pass to AgentServer, not from your entrypoint. LiveKit opens each call's root span before the entrypoint runs. The exporter reads the standard OpenTelemetry variables, and both values come from the Data page in Amiril (the LiveKit guide in our docs shows where to find them):
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="<OpenTelemetry traces endpoint>" export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf" export OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer <your API key>"
Nothing else in the agent changes. Each call arrives as one run with its turns in order, and each turn carries the tool calls made during it, arguments and results included. The agent is named after your Agent class in snake case, so FrontDeskAgent shows up as front_desk_agent.
If the transcripts are sensitive, as a clinic's will be, there are two switches. LiveKit's set_tracer_provider has an allow_pii argument that controls whether the words of the call go into the spans at all, and Amiril has its own Store message text setting. The checks and topics described below read the words, so they need the text, while rarity factors work without it.
The checks run on every call without thresholds, and the only step that needs you is labelling a topic.
The invented appointment and the wrong phone number are caught the same way. Every run gets a grounding check, which looks for a time, a date or a phone number that the agent stated and that no tool result or earlier message contains. Say find_slots comes back with 10:00 and 4:15 and the agent then says "I can do 2:30 on Thursday". The 2:30 is flagged. Runs that fail the check are grouped into an issue, with a title such as "Stated a phone number the user did not give", and a failed grounding check is Critical, the highest severity.
The agent that keeps asking for the same detail is caught by a different check, which reads the caller's side. It fires when a caller says they've already given something. A separate check does the same for a caller who is frustrated or angry.
The ignored request for a person is harder. Callers ask for a person all day and many of them are transferred, which is the line doing its job, so the request alone can't be the signal. That is why it's only a note on the run. What separates the bad calls is topics. Amiril writes a one-sentence summary of every call, groups calls with similar summaries into run topics, and names each topic after what its calls have in common. When a topic turns up whose calls all describe a request that went nowhere, you label it Bad. From then on any new call landing in that topic goes up for review and joins a single issue.
All of it ends up on the Issues page, where runs with the same problem are grouped into one issue, so a hundred misread numbers would be one row with a count beside it. Each issue has a short write-up of what its runs share, written by an AI investigator that reads a sample of them. If you've connected Slack, a new issue at High severity or above is posted to your channel when it forms.
Rules in Amiril check tool calls. The one below blocks a booking for any slot the availability check didn't return, which is the Sunday case from the forum:
@id("booked-slot-was-offered")
@sentence("{slot} was not one of the times the availability check returned")
block (
agent,
tool == "book_appointment"
)
unless {
any(latest(find_slots{}).result.slots, it == call.args.slot)
};In that rule agent on its own means every agent, and latest(find_slots{}) is the most recent find_slots call in the run. The field names (result.slots, args.slot) are this example's, so use your own tools' names.
A new rule starts in Shadow. Publish it and, while it stays in Shadow, it blocks nothing. Amiril replays it over the traces you're already sending, and the rule's page shows how many calls it would have fired on in the last 24 hours. Enforcing a rule means adding the Amiril SDK to the agent's process. The SDK checks each call against its own copy of the rules, so a check never waits on the network in the middle of a call. There's another post on why monitoring and rules are one product, and one on voice agent booking failures with rules for wrong dates and double bookings.
If you run a booking line on LiveKit, connect a trace source and leave it for a day of real calls before you look at the Issues page.