|
| 1 | +# File Formats |
| 2 | + |
| 3 | +Every snippet below is a file from [`examples/starter/`](../../examples/starter/), a |
| 4 | +small dental-clinic front desk with two assistants, tools, a handoff and a |
| 5 | +simulation suite. CI checks that each snippet matches its file and that the |
| 6 | +example passes `validate`, so you can copy from here safely. |
| 7 | + |
| 8 | +A resource's ID is its path under the type folder, without the extension |
| 9 | +(`tools/lookup-patient.yml` is `lookup-patient`). Reference other resources |
| 10 | +by that ID, never by UUID: the engine resolves IDs to UUIDs per org. |
| 11 | + |
| 12 | +## Assistants (`.md` or `.yml`) |
| 13 | + |
| 14 | +Markdown with YAML frontmatter: the frontmatter is the assistant config and the |
| 15 | +body is its system prompt. |
| 16 | + |
| 17 | +```markdown |
| 18 | +<!-- examples/starter/resources/starter/assistants/receptionist.md --> |
| 19 | +--- |
| 20 | +name: Receptionist |
| 21 | +firstMessage: Thanks for calling Bright Smile Dental. How can I help? |
| 22 | +model: |
| 23 | + provider: openai |
| 24 | + model: gpt-4.1 |
| 25 | + temperature: 0.3 |
| 26 | + toolIds: |
| 27 | + - lookup-patient |
| 28 | + - handoff-to-scheduler |
| 29 | + tools: |
| 30 | + - type: endCall |
| 31 | +voice: |
| 32 | + provider: 11labs |
| 33 | + voiceId: sarah |
| 34 | +artifactPlan: |
| 35 | + structuredOutputIds: |
| 36 | + - call-summary |
| 37 | +--- |
| 38 | + |
| 39 | +# Identity |
| 40 | + |
| 41 | +You are the receptionist for Bright Smile Dental, 123 Main St. The clinic is |
| 42 | +open Monday to Friday, 8am to 5pm. |
| 43 | + |
| 44 | +# Flow |
| 45 | + |
| 46 | +1. Ask for the caller's phone number and call `lookup_patient` with it. |
| 47 | +2. If they want to book, change or check an appointment, hand off to the |
| 48 | + Scheduler with `handoff_to_scheduler`. Don't book anything yourself. |
| 49 | +3. Answer general questions (hours, address) briefly yourself. |
| 50 | +``` |
| 51 | + |
| 52 | +## Tools (`.yml`) |
| 53 | + |
| 54 | +```yaml |
| 55 | +# examples/starter/resources/starter/tools/lookup-patient.yml |
| 56 | +type: function |
| 57 | +function: |
| 58 | + name: lookup_patient |
| 59 | + description: Look up the caller's patient record by phone number. |
| 60 | + parameters: |
| 61 | + type: object |
| 62 | + properties: |
| 63 | + phone: |
| 64 | + type: string |
| 65 | + description: The caller's phone number |
| 66 | + required: |
| 67 | + - phone |
| 68 | +server: |
| 69 | + url: https://example.com/vapi/lookup-patient |
| 70 | +``` |
| 71 | +
|
| 72 | +Handoffs between assistants are tools too. Give each one an explicit |
| 73 | +`function.name` if your prompts mention it by name: |
| 74 | + |
| 75 | +```yaml |
| 76 | +# examples/starter/resources/starter/tools/handoff-to-scheduler.yml |
| 77 | +type: handoff |
| 78 | +function: |
| 79 | + name: handoff_to_scheduler |
| 80 | +destinations: |
| 81 | + - type: assistant |
| 82 | + assistantId: scheduler |
| 83 | + description: Books, changes and checks appointments. |
| 84 | +``` |
| 85 | + |
| 86 | +## Structured Outputs (`.yml`) |
| 87 | + |
| 88 | +```yaml |
| 89 | +# examples/starter/resources/starter/structuredOutputs/call-summary.yml |
| 90 | +name: call-summary |
| 91 | +type: ai |
| 92 | +description: Summarizes the call for the front-desk log. |
| 93 | +schema: |
| 94 | + type: object |
| 95 | + properties: |
| 96 | + summary: |
| 97 | + type: string |
| 98 | + booked: |
| 99 | + type: boolean |
| 100 | +``` |
| 101 | + |
| 102 | +## Squads (`.yml`) |
| 103 | + |
| 104 | +```yaml |
| 105 | +# examples/starter/resources/starter/squads/front-desk.yml |
| 106 | +name: Front Desk |
| 107 | +members: |
| 108 | + - assistantId: receptionist |
| 109 | + - assistantId: scheduler |
| 110 | +``` |
| 111 | + |
| 112 | +Members hand off to each other through handoff tools on the assistants, as |
| 113 | +above. Prefer them over the legacy `assistantDestinations` field. |
| 114 | + |
| 115 | +## Evals (`.yml`) |
| 116 | + |
| 117 | +An eval file is the body of the [Evals API](https://docs.vapi.ai/api-reference/evals) |
| 118 | +create request, written as YAML. |
| 119 | + |
| 120 | +## Simulations |
| 121 | + |
| 122 | +**Personality** (`simulations/personalities/`): the simulated caller, as an |
| 123 | +assistant config. |
| 124 | + |
| 125 | +```yaml |
| 126 | +# examples/starter/resources/starter/simulations/personalities/calm-caller.yml |
| 127 | +name: Calm caller |
| 128 | +assistant: |
| 129 | + model: |
| 130 | + provider: openai |
| 131 | + model: gpt-4.1-mini |
| 132 | + messages: |
| 133 | + - role: system |
| 134 | + content: > |
| 135 | + You are a patient calling a dental clinic. Follow your scenario, |
| 136 | + answer questions briefly, and don't invent details. |
| 137 | +``` |
| 138 | + |
| 139 | +**Scenario** (`simulations/scenarios/`): what the caller does, how the call is |
| 140 | +judged (at least one evaluation), and mock results for the tools it calls. |
| 141 | + |
| 142 | +```yaml |
| 143 | +# examples/starter/resources/starter/simulations/scenarios/books-cleaning.yml |
| 144 | +name: Books a cleaning |
| 145 | +instructions: > |
| 146 | + You are Jordan Lee, phone 206-555-0142, an existing patient. Book a teeth |
| 147 | + cleaning for next Tuesday morning and accept the first slot offered. Once |
| 148 | + the booking is confirmed, say thanks and goodbye. |
| 149 | +evaluations: |
| 150 | + - structuredOutputId: booking-confirmed |
| 151 | + comparator: "=" |
| 152 | + value: true |
| 153 | + required: true |
| 154 | +toolMocks: |
| 155 | + - toolName: lookup_patient |
| 156 | + result: '{"found": true, "patientId": "P-1001"}' |
| 157 | + - toolName: book_appointment |
| 158 | + result: '{"success": true, "date": "next Tuesday", "time": "09:00"}' |
| 159 | +``` |
| 160 | + |
| 161 | +**Simulation** (`simulations/tests/`): a personality paired with a scenario. |
| 162 | + |
| 163 | +```yaml |
| 164 | +# examples/starter/resources/starter/simulations/tests/books-cleaning-calm.yml |
| 165 | +name: Books a cleaning (calm caller) |
| 166 | +personalityId: calm-caller |
| 167 | +scenarioId: books-cleaning |
| 168 | +``` |
| 169 | + |
| 170 | +**Simulation Suite** (`simulations/suites/`): |
| 171 | + |
| 172 | +```yaml |
| 173 | +# examples/starter/resources/starter/simulations/suites/core.yml |
| 174 | +name: Core |
| 175 | +simulationIds: |
| 176 | + - books-cleaning-calm |
| 177 | +``` |
| 178 | + |
| 179 | +## TypeScript resources (`.ts`) |
| 180 | + |
| 181 | +Any resource can also be a `.ts` file whose default export is the resource |
| 182 | +object, useful for generating config. It is executed when loaded, so treat |
| 183 | +`.ts` resources like code in review. |
0 commit comments