[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-livekit--agents-js":3,"tool-livekit--agents-js":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":80,"owner_email":80,"owner_twitter":76,"owner_website":81,"owner_url":82,"languages":83,"stars":99,"forks":100,"last_commit_at":101,"license":102,"difficulty_score":23,"env_os":103,"env_gpu":104,"env_ram":104,"env_deps":105,"category_tags":118,"github_topics":80,"view_count":23,"oss_zip_url":80,"oss_zip_packed_at":80,"status":16,"created_at":119,"updated_at":120,"faqs":121,"releases":150},2263,"livekit\u002Fagents-js","agents-js","Build realtime multimodal AI agents with Node.js","agents-js 是一个基于 Node.js 的开源框架，专为构建实时、多模态的 AI 智能体而设计。它让开发者能够轻松创建具备“看、听、理解”能力的语音助手，这些智能体作为可编程参与者运行在服务器端，通过 WebRTC 技术与用户进行低延迟的自然对话。\n\n该工具主要解决了在 Node.js 生态中难以高效搭建复杂实时语音交互系统的痛点。以往开发者可能需要自行处理繁琐的音频流传输、打断检测及多服务集成，而 agents-js 提供了一套完整的解决方案，支持灵活组合各类语音识别（STT）、大语言模型（LLM）和语音合成（TTS）服务。其独特的技术亮点包括基于 Transformer 模型的语义轮次检测，能精准判断用户何时说完，从而大幅减少对话中的不当打断；同时支持通过 RPC 机制与客户端无缝交换数据。\n\nagents-js 非常适合后端开发者、全栈工程师以及希望将 AI 语音能力集成到现有应用中的技术团队使用。无论是开发客服机器人、虚拟陪伴助手还是交互式教育应用，借助其丰富的插件生态（如支持 OpenAI、Google、ElevenLabs 等主流服务），用户都能快速原型验证并部署属","agents-js 是一个基于 Node.js 的开源框架，专为构建实时、多模态的 AI 智能体而设计。它让开发者能够轻松创建具备“看、听、理解”能力的语音助手，这些智能体作为可编程参与者运行在服务器端，通过 WebRTC 技术与用户进行低延迟的自然对话。\n\n该工具主要解决了在 Node.js 生态中难以高效搭建复杂实时语音交互系统的痛点。以往开发者可能需要自行处理繁琐的音频流传输、打断检测及多服务集成，而 agents-js 提供了一套完整的解决方案，支持灵活组合各类语音识别（STT）、大语言模型（LLM）和语音合成（TTS）服务。其独特的技术亮点包括基于 Transformer 模型的语义轮次检测，能精准判断用户何时说完，从而大幅减少对话中的不当打断；同时支持通过 RPC 机制与客户端无缝交换数据。\n\nagents-js 非常适合后端开发者、全栈工程师以及希望将 AI 语音能力集成到现有应用中的技术团队使用。无论是开发客服机器人、虚拟陪伴助手还是交互式教育应用，借助其丰富的插件生态（如支持 OpenAI、Google、ElevenLabs 等主流服务），用户都能快速原型验证并部署属于自己的实时 AI 智能体，且完全掌控数据隐私与服务架构。","\u003C!--\nSPDX-FileCopyrightText: 2024 LiveKit, Inc.\n\nSPDX-License-Identifier: Apache-2.0\n-->\n\n\u003C!--BEGIN_BANNER_IMAGE-->\n\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"\u002F.github\u002Fbanner_dark.png\">\n  \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"\u002F.github\u002Fbanner_light.png\">\n  \u003Cimg style=\"width:100%;\" alt=\"The LiveKit icon, the name of the repository and some sample code in the background.\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flivekit_agents-js_readme_4d8f7ff420c3.png\">\n\u003C\u002Fpicture>\n\n\u003C!--END_BANNER_IMAGE-->\n\n# LiveKit Agents for Node.js\n\n\u003C!--BEGIN_DESCRIPTION-->\n\nThe Agent Framework is designed for building realtime, programmable participants that run on\nservers. Use it to create conversational, multi-modal voice agents that can see, hear, and\nunderstand.\n\nThis is a Node.js distribution of the [LiveKit Agents framework](https:\u002F\u002Flivekit.io\u002Fagents),\noriginally written in Python.\n\n\u003C!--END_DESCRIPTION-->\n\n## ✨ 1.0 Release ✨\n\nThis README reflects the 1.0 release. See the [migration guide](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fstart\u002Fv0-migration\u002Fnodejs\u002F) if you're trying to upgrade from `0.x`.\n\n## Features\n\n- **Flexible integrations**: A comprehensive ecosystem to mix and match the right STT, LLM, TTS, and Realtime API to suit your use case.\n- **Extensive WebRTC clients**: Build client applications using LiveKit's open-source SDK ecosystem, supporting all major platforms.\n- **Exchange data with clients**: Use [RPCs](https:\u002F\u002Fdocs.livekit.io\u002Fhome\u002Fclient\u002Fdata\u002Frpc\u002F) and other [Data APIs](https:\u002F\u002Fdocs.livekit.io\u002Fhome\u002Fclient\u002Fdata\u002F) to seamlessly exchange data with clients.\n- **Semantic turn detection**: Uses a transformer model to detect when a user is done with their turn, helps to reduce interruptions.\n- **Open-source**: Fully open-source, allowing you to run the entire stack on your own servers, including [LiveKit server](https:\u002F\u002Fgithub.com\u002Flivekit\u002Flivekit), one of the most widely used WebRTC media servers.\n\n## Installation\n\nThe framework includes a variety of plugins that make it easy to process streaming input or generate\noutput. For example, there are plugins for converting text-to-speech or running inference with\npopular LLMs.\n\n- Install `pnpm` if you haven't already:\n\n```bash\nnpm install -g pnpm\n```\n\nTo install the core Agents library as well as plugins, run:\n\n```bash\npnpm install @livekit\u002Fagents\n```\n\nCurrently, only the following plugins are supported:\n\n| Plugin                                                                                               | Features      |\n| ---------------------------------------------------------------------------------------------------- | ------------- |\n| [@livekit\u002Fagents-plugin-openai](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-openai)         | LLM, TTS, STT |\n| [@livekit\u002Fagents-plugin-google](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-google)         | LLM, TTS      |\n| [@livekit\u002Fagents-plugin-deepgram](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-deepgram)     | STT, TTS      |\n| [@livekit\u002Fagents-plugin-elevenlabs](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-elevenlabs) | TTS           |\n| [@livekit\u002Fagents-plugin-cartesia](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-cartesia)     | TTS           |\n| [@livekit\u002Fagents-plugin-neuphonic](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-neuphonic)   | TTS           |\n| [@livekit\u002Fagents-plugin-resemble](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-resemble)     | TTS           |\n| [@livekit\u002Fagents-plugin-rime](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-rime)             | TTS           |\n| [@livekit\u002Fagents-plugin-inworld](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-inworld)       | TTS           |\n| [@livekit\u002Fagents-plugin-silero](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-silero)         | VAD           |\n| [@livekit\u002Fagents-plugin-livekit](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-livekit)       | EOU           |\n| [@livekit\u002Fagents-plugin-anam](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-anam)             | Avatar        |\n| [@livekit\u002Fagents-plugin-bey](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-bey)               | Avatar        |\n| [@livekit\u002Fagents-plugin-lemonslice](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-lemonslice) | Avatar        |\n| [@livekit\u002Fagents-plugin-xai](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-xai)               | LLM, TTS      |\n| [@livekit\u002Fagents-plugin-phonic](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-phonic)         | Realtime      |\n\n## Docs and guides\n\nDocumentation on the framework and how to use it can be found [here](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002F)\n\n## Recommended starter app\n\nKickstart a complete voice AI pipeline (LLM, STT, TTS) with the LiveKit Agents Starter for Node.js:\n\n- [livekit-examples\u002Fagent-starter-node](https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-node)\n\nIt includes a ready-made assistant, multilingual turn detection, background noise cancellation, metrics\u002Flogging, and a production-ready Dockerfile. Start fast, then tailor it with your preferred models and plugins.\n\n## Core concepts\n\n- Agent: An LLM-based application with defined instructions.\n- AgentSession: A container for agents that manages interactions with end users.\n- entrypoint: The starting point for an interactive session, similar to a request handler in a web server.\n- Worker: The main process that coordinates job scheduling and launches agents for user sessions.\n\n## Usage\n\nCheckout the [quickstart guide](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fstart\u002Fvoice-ai\u002F)\n\n### Simple voice agent\n\n---\n\n```ts\nimport {\n  type JobContext,\n  type JobProcess,\n  WorkerOptions,\n  cli,\n  defineAgent,\n  llm,\n  voice,\n  inference,\n} from '@livekit\u002Fagents';\nimport * as silero from '@livekit\u002Fagents-plugin-silero';\nimport { fileURLToPath } from 'node:url';\nimport { z } from 'zod';\n\nconst lookupWeather = llm.tool({\n  description: 'Used to look up weather information.',\n  parameters: z.object({\n    location: z.string().describe('The location to look up weather information for'),\n  }),\n  execute: async ({ location }, { ctx }) => {\n    return { weather: 'sunny', temperature: 70 };\n  },\n});\n\nexport default defineAgent({\n  prewarm: async (proc: JobProcess) => {\n    proc.userData.vad = await silero.VAD.load();\n  },\n  entry: async (ctx: JobContext) => {\n    const agent = new voice.Agent({\n      instructions: 'You are a friendly voice assistant built by LiveKit.',\n      tools: { lookupWeather },\n    });\n\n    const session = new voice.AgentSession({\n      \u002F\u002F Speech-to-text (STT) is your agent's ears, turning the user's speech into text that the LLM can understand\n      \u002F\u002F See all available models at https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002Fstt\u002F\n      stt: new inference.STT({ model: 'deepgram\u002Fnova-3', language: 'en' }),\n      \u002F\u002F A Large Language Model (LLM) is your agent's brain, processing user input and generating a response\n      \u002F\u002F See all available models at https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002Fllm\u002F\n      llm: new inference.LLM({ model: 'openai\u002Fgpt-4.1-mini' }),\n      \u002F\u002F Text-to-speech (TTS) is your agent's voice, turning the LLM's text into speech that the user can hear\n      \u002F\u002F See all available models as well as voice selections at https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002Ftts\u002F\n      tts: new inference.TTS({ model: 'cartesia\u002Fsonic-3', voice: '9626c31c-bec5-4cca-baa8-f8ba9e84c8bc' }),\n      \u002F\u002F VAD and turn detection are used to determine when the user is speaking and when the agent should respond\n      \u002F\u002F See more at https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fbuild\u002Fturns\n      vad: ctx.proc.userData.vad! as silero.VAD,\n      turnDetection: new livekit.turnDetector.MultilingualModel(),\n      \u002F\u002F to use realtime model, replace the stt, llm, tts and vad with the following\n      \u002F\u002F llm: new openai.realtime.RealtimeModel(),\n    });\n\n    await session.start({\n      agent,\n      room: ctx.room,\n    });\n\n    await session.generateReply({\n      instructions: 'greet the user and ask about their day',\n    });\n  },\n});\n\ncli.runApp(new WorkerOptions({ agent: fileURLToPath(import.meta.url) }));\n```\n\nNo third-party API keys are required for this example. It runs out of the box via the [LiveKit Inference Gateway](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002F#inference).\n\n### Multi-agent handoff\n\n---\n\nThis code snippet is abbreviated. For the full example, see [multi_agent.ts](examples\u002Fsrc\u002Fmulti_agent.ts)\n\n```ts\ntype StoryData = {\n  name?: string;\n  location?: string;\n};\n\nclass IntroAgent extends voice.Agent\u003CStoryData> {\n  constructor() {\n    super({\n      instructions: `You are a story teller. Your goal is to gather a few pieces of information from the user to make the story personalized and engaging. Ask the user for their name and where they are from.`,\n      tools: {\n        informationGathered: llm.tool({\n          description:\n            'Called when the user has provided the information needed to make the story personalized and engaging.',\n          parameters: z.object({\n            name: z.string().describe('The name of the user'),\n            location: z.string().describe('The location of the user'),\n          }),\n          execute: async ({ name, location }, { ctx }) => {\n            ctx.userData.name = name;\n            ctx.userData.location = location;\n\n            return llm.handoff({\n              agent: new StoryAgent(name, location),\n              returns: \"Let's start the story!\",\n            });\n          },\n        }),\n      },\n    });\n  }\n\n  \u002F\u002F Use inheritance to create agent with custom hooks\n  async onEnter() {\n    this.session.generateReply({\n      instructions: '\"greet the user and gather information\"',\n    });\n  }\n}\n\nclass StoryAgent extends voice.Agent\u003CStoryData> {\n  constructor(name: string, location: string) {\n    super({\n      instructions: `You are a storyteller. Use the user's information in order to make the story personalized.\n        The user's name is ${name}, from ${location}`,\n    });\n  }\n\n  async onEnter() {\n    this.session.generateReply();\n  }\n}\n\nexport default defineAgent({\n  prewarm: async (proc: JobProcess) => {\n    proc.userData.vad = await silero.VAD.load();\n  },\n  entry: async (ctx: JobContext) => {\n    await ctx.connect();\n    const participant = await ctx.waitForParticipant();\n    console.log('participant joined: ', participant.identity);\n\n    const userdata: StoryData = {};\n\n    const session = new voice.AgentSession({\n      vad: ctx.proc.userData.vad! as silero.VAD,\n      stt: new inference.STT({ model: 'deepgram\u002Fnova-3', language: 'en' }),\n      llm: new inference.LLM({ model: 'openai\u002Fgpt-4.1-mini' }),\n      tts: new inference.TTS({ model: 'cartesia\u002Fsonic-3', voice: '9626c31c-bec5-4cca-baa8-f8ba9e84c8bc' }),\n      userData: userdata,\n    });\n\n    await session.start({\n      agent: new IntroAgent(),\n      room: ctx.room,\n    });\n  },\n});\n```\n\n### Running your agent\n\nThe framework exposes a CLI interface to run your agent. To get started, you'll need the following\nenvironment variables set:\n\n- `LIVEKIT_URL`\n- `LIVEKIT_API_KEY`\n- `LIVEKIT_API_SECRET`\n- any additional provider API keys (e.g. `OPENAI_API_KEY`)\n\nThe following command will start the worker and wait for users to connect to your LiveKit server:\n\n```bash\npnpm run build && node .\u002Fexamples\u002Fsrc\u002Frestaurant_agent.ts dev\n```\n\n### Using playground for your agent UI\n\nTo ease the process of building and testing an agent, we've developed a versatile web frontend\ncalled \"playground\". You can use or modify this app to suit your specific requirements. It can also\nserve as a starting point for a completely custom agent application.\n\n- [Hosted playground](https:\u002F\u002Fagents-playground.livekit.io)\n- [Source code](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-playground)\n- [Playground docs](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fplayground)\n\n### Running for production\n\n```shell\npnpm run build && node .\u002Fexamples\u002Fsrc\u002Frestaurant_agent.ts start\n```\n\nRuns the agent with production-ready optimizations.\n\n### FAQ\n\n#### What happens when I run my agent?\n\nWhen you follow the steps above to run your agent, a worker is started that opens an authenticated\nWebSocket connection to a LiveKit server instance(defined by your `LIVEKIT_URL` and authenticated\nwith an access token).\n\nNo agents are actually running at this point. Instead, the worker is waiting for LiveKit server to\ngive it a job.\n\nWhen a room is created, the server notifies one of the registered workers about a new job.\nThe notified worker can decide whether or not to accept it. If the worker accepts the job, the\nworker will instantiate your agent as a participant and have it join the room where it can start\nsubscribing to tracks. A worker can manage multiple agent instances simultaneously.\n\nIf a notified worker rejects the job or does not accept within a predetermined timeout period, the\nserver will route the job request to another available worker.\n\n#### What happens when I SIGTERM a worker?\n\nThe orchestration system was designed for production use cases. Unlike the typical web server, an\nagent is a stateful program, so it's important that a worker isn't terminated while active sessions\nare ongoing.\n\nWhen calling SIGTERM on a worker, the worker will signal to LiveKit server that it no longer wants\nadditional jobs. It will also auto-reject any new job requests that get through before the server\nsignal is received. The worker will remain alive while it manages any agents connected to rooms.\n\n## Contributing\n\nTo contribute to this project:\n\n1. Fork the [agents-js repository](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js)\n2. Create a new branch based on the `main` branch\n3. Make your changes\n4. Submit a pull request\n5. Make sure to complete the pre-review checklist before tagging reviewers\n\n### Testing changes and plugins\n\nTo test any changes or plugins:\n\n1. Build the project:\n   ```bash\n   pnpm build\n   ```\n\n2. Edit `.\u002Fexamples\u002Fsrc\u002Fbasic_agent.ts` as necessary for any plugin changes\n\n3. Run the basic agent with debug logging:\n   ```bash\n   node .\u002Fexamples\u002Fsrc\u002Fbasic_agent.ts dev --log-level=debug\n   ```\n\n### Testing agent connectivity\n\nTo connect and talk to your agent:\n\n1. Go to the [LiveKit dashboard sandbox section](https:\u002F\u002Fcloud.livekit.io\u002Fprojects\u002F\u003Cyour-project-id>\u002Fsandbox)\n2. Launch a sandbox app called \"Web Voice Agent\"\n3. Run your agent and make sure all LiveKit API keys are configured correctly\n4. Click the \"START CALL\" blue button on the sandbox UI to test the connection and talk to your agent\n\n## License\n\nThis project is licensed under `Apache-2.0`, and is [REUSE-3.2](https:\u002F\u002Freuse.software) compliant.\nRefer to [the license](LICENSES\u002FApache-2.0.txt) for details.\n\n\u003C!--BEGIN_REPO_NAV-->\n\u003Cbr\u002F>\u003Ctable>\n\u003Cthead>\u003Ctr>\u003Cth colspan=\"2\">LiveKit Ecosystem\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\u003Ctd>Agents SDKs\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents\">Python\u003C\u002Fa> · \u003Cb>Node.js\u003C\u002Fb>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>LiveKit SDKs\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-js\">Browser\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-swift\">Swift\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-android\">Android\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-flutter\">Flutter\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-react-native\">React Native\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Frust-sdks\">Rust\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fnode-sdks\">Node.js\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fpython-sdks\">Python\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-unity\">Unity\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-unity-web\">Unity (WebGL)\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-esp32\">ESP32\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-cpp\">C++\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>Starter Apps\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-python\">Python Agent\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-node\">TypeScript Agent\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-react\">React App\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-swift\">SwiftUI App\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-android\">Android App\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-flutter\">Flutter App\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-react-native\">React Native App\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-embed\">Web Embed\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>UI Components\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fcomponents-js\">React\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fcomponents-android\">Android Compose\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fcomponents-swift\">SwiftUI\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fcomponents-flutter\">Flutter\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>Server APIs\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fnode-sdks\">Node.js\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fserver-sdk-go\">Golang\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fserver-sdk-ruby\">Ruby\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fserver-sdk-kotlin\">Java\u002FKotlin\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fpython-sdks\">Python\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Frust-sdks\">Rust\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fagence104\u002Flivekit-server-sdk-php\">PHP (community)\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FpabloFuente\u002Flivekit-server-sdk-dotnet\">.NET (community)\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>Resources\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fdocs.livekit.io\">Docs\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fdocs.livekit.io\u002Fmcp\">Docs MCP Server\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Flivekit-cli\">CLI\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fcloud.livekit.io\">LiveKit Cloud\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>LiveKit Server OSS\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Flivekit\">LiveKit server\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fegress\">Egress\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fingress\">Ingress\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fsip\">SIP\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>Community\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fcommunity.livekit.io\">Developer Community\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Flivekit.io\u002Fjoin-slack\">Slack\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fx.com\u002Flivekit\">X\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fwww.youtube.com\u002F@livekit_io\">YouTube\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003C!--END_REPO_NAV-->\n","\u003C!--\nSPDX-FileCopyrightText: 2024 LiveKit, Inc.\n\nSPDX-License-Identifier: Apache-2.0\n-->\n\n\u003C!--BEGIN_BANNER_IMAGE-->\n\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"\u002F.github\u002Fbanner_dark.png\">\n  \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"\u002F.github\u002Fbanner_light.png\">\n  \u003Cimg style=\"width:100%;\" alt=\"The LiveKit icon, the name of the repository and some sample code in the background.\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flivekit_agents-js_readme_4d8f7ff420c3.png\">\n\u003C\u002Fpicture>\n\n\u003C!--END_BANNER_IMAGE-->\n\n# LiveKit Agents for Node.js\n\n\u003C!--BEGIN_DESCRIPTION-->\n\nAgent 框架旨在构建运行在服务器上的实时可编程参与者。使用它来创建能够看见、听见并理解的对话式多模态语音助手。\n\n这是 [LiveKit Agents 框架](https:\u002F\u002Flivekit.io\u002Fagents) 的 Node.js 版本，最初是用 Python 编写的。\n\n\u003C!--END_DESCRIPTION-->\n\n## ✨ 1.0 发布 ✨\n\n本 README 反映的是 1.0 版本。如果您正尝试从 `0.x` 升级，请参阅[迁移指南](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fstart\u002Fv0-migration\u002Fnodejs\u002F)。\n\n## 特性\n\n- **灵活的集成**：一个全面的生态系统，可以根据您的用例自由组合合适的 STT、LLM、TTS 和实时 API。\n- **丰富的 WebRTC 客户端**：使用 LiveKit 的开源 SDK 生态系统构建客户端应用，支持所有主流平台。\n- **与客户端交换数据**：使用 [RPC](https:\u002F\u002Fdocs.livekit.io\u002Fhome\u002Fclient\u002Fdata\u002Frpc\u002F) 和其他 [数据 API](https:\u002F\u002Fdocs.livekit.io\u002Fhome\u002Fclient\u002Fdata\u002F) 与客户端无缝交换数据。\n- **语义轮次检测**：采用 Transformer 模型检测用户何时结束发言，有助于减少打断。\n- **开源**：完全开源，允许您在自己的服务器上运行整个堆栈，包括 [LiveKit 服务器](https:\u002F\u002Fgithub.com\u002Flivekit\u002Flivekit)，这是最常用的 WebRTC 媒体服务器之一。\n\n## 安装\n\n该框架包含多种插件，便于处理流式输入或生成输出。例如，有用于文本转语音或与流行 LLM 进行推理的插件。\n\n- 如果尚未安装 `pnpm`，请先安装：\n\n```bash\nnpm install -g pnpm\n```\n\n要安装核心 Agents 库以及插件，请运行：\n\n```bash\npnpm install @livekit\u002Fagents\n```\n\n目前仅支持以下插件：\n\n| 插件                                                                                               | 功能      |\n| ---------------------------------------------------------------------------------------------------- | ------------- |\n| [@livekit\u002Fagents-plugin-openai](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-openai)         | LLM、TTS、STT |\n| [@livekit\u002Fagents-plugin-google](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-google)         | LLM、TTS      |\n| [@livekit\u002Fagents-plugin-deepgram](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-deepgram)     | STT、TTS      |\n| [@livekit\u002Fagents-plugin-elevenlabs](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-elevenlabs) | TTS           |\n| [@livekit\u002Fagents-plugin-cartesia](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-cartesia)     | TTS           |\n| [@livekit\u002Fagents-plugin-neuphonic](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-neuphonic)   | TTS           |\n| [@livekit\u002Fagents-plugin-resemble](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-resemble)     | TTS           |\n| [@livekit\u002Fagents-plugin-rime](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-rime)             | TTS           |\n| [@livekit\u002Fagents-plugin-inworld](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-inworld)       | TTS           |\n| [@livekit\u002Fagents-plugin-silero](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-silero)         | VAD           |\n| [@livekit\u002Fagents-plugin-livekit](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-livekit)       | EOU           |\n| [@livekit\u002Fagents-plugin-anam](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-anam)             | 阿凡达        |\n| [@livekit\u002Fagents-plugin-bey](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-bey)               | 阿凡达        |\n| [@livekit\u002Fagents-plugin-lemonslice](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-lemonslice) | 阿凡达        |\n| [@livekit\u002Fagents-plugin-xai](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-xai)               | LLM、TTS      |\n| [@livekit\u002Fagents-plugin-phonic](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@livekit\u002Fagents-plugin-phonic)         | 实时      |\n\n## 文档和指南\n\n关于框架及其使用方法的文档可以在这里找到：[https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002F](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002F)\n\n## 推荐的入门应用\n\n使用 LiveKit Agents Node.js 入门项目快速启动完整的语音 AI 流程（LLM、STT、TTS）：\n\n- [livekit-examples\u002Fagent-starter-node](https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-node)\n\n它包含一个现成的助手、多语言轮次检测、背景噪声消除、指标\u002F日志记录，以及一个生产就绪的 Dockerfile。您可以快速开始，然后根据自己的偏好选择模型和插件进行定制。\n\n## 核心概念\n\n- Agent：基于 LLM 的应用程序，具有明确的指令。\n- AgentSession：用于管理与最终用户交互的代理容器。\n- entrypoint：交互会话的起点，类似于 Web 服务器中的请求处理器。\n- Worker：负责协调作业调度并为用户会话启动代理的主要进程。\n\n## 使用方法\n\n请查看[快速入门指南](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fstart\u002Fvoice-ai\u002F)\n\n### 简单的语音代理\n\n---\n\n```ts\nimport {\n  type JobContext,\n  type JobProcess,\n  WorkerOptions,\n  cli,\n  defineAgent,\n  llm,\n  voice,\n  inference,\n} from '@livekit\u002Fagents';\nimport * as silero from '@livekit\u002Fagents-plugin-silero';\nimport { fileURLToPath } from 'node:url';\nimport { z } from 'zod';\n\nconst lookupWeather = llm.tool({\n  description: '用于查询天气信息。',\n  parameters: z.object({\n    location: z.string().describe('要查询天气信息的位置'),\n  }),\n  execute: async ({ location }, { ctx }) => {\n    return { weather: 'sunny', temperature: 70 };\n  },\n});\n\nexport default defineAgent({\n  prewarm: async (proc: JobProcess) => {\n    proc.userData.vad = await silero.VAD.load();\n  },\n  entry: async (ctx: JobContext) => {\n    const agent = new voice.Agent({\n      instructions: '你是由 LiveKit 构建的友好语音助手。',\n      tools: { lookupWeather },\n    });\n\n    const session = new voice.AgentSession({\n      \u002F\u002F 语音转文本（STT）是代理的“耳朵”，将用户的语音转换为 LLM 可以理解的文本\n      \u002F\u002F 可用模型请参见 https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002Fstt\u002F\n      stt: new inference.STT({ model: 'deepgram\u002Fnova-3', language: 'en' }),\n      \u002F\u002F 大型语言模型（LLM）是代理的“大脑”，处理用户输入并生成响应\n      \u002F\u002F 可用模型请参见 https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002Fllm\u002F\n      llm: new inference.LLM({ model: 'openai\u002Fgpt-4.1-mini' }),\n      \u002F\u002F 文本转语音（TTS）是代理的“声音”，将 LLM 的文本转换为用户可以听到的语音\n      \u002F\u002F 可用模型及语音选项请参见 https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002Ftts\u002F\n      tts: new inference.TTS({ model: 'cartesia\u002Fsonic-3', voice: '9626c31c-bec5-4cca-baa8-f8ba9e84c8bc' }),\n      \u002F\u002F VAD 和发言轮次检测用于判断用户何时在说话以及代理何时应该回应\n      \u002F\u002F 更多信息请参见 https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fbuild\u002Fturns\n      vad: ctx.proc.userData.vad! as silero.VAD,\n      turnDetection: new livekit.turnDetector.MultilingualModel(),\n      \u002F\u002F 若要使用实时模型，可将 STT、LLM、TTS 和 VAD 替换为以下内容：\n      \u002F\u002F llm: new openai.realtime.RealtimeModel(),\n    });\n\n    await session.start({\n      agent,\n      room: ctx.room,\n    });\n\n    await session.generateReply({\n      instructions: '问候用户并询问他们今天过得如何',\n    });\n  },\n});\n\ncli.runApp(new WorkerOptions({ agent: fileURLToPath(import.meta.url) }));\n```\n\n此示例无需任何第三方 API 密钥。它通过 [LiveKit 推理网关](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002F#inference) 即可开箱即用。\n\n### 多代理交接\n\n---\n\n此代码片段已简化。完整示例请参阅 [multi_agent.ts](examples\u002Fsrc\u002Fmulti_agent.ts)\n\n```ts\ntype StoryData = {\n  name?: string;\n  location?: string;\n};\n\nclass IntroAgent extends voice.Agent\u003CStoryData> {\n  constructor() {\n    super({\n      instructions: `你是一名说书人。你的目标是从用户那里收集一些信息，使故事更加个性化和引人入胜。请向用户询问他们的姓名和来自哪里。`,\n      tools: {\n        informationGathered: llm.tool({\n          description:\n            '当用户提供了使故事个性化和引人入胜所需的信息时调用。',\n          parameters: z.object({\n            name: z.string().describe('用户的姓名'),\n            location: z.string().describe('用户的所在地'),\n          }),\n          execute: async ({ name, location }, { ctx }) => {\n            ctx.userData.name = name;\n            ctx.userData.location = location;\n\n            return llm.handoff({\n              agent: new StoryAgent(name, location),\n              returns: \"让我们开始讲故事吧！\",\n            });\n          },\n        }),\n      },\n    });\n  }\n\n  \u002F\u002F 使用继承创建带有自定义钩子的代理\n  async onEnter() {\n    this.session.generateReply({\n      instructions: '\"问候用户并收集信息\"',\n    });\n  }\n}\n\nclass StoryAgent extends voice.Agent\u003CStoryData> {\n  constructor(name: string, location: string) {\n    super({\n      instructions: `你是一名说书人。请利用用户的提供的信息使故事更具个性化。\n        用户的名字是 ${name}, 来自 ${location}`,\n    });\n  }\n\n  async onEnter() {\n    this.session.generateReply();\n  }\n}\n\nexport default defineAgent({\n  prewarm: async (proc: JobProcess) => {\n    proc.userData.vad = await silero.VAD.load();\n  },\n  entry: async (ctx: JobContext) => {\n    await ctx.connect();\n    const participant = await ctx.waitForParticipant();\n    console.log('参与者加入：', participant.identity);\n\n    const userdata: StoryData = {};\n\n    const session = new voice.AgentSession({\n      vad: ctx.proc.userData.vad! as silero.VAD,\n      stt: new inference.STT({ model: 'deepgram\u002Fnova-3', language: 'en' }),\n      llm: new inference.LLM({ model: 'openai\u002Fgpt-4.1-mini' }),\n      tts: new inference.TTS({ model: 'cartesia\u002Fsonic-3', voice: '9626c31c-bec5-4cca-baa8-f8ba9e84c8bc' }),\n      userData: userdata,\n    });\n\n    await session.start({\n      agent: new IntroAgent(),\n      room: ctx.room,\n    });\n  },\n});\n```\n\n### 运行您的代理\n\n该框架提供了一个 CLI 界面来运行您的代理。要开始使用，您需要设置以下环境变量：\n\n- `LIVEKIT_URL`\n- `LIVEKIT_API_KEY`\n- `LIVEKIT_API_SECRET`\n- 任何其他提供商的 API 密钥（例如 `OPENAI_API_KEY`）\n\n以下命令将启动工作进程，并等待用户连接到您的 LiveKit 服务器：\n\n```bash\npnpm run build && node .\u002Fexamples\u002Fsrc\u002Frestaurant_agent.ts dev\n```\n\n### 使用 Playground 构建代理 UI\n\n为了简化代理的构建和测试过程，我们开发了一个多功能的 Web 前端工具“Playground”。您可以根据自己的需求使用或修改此应用，它也可以作为完全自定义代理应用程序的起点。\n\n- [托管的 Playground](https:\u002F\u002Fagents-playground.livekit.io)\n- [源代码](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-playground)\n- [Playground 文档](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fplayground)\n\n### 生产环境运行\n\n```shell\npnpm run build && node .\u002Fexamples\u002Fsrc\u002Frestaurant_agent.ts start\n```\n\n此命令将以生产就绪的优化方式运行代理。\n\n### 常见问题解答\n\n#### 运行我的代理时会发生什么？\n\n按照上述步骤运行代理后，会启动一个工作进程，该进程会与 LiveKit 服务器实例建立经过身份验证的 WebSocket 连接（由你的 `LIVEKIT_URL` 定义，并使用访问令牌进行身份验证）。\n\n此时并没有实际运行的代理。相反，工作进程正在等待 LiveKit 服务器为其分配任务。\n\n当创建房间时，服务器会通知已注册的工作进程之一有新任务。被通知的工作进程可以决定是否接受该任务。如果工作进程接受任务，则会将你的代理实例化为参与者，并让其加入房间，从而开始订阅音视频轨道。一个工作进程可以同时管理多个代理实例。\n\n如果被通知的工作进程拒绝了任务，或者在预设的超时时间内未接受任务，服务器会将任务请求路由到另一个可用的工作进程。\n\n#### 当我向工作进程发送 SIGTERM 信号时会发生什么？\n\n编排系统专为生产环境设计。与典型的 Web 服务器不同，代理是一个有状态的程序，因此在活动会话进行中终止工作进程是非常重要的。\n\n当向工作进程发送 SIGTERM 信号时，工作进程会向 LiveKit 服务器表明它不再需要新的任务。同时，它还会自动拒绝任何在服务器收到信号之前到达的新任务请求。工作进程将继续保持运行状态，直到处理完所有连接到房间的代理。\n\n## 贡献\n\n要为该项目做出贡献：\n\n1. 分叉 [agents-js 仓库](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js)\n2. 基于 `main` 分支创建一个新的分支\n3. 进行更改\n4. 提交拉取请求\n5. 在标记评审人员之前，请确保完成预审核对清单。\n\n### 测试更改和插件\n\n要测试任何更改或插件：\n\n1. 构建项目：\n   ```bash\n   pnpm build\n   ```\n\n2. 根据插件更改的需要，编辑 `.\u002Fexamples\u002Fsrc\u002Fbasic_agent.ts`\n\n3. 使用调试日志运行基础代理：\n   ```bash\n   node .\u002Fexamples\u002Fsrc\u002Fbasic_agent.ts dev --log-level=debug\n   ```\n\n### 测试代理连接性\n\n要连接并与你的代理对话：\n\n1. 前往 [LiveKit 控制台沙盒部分](https:\u002F\u002Fcloud.livekit.io\u002Fprojects\u002F\u003Cyour-project-id>\u002Fsandbox)\n2. 启动名为“Web Voice Agent”的沙盒应用\n3. 运行你的代理，并确保所有 LiveKit API 密钥都已正确配置\n4. 点击沙盒界面中的蓝色“START CALL”按钮，以测试连接并与你的代理对话。\n\n## 许可证\n\n本项目采用 `Apache-2.0` 许可证，并符合 [REUSE-3.2](https:\u002F\u002Freuse.software) 标准。有关详细信息，请参阅 [许可证](LICENSES\u002FApache-2.0.txt)。\n\n\u003C!--BEGIN_REPO_NAV-->\n\u003Cbr\u002F>\u003Ctable>\n\u003Cthead>\u003Ctr>\u003Cth colspan=\"2\">LiveKit 生态系统\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\u003Ctd>代理 SDKs\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents\">Python\u003C\u002Fa> · \u003Cb>Node.js\u003C\u002Fb>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>LiveKit SDKs\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-js\">浏览器\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-swift\">Swift\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-android\">Android\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-flutter\">Flutter\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-react-native\">React Native\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Frust-sdks\">Rust\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fnode-sdks\">Node.js\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fpython-sdks\">Python\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-unity\">Unity\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-unity-web\">Unity (WebGL)\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-esp32\">ESP32\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fclient-sdk-cpp\">C++\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>入门应用\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-python\">Python 代理\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-node\">TypeScript 代理\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-react\">React 应用\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-swift\">SwiftUI 应用\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-android\">Android 应用\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-flutter\">Flutter 应用\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-react-native\">React Native 应用\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit-examples\u002Fagent-starter-embed\">网页嵌入\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>UI 组件\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fcomponents-js\">React\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fcomponents-android\">Android Compose\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fcomponents-swift\">SwiftUI\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fcomponents-flutter\">Flutter\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>服务器 API\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fnode-sdks\">Node.js\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fserver-sdk-go\">Golang\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fserver-sdk-ruby\">Ruby\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fserver-sdk-kotlin\">Java\u002FKotlin\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fpython-sdks\">Python\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Frust-sdks\">Rust\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fagence104\u002Flivekit-server-sdk-php\">PHP（社区版）\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FpabloFuente\u002Flivekit-server-sdk-dotnet\">.NET（社区版）\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>资源\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fdocs.livekit.io\">文档\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fdocs.livekit.io\u002Fmcp\">MCP 服务器文档\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Flivekit-cli\">CLI\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fcloud.livekit.io\">LiveKit 云\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>LiveKit 服务器开源软件\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Flivekit\">LiveKit 服务器\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fegress\">Egress\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fingress\">Ingress\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flivekit\u002Fsip\">SIP\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>社区\u003C\u002Ftd>\u003Ctd>\u003Ca href=\"https:\u002F\u002Fcommunity.livekit.io\">开发者社区\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Flivekit.io\u002Fjoin-slack\">Slack\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fx.com\u002Flivekit\">X\u003C\u002Fa> · \u003Ca href=\"https:\u002F\u002Fwww.youtube.com\u002F@livekit_io\">YouTube\u003C\u002Fa>\u003C\u002Ftd>\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003C!--END_REPO_NAV-->","# LiveKit Agents (Node.js) 快速上手指南\n\nLiveKit Agents for Node.js 是一个用于构建实时、可编程语音代理的框架。它允许开发者创建能够“看”、“听”和“理解”的多模态对话代理，运行在服务器端并通过 WebRTC 与客户端交互。\n\n## 环境准备\n\n在开始之前，请确保你的开发环境满足以下要求：\n\n*   **操作系统**: Linux, macOS 或 Windows (推荐 WSL2)\n*   **Node.js**: 建议安装最新 LTS 版本 (v18+)\n*   **包管理器**: 本项目推荐使用 `pnpm`\n*   **LiveKit 服务**: 需要一个可用的 LiveKit 服务器实例（可使用 LiveKit Cloud 或自托管）\n\n### 前置依赖安装\n\n如果尚未安装 `pnpm`，请先全局安装：\n\n```bash\nnpm install -g pnpm\n```\n\n## 安装步骤\n\n### 1. 初始化项目\n\n创建一个新的项目目录并初始化：\n\n```bash\nmkdir my-voice-agent\ncd my-voice-agent\npnpm init\n```\n\n### 2. 安装核心库与插件\n\n安装 LiveKit Agents 核心库。该框架采用插件化架构，你需要根据需求安装对应的模型插件（如 STT 语音转文字、LLM 大模型、TTS 文字转语音等）。\n\n安装核心库：\n\n```bash\npnpm install @livekit\u002Fagents\n```\n\n安装常用插件示例（以 OpenAI 和 Deepgram 为例）：\n\n```bash\npnpm install @livekit\u002Fagents-plugin-openai @livekit\u002Fagents-plugin-deepgram @livekit\u002Fagents-plugin-silero\n```\n\n> **注意**：如果你希望快速体验且不想配置第三方 API Key，可以使用 LiveKit 提供的推理网关（Inference Gateway），上述代码示例中默认使用了此方案，无需额外安装特定厂商的 SDK 即可运行基础示例。\n\n### 3. 配置环境变量\n\n在运行代理之前，需要设置以下环境变量。你可以创建一个 `.env` 文件或在终端中导出：\n\n```bash\nexport LIVEKIT_URL=ws:\u002F\u002Fyour-livekit-server:7880\nexport LIVEKIT_API_KEY=your_api_key\nexport LIVEKIT_API_SECRET=your_api_secret\n# 如果使用第三方模型（如 OpenAI），还需配置对应的 Key\n# export OPENAI_API_KEY=sk-...\n```\n\n## 基本使用\n\n以下是一个最简单的语音代理示例。该代理具备语音识别（STT）、大语言模型处理（LLM）和语音合成（TTS）能力，并包含一个查询天气的工具函数。\n\n新建文件 `agent.ts`，填入以下代码：\n\n```ts\nimport {\n  type JobContext,\n  type JobProcess,\n  WorkerOptions,\n  cli,\n  defineAgent,\n  llm,\n  voice,\n  inference,\n} from '@livekit\u002Fagents';\nimport * as silero from '@livekit\u002Fagents-plugin-silero';\nimport { fileURLToPath } from 'node:url';\nimport { z } from 'zod';\n\n\u002F\u002F 定义一个工具：查询天气\nconst lookupWeather = llm.tool({\n  description: 'Used to look up weather information.',\n  parameters: z.object({\n    location: z.string().describe('The location to look up weather information for'),\n  }),\n  execute: async ({ location }, { ctx }) => {\n    \u002F\u002F 此处仅为模拟返回，实际应用中可调用真实 API\n    return { weather: 'sunny', temperature: 70 };\n  },\n});\n\nexport default defineAgent({\n  \u002F\u002F 预加载资源（如 VAD 模型），提高启动速度\n  prewarm: async (proc: JobProcess) => {\n    proc.userData.vad = await silero.VAD.load();\n  },\n  entry: async (ctx: JobContext) => {\n    \u002F\u002F 定义代理角色和工具\n    const agent = new voice.Agent({\n      instructions: 'You are a friendly voice assistant built by LiveKit.',\n      tools: { lookupWeather },\n    });\n\n    \u002F\u002F 配置会话组件\n    const session = new voice.AgentSession({\n      \u002F\u002F STT: 将用户语音转为文本 (耳朵)\n      stt: new inference.STT({ model: 'deepgram\u002Fnova-3', language: 'en' }),\n      \u002F\u002F LLM: 处理逻辑并生成回复 (大脑)\n      llm: new inference.LLM({ model: 'openai\u002Fgpt-4.1-mini' }),\n      \u002F\u002F TTS: 将文本转为语音输出 (嘴巴)\n      tts: new inference.TTS({ model: 'cartesia\u002Fsonic-3', voice: '9626c31c-bec5-4cca-baa8-f8ba9e84c8bc' }),\n      \u002F\u002F VAD: 语音活动检测，判断用户何时说完\n      vad: ctx.proc.userData.vad! as silero.VAD,\n      \u002F\u002F 多语言轮次检测\n      turnDetection: new livekit.turnDetector.MultilingualModel(),\n    });\n\n    \u002F\u002F 启动会话\n    await session.start({\n      agent,\n      room: ctx.room,\n    });\n\n    \u002F\u002F 主动生成第一条回复\n    await session.generateReply({\n      instructions: 'greet the user and ask about their day',\n    });\n  },\n});\n\n\u002F\u002F 启动 Worker\ncli.runApp(new WorkerOptions({ agent: fileURLToPath(import.meta.url) }));\n```\n\n### 运行代理\n\n在开发模式下运行代理，它将连接到指定的 LiveKit 服务器并等待用户加入房间：\n\n```bash\npnpm run build && node .\u002Fagent.ts dev\n```\n\n运行成功后，你可以使用 LiveKit 提供的 [Playground](https:\u002F\u002Fagents-playground.livekit.io) 网页工具连接测试，或者使用任何集成 LiveKit SDK 的客户端应用加入房间与该代理对话。\n\n### 生产环境部署\n\n当准备就绪进行生产部署时，使用 `start` 命令以启用优化：\n\n```bash\npnpm run build && node .\u002Fagent.ts start\n```","一家在线教育公司希望为其语言学习 App 打造一款能实时纠正发音、进行多轮口语对话的 AI 外教，要求响应延迟极低且支持语音互动。\n\n### 没有 agents-js 时\n- 开发团队需手动拼接独立的语音识别（STT）、大模型（LLM）和语音合成（TTS）服务，导致代码耦合度高，维护困难。\n- 难以精准判断用户何时说完话，常出现 AI 打断用户或回应迟缓的尴尬情况，破坏对话流畅性。\n- 缺乏原生的 WebRTC 支持，处理实时音视频流时需自行搭建复杂的媒体服务器架构，研发周期长达数月。\n- 无法灵活切换不同的 AI 供应商插件，一旦某家服务波动，整个系统面临瘫痪风险且替换成本极高。\n\n### 使用 agents-js 后\n- 利用 agents-js 统一的框架轻松集成 OpenAI 或 Deepgram 等插件，通过 Node.js 快速构建出模块化的多模态对话代理。\n- 内置的语义轮次检测功能精准识别用户发言结束点，实现“零打断”的自然人机交互体验。\n- 基于 LiveKit 成熟的 WebRTC 生态，直接复用开源客户端 SDK，将实时音视频功能的开发时间从数月缩短至数周。\n- 支持热插拔式更换底层 AI 服务插件，团队可根据成本和效果动态调整策略，系统稳定性显著提升。\n\nagents-js 让开发者无需深陷底层媒体处理泥潭，专注于业务逻辑，即可低成本交付生产级的实时语音 AI 应用。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flivekit_agents-js_4d8f7ff4.png","livekit","LiveKit","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Flivekit_203a61cb.png","Open source WebRTC and realtime AI infrastructure",null,"https:\u002F\u002Flivekit.io","https:\u002F\u002Fgithub.com\u002Flivekit",[84,88,92,95],{"name":85,"color":86,"percentage":87},"TypeScript","#3178c6",99.6,{"name":89,"color":90,"percentage":91},"JavaScript","#f1e05a",0.2,{"name":93,"color":94,"percentage":91},"Shell","#89e051",{"name":96,"color":97,"percentage":98},"Dockerfile","#384d54",0,793,257,"2026-04-04T14:18:33","Apache-2.0","Linux, macOS, Windows","未说明",{"notes":106,"python":107,"dependencies":108},"该工具是基于 Node.js 的框架，非 Python 项目。需安装 pnpm 包管理器。运行需配置 LiveKit 服务器连接信息（URL, API Key, Secret）及第三方模型提供商的 API 密钥（如 OpenAI, Deepgram 等）。支持通过 LiveKit Inference Gateway 直接调用模型而无需本地 GPU，也可自行部署模型。建议使用官方提供的 Dockerfile 进行生产环境部署。","不适用 (基于 Node.js)",[109,110,111,112,113,114,115,116,117],"Node.js (LTS 版本推荐)","pnpm","@livekit\u002Fagents","@livekit\u002Fagents-plugin-openai","@livekit\u002Fagents-plugin-google","@livekit\u002Fagents-plugin-deepgram","@livekit\u002Fagents-plugin-elevenlabs","@livekit\u002Fagents-plugin-silero","zod",[55,13,15,54],"2026-03-27T02:49:30.150509","2026-04-06T08:10:26.088206",[122,127,132,137,142,146],{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},10393,"在 Cloud Run 上部署 Agent 时出现 'runner initialization timed out' 错误怎么办？","这通常是因为云环境启动较慢导致的超时。解决方案是增加启动超时时间（start up time）。确保你的配置允许更长的初始化时间，以便 Agent 在 Cloud Run 等受限环境中能成功完成初始化。","https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fissues\u002F235",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},10394,"遇到 'Cannot read properties of undefined (reading 'length')' 或 OpenAI 报错 'Invalid value for content: expected a string, got null' 如何解决？","这通常发生在消息内容为空时。可以在 `VoicePipelineAgent` 中添加 `beforeLLMCallback` 回调来过滤掉空消息。示例代码如下：\n```ts\nbeforeLLMCallback: async (agent, chatCtx) => {\n  return agent.llm.chat({\n    chatCtx: Object.assign(new llm.ChatContext(), {\n      ...chatCtx,\n      messages: chatCtx.messages.filter(\n        m => m.content || m.toolCalls || m.toolCallId || m.toolException\n      )\n    }),\n    fncCtx: agent.fncCtx\n  })\n}\n```\n此方法可防止将空内容发送给 LLM。","https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fissues\u002F233",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},10395,"使用 tsx 或 CommonJS 运行时遇到 'logger not initialized' 错误如何修复？","这是因为 logger 使用了模块级状态，而在 CommonJS 或某些打包工具下状态共享会失效。解决方法有两种：\n1. 在 `package.json` 中设置 `\"type\": \"module\"`，或将文件后缀改为 `.mts` 以强制使用 ESM。\n2. 如果必须使用 CommonJS 或 pnpm\u002Fyarn，可以在 `package.json` 中配置 `noHoist` 防止依赖提升冲突：\n```json\n\"pnpm\": {\n  \"packageExtensions\": {\n    \"@livekit\u002Fagents\": { \"nohoist\": true },\n    \"@livekit\u002Fagents-plugin-openai\": { \"nohoist\": true },\n    \"@livekit\u002Fagents-plugin-silero\": { \"nohoist\": true }\n  }\n}\n```\n同时确保 agents 版本 >= 0.4.5，OpenAI 插件版本 >= 0.6.0。","https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fissues\u002F147",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},10396,"使用 OpenAI Realtime API 时出现 'audio_end_ms: integer below minimum value' (-11) 错误是什么原因？","这是一个已知的 Bug，通常发生在音频流处理时序计算错误时，导致传递给 API 的结束时间为负数。该问题已在后续版本中修复，请确保将 `@livekit\u002Fagents` 及相关 OpenAI 插件升级到最新版本。如果问题依旧，检查是否在音频流未正式开始时就触发了结束事件。","https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fissues\u002F304",{"id":143,"question_zh":144,"answer_zh":145,"source_url":131},10397,"如何在 Agent 中正确初始化 VAD（语音活动检测）以避免重复加载？","建议在 `prewarm` 阶段预加载 VAD 模型，并在 `entry` 中从 `ctx.proc.userData` 获取实例，避免每次任务都重新加载。示例代码：\n```ts\nprewarm: async (proc: JobProcess) => {\n  proc.userData.vad = await silero.VAD.load();\n},\nentry: async (ctx: JobContext) => {\n  const vad = ctx.proc.userData.vad! as silero.VAD;\n  \u002F\u002F 使用 vad 实例...\n}\n```",{"id":147,"question_zh":148,"answer_zh":149,"source_url":126},10398,"LiveKit Agent 在部署到云端时需要开放特殊端口或配置白名单吗？","不需要。根据官方文档，Agent 部署时无需开放特殊端口。Agent 通过心跳机制（默认 8081 端口用于本地调试，但云端由 Worker 管理连接）与 LiveKit 服务器通信。Cloud Run 等环境只需确保容器能访问外网即可，无需在 LiveKit 仪表盘配置 IP 白名单。Agent 内部使用 WebRTC，但连接是由 LiveKit 服务器协调的，无需手动处理 UDP 端口映射。",[151,156,161,165,169,174,178,182,187,191,195,199,203,207,212,217,221,225,230,234],{"id":152,"version":153,"summary_zh":154,"released_at":155},107634,"@livekit\u002Fagents@1.2.3","### Patch Changes\n\n-   Fix worker draining behaviour - [#1180](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1180) ([@lukasIO](https:\u002F\u002Fgithub.com\u002FlukasIO))\n\n-   Fix Queue dropping falsy items - [#1190](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1190) ([@lukasIO](https:\u002F\u002Fgithub.com\u002FlukasIO))\n\n-   fix: Address 6 bugs from Detail scan (March 25) - [#1182](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1182) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n\n    -   inference\u002Fllm: pass abort signal to OpenAI SDK and check abort in outer streaming loop\n    -   llm\u002Ffallback_adapter: call tryRecovery() before throwing on mid-stream failure\n    -   openai\u002Frealtime: clear responseCreatedFutures on reconnect to prevent generateReply() hang\n    -   deepgram\u002Ftts: reject on network errors instead of swallowing them\n    -   cpu: remove Math.max clamp in cgroup v1 so fractional CPU limits are reported correctly\n    -   openai\u002Fresponses: handle response.failed event in HTTP streaming\n\n-   fix: address 5 Detail scan bugs from March 11 (reconnect, mutex leak, playout, ordering, retryability) - [#1188](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1188) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n\n-   fix(voice): reset VAD on premature STT EOT & guard empty recorder frames - [#1181](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1181) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n","2026-04-02T21:15:25",{"id":157,"version":158,"summary_zh":159,"released_at":160},107635,"@livekit\u002Fagents-plugin-silero@1.2.3","### Patch Changes\n\n-   Updated dependencies \\[[`3fee5c2118e7a33b0f55843ee6f36a4f10936f8b`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F3fee5c2118e7a33b0f55843ee6f36a4f10936f8b), [`3a0cf84ce9ca910b92c61eb04d180fd43471a0fc`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F3a0cf84ce9ca910b92c61eb04d180fd43471a0fc), [`6ae32034457d819b5df59bc2b4e772200e0afad7`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F6ae32034457d819b5df59bc2b4e772200e0afad7), [`50a650b6cb3af13007190f55a41bbe17ac2b4696`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F50a650b6cb3af13007190f55a41bbe17ac2b4696), [`4a94843f12746cfab47d616c3f92428a2c95a7fc`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F4a94843f12746cfab47d616c3f92428a2c95a7fc)]:\n    -   @livekit\u002Fagents@1.2.3\n","2026-04-02T21:15:43",{"id":162,"version":163,"summary_zh":159,"released_at":164},107636,"@livekit\u002Fagents-plugin-rime@1.2.3","2026-04-02T21:15:40",{"id":166,"version":167,"summary_zh":159,"released_at":168},107637,"@livekit\u002Fagents-plugin-resemble@1.2.3","2026-04-02T21:15:31",{"id":170,"version":171,"summary_zh":172,"released_at":173},107638,"@livekit\u002Fagents-plugin-openai@1.2.3","### Patch Changes\n\n-   fix: Address 6 bugs from Detail scan (March 25) - [#1182](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1182) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n\n    -   inference\u002Fllm: pass abort signal to OpenAI SDK and check abort in outer streaming loop\n    -   llm\u002Ffallback_adapter: call tryRecovery() before throwing on mid-stream failure\n    -   openai\u002Frealtime: clear responseCreatedFutures on reconnect to prevent generateReply() hang\n    -   deepgram\u002Ftts: reject on network errors instead of swallowing them\n    -   cpu: remove Math.max clamp in cgroup v1 so fractional CPU limits are reported correctly\n    -   openai\u002Fresponses: handle response.failed event in HTTP streaming\n\n-   Updated dependencies \\[[`3fee5c2118e7a33b0f55843ee6f36a4f10936f8b`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F3fee5c2118e7a33b0f55843ee6f36a4f10936f8b), [`3a0cf84ce9ca910b92c61eb04d180fd43471a0fc`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F3a0cf84ce9ca910b92c61eb04d180fd43471a0fc), [`6ae32034457d819b5df59bc2b4e772200e0afad7`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F6ae32034457d819b5df59bc2b4e772200e0afad7), [`50a650b6cb3af13007190f55a41bbe17ac2b4696`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F50a650b6cb3af13007190f55a41bbe17ac2b4696), [`4a94843f12746cfab47d616c3f92428a2c95a7fc`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F4a94843f12746cfab47d616c3f92428a2c95a7fc)]:\n    -   @livekit\u002Fagents@1.2.3\n","2026-04-02T21:15:28",{"id":175,"version":176,"summary_zh":159,"released_at":177},107639,"@livekit\u002Fagents-plugin-neuphonic@1.2.3","2026-04-02T21:15:16",{"id":179,"version":180,"summary_zh":159,"released_at":181},107640,"@livekit\u002Fagents-plugin-livekit@1.2.3","2026-04-02T21:15:22",{"id":183,"version":184,"summary_zh":185,"released_at":186},107641,"@livekit\u002Fagents-plugin-google@1.2.3","### Patch Changes\n\n-   fix(google): align realtime behavior for Gemini 3.1 and harden session\u002Ftool handling - [#1189](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1189) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n\n-   Updated dependencies \\[[`3fee5c2118e7a33b0f55843ee6f36a4f10936f8b`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F3fee5c2118e7a33b0f55843ee6f36a4f10936f8b), [`3a0cf84ce9ca910b92c61eb04d180fd43471a0fc`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F3a0cf84ce9ca910b92c61eb04d180fd43471a0fc), [`6ae32034457d819b5df59bc2b4e772200e0afad7`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F6ae32034457d819b5df59bc2b4e772200e0afad7), [`50a650b6cb3af13007190f55a41bbe17ac2b4696`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F50a650b6cb3af13007190f55a41bbe17ac2b4696), [`4a94843f12746cfab47d616c3f92428a2c95a7fc`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F4a94843f12746cfab47d616c3f92428a2c95a7fc)]:\n    -   @livekit\u002Fagents@1.2.3\n","2026-04-02T21:15:49",{"id":188,"version":189,"summary_zh":159,"released_at":190},107642,"@livekit\u002Fagents-plugin-elevenlabs@1.2.3","2026-04-02T21:15:46",{"id":192,"version":193,"summary_zh":172,"released_at":194},107643,"@livekit\u002Fagents-plugin-deepgram@1.2.3","2026-04-02T21:15:37",{"id":196,"version":197,"summary_zh":159,"released_at":198},107644,"@livekit\u002Fagents-plugin-cartesia@1.2.3","2026-04-02T21:15:19",{"id":200,"version":201,"summary_zh":159,"released_at":202},107645,"@livekit\u002Fagents-plugin-bey@1.2.3","2026-04-02T21:15:34",{"id":204,"version":205,"summary_zh":159,"released_at":206},107646,"@livekit\u002Fagents-plugin-anam@1.2.3","2026-04-02T21:15:13",{"id":208,"version":209,"summary_zh":210,"released_at":211},107647,"@livekit\u002Fagents@1.2.2","### Patch Changes\n\n-   fix: Include session usage in reports and emit usage updates - [#1161](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1161) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n\n-   Handle unhandled rejection from fire-and-forget run() in SupervisedProc - [#1158](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1158) ([@Raysharr](https:\u002F\u002Fgithub.com\u002FRaysharr))\n\n-   fix: add idle timeouts to TTS stream reads to prevent agent stuck in speaking state - [#1174](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1174) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n\n-   Guard WritableStream close in RoomIO teardown to prevent ERR_INVALID_STATE when writer is already closed or errored during concurrent speech interruption - [#1172](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1172) ([@Raysharr](https:\u002F\u002Fgithub.com\u002FRaysharr))\n\n-   fix(IPC): graceful handling when channel closes during inference - [#1168](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1168) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n\n-   Add chatCtx and ChatMessage support to AgentSession.generateReply - [#1170](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1170) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n\n-   fix: handle unhandled 'error' event on FfmpegCommand in audio.ts - [#1173](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1173) ([@enriqueespaillat-gyde](https:\u002F\u002Fgithub.com\u002Fenriqueespaillat-gyde))\n","2026-03-30T23:10:38",{"id":213,"version":214,"summary_zh":215,"released_at":216},107648,"@livekit\u002Fagents-plugin-silero@1.2.2","### Patch Changes\n\n-   Updated dependencies \\[[`a4cffe18728b5d41a26653b2cbdce1f2fb45c8d9`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Fa4cffe18728b5d41a26653b2cbdce1f2fb45c8d9), [`e2bafbca7c2ccbd0f163303305e6eef0c318fa20`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Fe2bafbca7c2ccbd0f163303305e6eef0c318fa20), [`f0ac7421ff47b30be80828ce602867bdb3f15bec`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Ff0ac7421ff47b30be80828ce602867bdb3f15bec), [`a183e4283a73307cae7b444b8a350efea6ef9e06`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Fa183e4283a73307cae7b444b8a350efea6ef9e06), [`706729f9e76a05c6c98c408d09f47f66f6a316cf`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F706729f9e76a05c6c98c408d09f47f66f6a316cf), [`dba15b13c27fc05b2477fb866c5e29bc381748c3`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Fdba15b13c27fc05b2477fb866c5e29bc381748c3), [`755fcf968efc0077346d56e8b829e9a4527c6e5e`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F755fcf968efc0077346d56e8b829e9a4527c6e5e)]:\n    -   @livekit\u002Fagents@1.2.2\n","2026-03-30T23:10:20",{"id":218,"version":219,"summary_zh":215,"released_at":220},107649,"@livekit\u002Fagents-plugin-rime@1.2.2","2026-03-30T23:10:35",{"id":222,"version":223,"summary_zh":215,"released_at":224},107650,"@livekit\u002Fagents-plugin-resemble@1.2.2","2026-03-30T23:10:11",{"id":226,"version":227,"summary_zh":228,"released_at":229},107651,"@livekit\u002Fagents-plugin-openai@1.2.2","### Patch Changes\n\n-   Fix redundant realtime events - [#1162](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fpull\u002F1162) ([@toubatbrian](https:\u002F\u002Fgithub.com\u002Ftoubatbrian))\n\n-   Updated dependencies \\[[`a4cffe18728b5d41a26653b2cbdce1f2fb45c8d9`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Fa4cffe18728b5d41a26653b2cbdce1f2fb45c8d9), [`e2bafbca7c2ccbd0f163303305e6eef0c318fa20`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Fe2bafbca7c2ccbd0f163303305e6eef0c318fa20), [`f0ac7421ff47b30be80828ce602867bdb3f15bec`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Ff0ac7421ff47b30be80828ce602867bdb3f15bec), [`a183e4283a73307cae7b444b8a350efea6ef9e06`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Fa183e4283a73307cae7b444b8a350efea6ef9e06), [`706729f9e76a05c6c98c408d09f47f66f6a316cf`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F706729f9e76a05c6c98c408d09f47f66f6a316cf), [`dba15b13c27fc05b2477fb866c5e29bc381748c3`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002Fdba15b13c27fc05b2477fb866c5e29bc381748c3), [`755fcf968efc0077346d56e8b829e9a4527c6e5e`](https:\u002F\u002Fgithub.com\u002Flivekit\u002Fagents-js\u002Fcommit\u002F755fcf968efc0077346d56e8b829e9a4527c6e5e)]:\n    -   @livekit\u002Fagents@1.2.2\n","2026-03-30T23:10:08",{"id":231,"version":232,"summary_zh":215,"released_at":233},107652,"@livekit\u002Fagents-plugin-neuphonic@1.2.2","2026-03-30T23:10:29",{"id":235,"version":236,"summary_zh":215,"released_at":237},107653,"@livekit\u002Fagents-plugin-livekit@1.2.2","2026-03-30T23:10:17"]