跳到正文
LiveKit 產品與工程博客·· 4 天前AI 評分56

LiveKit Cloud API 教學:三種改善語音智能體的方法

Three ways to improve your voice agent with the LiveKit Cloud API

AI 導讀

LiveKit 説明如何透過 LiveKit Cloud API 改善語音智能體,包括找出影響最多通話的問題、逐回合排查故障,以及發掘來電者尚未能完成的需求。API 讓編碼智能體讀取通話逐字稿、日誌、追蹤資料和錄音;LiveKit 在自家的文件助理上分析過去一週 4,321 個工作階段,整理出 8 項排序問題。

正文

We recently launched the LiveKit Cloud API, which lets your coding agent read the transcripts, logs, traces, and recordings from your voice agent's calls.

This post walks through three ways to use it to improve your voice agent, and how to turn what it finds into a fix.

Before you startLink to this section

You'll need:

  • A voice agent on LiveKit Cloud that has taken calls with Agent Observability turned on.
  • The admin role on the project.
  • LiveKit CLI 2.19.4 or later.

Update the CLI, sign in, and install the LiveKit skills:

On Linux or Windows? See the CLI docs.

Then open your coding agent in your voice agent's repo. If you work across several projects, name the project in your prompt. Otherwise the CLI uses your default project.

1. Fix the issues that hit the most callsLink to this section

A coding agent asked "What are the most common issues this week?" runs lk analytics session list --limit 100 --json, flags 142 sessions where the caller interrupted the agent, and concludes that callers interrupt long answers.

Try pasting something like this into your coding agent:

You'll get back something like this:

IssueCallsLikely causeSuggested fix
Dead air while checking order status61 of 412lookup_order takes 4 seconds on averageSay a short filler while the tool runs
Callers cut in during confirmation numbers38 of 412The agent reads 12 digits in one breathRead numbers in chunks and confirm each
Callers ask for a human after return questions27 of 412No return policy in the agent's instructionsAdd the policy and a returns tool

We ran this prompt on LiveKit's own docs assistant. Our coding agent read 4,321 sessions from the past week and came back after about 30 minutes of work with 8 ranked issues. It found that 28% of sessions were automated traffic, that slow turns came from chained tool calls, and which doc topics people asked about but couldn't get answers to.

Tip

If your agent takes a lot of calls, start with a sample, like the last 100 sessions or the last 24 hours. Your coding agent reads every transcript it pulls, so a smaller set is faster and uses fewer tokens. The biggest issues show up in a sample anyway.

2. Get to the bottom of a bad callLink to this section

A coding agent asked "What went wrong with session RM_aXHZ4Q7?" runs lk analytics session traces RM_aXHZ4Q7 --json, finds the find_order tool timed out at 2,000 ms, and reports the root cause: find_order timed out at turn 2.

Sometimes you already know which call went wrong. Grab its session ID from the Sessions page in LiveKit Cloud, or ask your coding agent to find it with lk analytics session list. Then ask:

Your coding agent lines up what the caller said with what your agent did, turn by turn. Because each turn carries its own timing, it can tell you whether a long pause came from the model, the voice, or a tool.

3. Find what to build nextLink to this section

A coding agent asked "What are the most common questions we get?" runs lk analytics session list --limit 500 --json, reads 500 transcripts, and reports the top reason callers get in touch: order status, 38% of calls.

Your transcripts don't only show what's broken. They also show what callers want that your agent can't do yet. Ask:

This is how you find the next tool to build, the knowledge your agent is missing, or a language more of your callers are speaking. It's also a quick way to cut the number of calls that end with "Can I talk to a person?"

Then fix it, and prove the fixLink to this section

Once you've picked something to fix, have your coding agent turn the real call into a test before it touches the code:

Your coding agent writes the scenario from the real conversation, replays it locally against your agent, makes the change, and shows you the diff and the results before anything ships. The scenario stays in your repo, so if a later change breaks the same thing, you'll know before it reaches production.

When you're happy with the fix, ask it to deploy. Then run the first prompt again next week and see what moved.

Try it on your agentLink to this section

Run the setup, open your coding agent, and paste in the first prompt. Fix the top issue on the list, prove the fix with a scenario, and ship it.

來源:LiveKit 產品與工程博客 · livekit.com