> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.vapi.ai/llms.txt.
> For full documentation content, see https://docs.vapi.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.vapi.ai/_mcp/server.

# Clinic triage and scheduling squad

> Build a multi-assistant clinic experience with specialized assistants for triage, emergency handling, and scheduling using Squads.

## Overview

Compose multiple assistants into a Squad for safe, specialized healthcare flows: a triage assistant assesses symptoms, an emergency assistant handles urgent cases, and a scheduler books appointments.

**Squad Capabilities:**

* Structured triage evaluation and safety gates
* Emergency detection → immediate handoff
* Provider matching and scheduling tools
* Transfers preserve full conversation context

## 1. Define members

```json title="Example squad payload"
{
  "members": [
    { "assistant": { "name": "Triage", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Medical triage assistant. Identify red flags."}] }, "firstMessage": "Hello, how can I help you today?", "firstMessageMode": "assistant-speaks-first" } },
    { "assistant": { "name": "Emergency", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Emergency protocol assistant. Keep interaction brief and connect immediately."}] } } },
    { "assistant": { "name": "Scheduler", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Clinic scheduler. Offer next available slots, then confirm."}] }, "toolIds": ["BOOK_TOOL_ID", "PROVIDER_LOOKUP_ID"] } }
  ]
}
```

## 2. Configure transfers

* From Triage → Emergency when red flags detected
* From Triage → Scheduler for routine care
* Warm-transfer with a short summary for human escalation

## 3. Implement

```typescript title="create web call with transient squad"
import { VapiClient } from "@vapi-ai/server-sdk";

const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! });

await vapi.calls.create({
  transport: { type: "web" },
  squad: {
    members: [
      {
        assistant: {
          name: "Triage",
          model: {
            provider: "openai",
            model: "gpt-4o",
            messages: [{ role: "system", content: "Medical triage assistant. Identify red flags." }],
          },
          firstMessage: "Hello, how can I help you today?",
          firstMessageMode: "assistant-speaks-first",
        },
      },
      {
        assistant: {
          name: "Emergency",
          model: {
            provider: "openai",
            model: "gpt-4o",
            messages: [{ role: "system", content: "Emergency protocol assistant. Keep interaction brief and connect immediately." }],
          },
        },
      },
      {
        assistant: {
          name: "Scheduler",
          model: {
            provider: "openai",
            model: "gpt-4o",
            messages: [{ role: "system", content: "Clinic scheduler. Offer next available slots, then confirm." }],
          },
        },
      },
    ],
  },
});
```

```typescript title="create phone call with transient squad"
await vapi.calls.create({
  phoneNumberId: "YOUR_PHONE_NUMBER_ID",
  customer: { number: "+15551234567" },
  squad: { /* same squad as above */ members: [] },
});
```

```typescript title="create and reuse a squad (optional)"
const squad = await vapi.squads.create({
  name: "Clinic Triage",
  members: [ /* same members as above */ ],
});

await vapi.calls.create({ transport: { type: "web" }, squadId: squad.id });
```

```python title="create web call with transient squad"
import os
from vapi import Vapi

client = Vapi(token=os.getenv("VAPI_API_KEY"))

client.calls.create(
    transport={"type": "web"},
    squad={
        "members": [
            {"assistant": {"name": "Triage", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Medical triage assistant. Identify red flags."}]}, "first_message": "Hello, how can I help you today?", "first_message_mode": "assistant-speaks-first"}},
            {"assistant": {"name": "Emergency", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Emergency protocol assistant. Keep interaction brief and connect immediately."}]}}},
            {"assistant": {"name": "Scheduler", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Clinic scheduler. Offer next available slots, then confirm."}]}}},
        ]
    },
)
```

```python title="create phone call with transient squad"
client.calls.create(
    phone_number_id="YOUR_PHONE_NUMBER_ID",
    customer={"number": "+15551234567"},
    squad={"members": []},  # same members as above
)
```

```python title="create and reuse a squad (optional)"
squad = client.squads.create(
    name="Clinic Triage",
    members=[ /* same members as above */ ],
)
client.calls.create(transport={"type": "web"}, squad_id=squad["id"])
```

```bash title="create web call"
curl -X POST "https://api.vapi.ai/call/web" \
  -H "Authorization: Bearer $VAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "squad": {
      "members": [
        { "assistant": { "name": "Triage", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Medical triage assistant. Identify red flags."}] }, "firstMessage": "Hello, how can I help you today?", "firstMessageMode": "assistant-speaks-first" } },
        { "assistant": { "name": "Emergency", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Emergency protocol assistant. Keep interaction brief and connect immediately."}] } } },
        { "assistant": { "name": "Scheduler", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Clinic scheduler. Offer next available slots, then confirm."}] } } }
      ]
    }
  }'
```

```bash title="create phone call"
curl -X POST "https://api.vapi.ai/call" \
  -H "Authorization: Bearer $VAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phoneNumberId": "YOUR_PHONE_NUMBER_ID",
    "customer": { "number": "+15551234567" },
    "squad": { "members": [] }
  }'
```

## 4. Test

Attach a phone number to the Squad (or start with a Squad when creating a call) and test urgent vs routine scenarios.

## Next steps

* **Tools**: [Custom Tools](/tools/custom-tools)
* **Scheduling**: [Google Calendar](/tools/google-calendar)