npx skills add https://github.com/vapiai/skills --skill create-squad创建能够协调多个专业助手并保持上下文传递的小队。将复杂工作流分解为专注的助手,实现彼此间的通话转移。
设置: 确保已设置
VAPI_API_KEY。如有需要,请参考setup-api-key技能。
使用大型提示词的单一助手会导致更高的幻觉率、增加的成本以及更大的延迟。小队通过创建具有特定角色的专注助手来解决此问题:
curl -X POST https://api.vapi.ai/squad \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Support Squad",
"members": [
{
"assistant": {
"name": "Receptionist",
"firstMessage": "Hello! How can I direct your call today?",
"model": {
"provider": "openai",
"model": "gpt-4.1",
"messages": [
{
"role": "system",
"content": "You are a receptionist. Determine if the caller needs sales or support, then transfer them to the right department."
}
],
"tools": [
{
"type": "handoff",
"destinations": [
{
"type": "assistant",
"assistantId": "sales-assistant-id",
"description": "Transfer when the caller asks about pricing, plans, or wants to purchase"
},
{
"type": "assistant",
"assistantId": "support-assistant-id",
"description": "Transfer when the caller has a technical issue or needs help"
}
]
}
]
},
"voice": { "provider": "vapi", "voiceId": "Lily" },
"transcriber": { "provider": "deepgram", "model": "nova-3", "language": "en" }
}
},
{
"assistantId": "sales-assistant-id"
},
{
"assistantId": "support-assistant-id"
}
]
}'
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
import { VapiClient } from "@vapi-ai/server-sdk";
const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! });
const squad = await vapi.squads.create({
name: "Support Squad",
members: [
{
assistant: {
name: "Receptionist",
firstMessage: "Hello! How can I direct your call today?",
model: {
provider: "openai",
model: "gpt-4.1",
messages: [
{
role: "system",
content:
"You are a receptionist. Determine if the caller needs sales or support, then transfer them.",
},
],
tools: [
{
type: "handoff",
destinations: [
{
type: "assistant",
assistantId: "sales-assistant-id",
description: "Transfer for pricing and purchasing questions",
},
{
type: "assistant",
assistantId: "support-assistant-id",
description: "Transfer for technical issues",
},
],
},
],
},
voice: { provider: "vapi", voiceId: "Lily" },
transcriber: { provider: "deepgram", model: "nova-3", language: "en" },
},
},
{ assistantId: "sales-assistant-id" },
{ assistantId: "support-assistant-id" },
],
});
console.log("Squad created:", squad.id);
数组中的第一个成员开始通话。每个成员可以是:
临时成员 — 使用 assistant: { ... } 内联定义
持久成员 — 通过 assistantId: "..." 引用已保存的助手
{ "members": [ { "assistant": { "name": "Inline Assistant", "..." : "..." } }, { "assistantId": "saved-assistant-id" } ] }
转接工具定义助手之间如何相互转移:
{
"type": "handoff",
"destinations": [
{
"type": "assistant",
"assistantId": "target-assistant-id",
"description": "Clear description of WHEN to transfer. Be specific about trigger conditions."
}
],
"function": {
"name": "handoff_to_sales"
}
}
在小队上下文中覆盖已保存助手的设置,而不修改原始设置:
{
"assistantId": "saved-assistant-id",
"assistantOverrides": {
"voice": { "provider": "vapi", "voiceId": "Elliot" },
"firstMessage": "Overridden greeting for this squad"
}
}
向已保存的助手添加小队特定的工具:
{
"assistantId": "saved-assistant-id",
"assistantOverrides": {
"tools:append": [
{
"type": "handoff",
"destinations": [
{
"type": "assistant",
"assistantId": "another-assistant-id",
"description": "Transfer when customer needs billing help"
}
],
"function": { "name": "handoff_to_billing" }
}
]
}
}
同时向所有成员应用配置:
{
"members": [
{ "assistant": { "name": "Agent A", "..." : "..." } },
{ "assistantId": "agent-b-id" }
],
"memberOverrides": {
"voice": { "provider": "vapi", "voiceId": "Elliot" },
"transcriber": { "provider": "deepgram", "model": "nova-3", "language": "en" }
}
}
curl -X POST https://api.vapi.ai/call \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"squadId": "your-squad-id",
"phoneNumberId": "your-phone-number-id",
"customer": {
"number": "+11234567890"
}
}'
{
"squad": {
"members": [
{ "assistant": { "..." : "..." } },
{ "assistantId": "..." }
]
},
"phoneNumberId": "phone-number-id",
"customer": { "number": "+11234567890" }
}
{
"name": "Clinic Squad",
"members": [
{
"assistant": {
"name": "Triage Nurse",
"firstMessage": "Hello, this is the clinic. How can I help you today?",
"model": {
"provider": "openai",
"model": "gpt-4.1",
"messages": [
{
"role": "system",
"content": "You are a clinic triage assistant. Assess the caller's needs: if they need an appointment, transfer to scheduling. If it's urgent, transfer to the nurse line."
}
],
"tools": [
{
"type": "handoff",
"destinations": [
{
"type": "assistant",
"assistantId": "scheduling-assistant-id",
"description": "Transfer when caller wants to book, reschedule, or cancel an appointment"
},
{
"type": "assistant",
"assistantId": "nurse-assistant-id",
"description": "Transfer for urgent medical questions or symptoms"
}
]
}
]
},
"voice": { "provider": "vapi", "voiceId": "Lily" }
}
},
{ "assistantId": "scheduling-assistant-id" },
{ "assistantId": "nurse-assistant-id" }
]
}
{
"name": "E-commerce Squad",
"members": [
{
"assistant": {
"name": "Sales Agent",
"firstMessage": "Welcome to our store! Are you looking to make a purchase today?",
"model": {
"provider": "openai",
"model": "gpt-4.1",
"messages": [
{ "role": "system", "content": "You are a sales assistant. Help customers find products and make purchases. Transfer to support for order issues or returns." }
],
"tools": [
{
"type": "handoff",
"destinations": [
{ "type": "assistant", "assistantId": "support-id", "description": "Transfer for order status, shipping, or account issues" },
{ "type": "assistant", "assistantId": "returns-id", "description": "Transfer for returns, refunds, or exchanges" }
]
}
]
}
}
},
{ "assistantId": "support-id" },
{ "assistantId": "returns-id" }
]
}
# 列出小队
curl https://api.vapi.ai/squad -H "Authorization: Bearer $VAPI_API_KEY"
# 获取小队
curl https://api.vapi.ai/squad/{id} -H "Authorization: Bearer $VAPI_API_KEY"
# 更新小队
curl -X PATCH https://api.vapi.ai/squad/{id} \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Updated Squad Name"}'
# 删除小队
curl -X DELETE https://api.vapi.ai/squad/{id} \
-H "Authorization: Bearer $VAPI_API_KEY"
此技能仓库包含一个 Vapi 文档 MCP 服务器 (vapi-docs),它使您的 AI 代理能够访问完整的 Vapi 知识库。使用 searchDocs 工具查找此技能未涵盖的任何内容 — 高级配置、故障排除、SDK 详细信息等。
自动配置: 如果您克隆或安装了这些技能,MCP 服务器已通过 .mcp.json (Claude Code)、.cursor/mcp.json (Cursor) 或 .vscode/mcp.json (VS Code Copilot) 配置完成。
手动设置: 如果您的代理未自动检测到配置,请运行:
claude mcp add vapi-docs -- npx -y mcp-remote https://docs.vapi.ai/_mcp/server
有关所有支持的代理的完整设置说明,请参阅 README。
每周安装
268
仓库
GitHub 星标
22
首次出现
2026年2月23日
安全审计
安装于
cursor239
kimi-cli234
gemini-cli234
github-copilot234
amp234
codex234
Create squads that orchestrate multiple specialized assistants with context-preserving handoffs. Break complex workflows into focused assistants that transfer calls between each other.
Setup: Ensure
VAPI_API_KEYis set. See thesetup-api-keyskill if needed.
Single assistants with large prompts cause higher hallucination rates, increased costs, and greater latency. Squads solve this by creating focused assistants with specific roles:
curl -X POST https://api.vapi.ai/squad \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Support Squad",
"members": [
{
"assistant": {
"name": "Receptionist",
"firstMessage": "Hello! How can I direct your call today?",
"model": {
"provider": "openai",
"model": "gpt-4.1",
"messages": [
{
"role": "system",
"content": "You are a receptionist. Determine if the caller needs sales or support, then transfer them to the right department."
}
],
"tools": [
{
"type": "handoff",
"destinations": [
{
"type": "assistant",
"assistantId": "sales-assistant-id",
"description": "Transfer when the caller asks about pricing, plans, or wants to purchase"
},
{
"type": "assistant",
"assistantId": "support-assistant-id",
"description": "Transfer when the caller has a technical issue or needs help"
}
]
}
]
},
"voice": { "provider": "vapi", "voiceId": "Lily" },
"transcriber": { "provider": "deepgram", "model": "nova-3", "language": "en" }
}
},
{
"assistantId": "sales-assistant-id"
},
{
"assistantId": "support-assistant-id"
}
]
}'
import { VapiClient } from "@vapi-ai/server-sdk";
const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! });
const squad = await vapi.squads.create({
name: "Support Squad",
members: [
{
assistant: {
name: "Receptionist",
firstMessage: "Hello! How can I direct your call today?",
model: {
provider: "openai",
model: "gpt-4.1",
messages: [
{
role: "system",
content:
"You are a receptionist. Determine if the caller needs sales or support, then transfer them.",
},
],
tools: [
{
type: "handoff",
destinations: [
{
type: "assistant",
assistantId: "sales-assistant-id",
description: "Transfer for pricing and purchasing questions",
},
{
type: "assistant",
assistantId: "support-assistant-id",
description: "Transfer for technical issues",
},
],
},
],
},
voice: { provider: "vapi", voiceId: "Lily" },
transcriber: { provider: "deepgram", model: "nova-3", language: "en" },
},
},
{ assistantId: "sales-assistant-id" },
{ assistantId: "support-assistant-id" },
],
});
console.log("Squad created:", squad.id);
The first member in the array starts the call. Each member is either:
Transient — Defined inline with assistant: { ... }
Persistent — References a saved assistant via assistantId: "..."
{ "members": [ { "assistant": { "name": "Inline Assistant", "..." : "..." } }, { "assistantId": "saved-assistant-id" } ] }
Handoff tools define how assistants transfer between each other:
{
"type": "handoff",
"destinations": [
{
"type": "assistant",
"assistantId": "target-assistant-id",
"description": "Clear description of WHEN to transfer. Be specific about trigger conditions."
}
],
"function": {
"name": "handoff_to_sales"
}
}
Override saved assistant settings within the squad context without modifying the original:
{
"assistantId": "saved-assistant-id",
"assistantOverrides": {
"voice": { "provider": "vapi", "voiceId": "Elliot" },
"firstMessage": "Overridden greeting for this squad"
}
}
Add squad-specific tools to a saved assistant:
{
"assistantId": "saved-assistant-id",
"assistantOverrides": {
"tools:append": [
{
"type": "handoff",
"destinations": [
{
"type": "assistant",
"assistantId": "another-assistant-id",
"description": "Transfer when customer needs billing help"
}
],
"function": { "name": "handoff_to_billing" }
}
]
}
}
Apply configuration to ALL members simultaneously:
{
"members": [
{ "assistant": { "name": "Agent A", "..." : "..." } },
{ "assistantId": "agent-b-id" }
],
"memberOverrides": {
"voice": { "provider": "vapi", "voiceId": "Elliot" },
"transcriber": { "provider": "deepgram", "model": "nova-3", "language": "en" }
}
}
curl -X POST https://api.vapi.ai/call \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"squadId": "your-squad-id",
"phoneNumberId": "your-phone-number-id",
"customer": {
"number": "+11234567890"
}
}'
{
"squad": {
"members": [
{ "assistant": { "..." : "..." } },
{ "assistantId": "..." }
]
},
"phoneNumberId": "phone-number-id",
"customer": { "number": "+11234567890" }
}
{
"name": "Clinic Squad",
"members": [
{
"assistant": {
"name": "Triage Nurse",
"firstMessage": "Hello, this is the clinic. How can I help you today?",
"model": {
"provider": "openai",
"model": "gpt-4.1",
"messages": [
{
"role": "system",
"content": "You are a clinic triage assistant. Assess the caller's needs: if they need an appointment, transfer to scheduling. If it's urgent, transfer to the nurse line."
}
],
"tools": [
{
"type": "handoff",
"destinations": [
{
"type": "assistant",
"assistantId": "scheduling-assistant-id",
"description": "Transfer when caller wants to book, reschedule, or cancel an appointment"
},
{
"type": "assistant",
"assistantId": "nurse-assistant-id",
"description": "Transfer for urgent medical questions or symptoms"
}
]
}
]
},
"voice": { "provider": "vapi", "voiceId": "Lily" }
}
},
{ "assistantId": "scheduling-assistant-id" },
{ "assistantId": "nurse-assistant-id" }
]
}
{
"name": "E-commerce Squad",
"members": [
{
"assistant": {
"name": "Sales Agent",
"firstMessage": "Welcome to our store! Are you looking to make a purchase today?",
"model": {
"provider": "openai",
"model": "gpt-4.1",
"messages": [
{ "role": "system", "content": "You are a sales assistant. Help customers find products and make purchases. Transfer to support for order issues or returns." }
],
"tools": [
{
"type": "handoff",
"destinations": [
{ "type": "assistant", "assistantId": "support-id", "description": "Transfer for order status, shipping, or account issues" },
{ "type": "assistant", "assistantId": "returns-id", "description": "Transfer for returns, refunds, or exchanges" }
]
}
]
}
}
},
{ "assistantId": "support-id" },
{ "assistantId": "returns-id" }
]
}
# List squads
curl https://api.vapi.ai/squad -H "Authorization: Bearer $VAPI_API_KEY"
# Get a squad
curl https://api.vapi.ai/squad/{id} -H "Authorization: Bearer $VAPI_API_KEY"
# Update a squad
curl -X PATCH https://api.vapi.ai/squad/{id} \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Updated Squad Name"}'
# Delete a squad
curl -X DELETE https://api.vapi.ai/squad/{id} \
-H "Authorization: Bearer $VAPI_API_KEY"
This skills repository includes a Vapi documentation MCP server (vapi-docs) that gives your AI agent access to the full Vapi knowledge base. Use the searchDocs tool to look up anything beyond what this skill covers — advanced configuration, troubleshooting, SDK details, and more.
Auto-configured: If you cloned or installed these skills, the MCP server is already configured via .mcp.json (Claude Code), .cursor/mcp.json (Cursor), or .vscode/mcp.json (VS Code Copilot).
Manual setup: If your agent doesn't auto-detect the config, run:
claude mcp add vapi-docs -- npx -y mcp-remote https://docs.vapi.ai/_mcp/server
See the README for full setup instructions across all supported agents.
Weekly Installs
268
Repository
GitHub Stars
22
First Seen
Feb 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
cursor239
kimi-cli234
gemini-cli234
github-copilot234
amp234
codex234
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
56,200 周安装