You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: refresh repo usage and add webhook testing scaffolding
Update project docs and agent guidance for multi-environment GitOps usage, add a local mock webhook server workflow, and document changelog discipline for significant resource changes.
Copy file name to clipboardExpand all lines: AGENTS.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@ This project manages **Vapi voice agent configurations** as code. All resources
4
4
5
5
**You do NOT need to know how Vapi works internally.** This guide tells you everything you need to author and modify resources.
6
6
7
+
**Prompt quality:** Whenever you create a new assistant or change an existing assistant’s system prompt, read **`docs/Vapi Prompt Optimization Guide.md`** first. It goes deeper on structure, voice constraints, tool usage, and evaluation than the summary in this file.
8
+
7
9
---
8
10
9
11
## Quick Reference
@@ -17,6 +19,8 @@ This project manages **Vapi voice agent configurations** as code. All resources
17
19
| Create a multi-agent squad | Create `resources/squads/<name>.yml`|
| Push changes to Vapi |`npm run push:dev` or `npm run push:prod`|
21
25
| Pull latest from Vapi |`npm run pull:dev` or `npm run pull:dev:force`|
22
26
| Push only one file |`npm run push:dev resources/assistants/my-agent.md`|
@@ -27,6 +31,10 @@ This project manages **Vapi voice agent configurations** as code. All resources
27
31
## Project Structure
28
32
29
33
```
34
+
docs/
35
+
├── Vapi Prompt Optimization Guide.md # In-depth prompt authoring (use when creating or editing assistants)
36
+
└── changelog.md # Significant resource/config changes over time
37
+
30
38
resources/
31
39
├── assistants/ # Voice agent definitions (.md or .yml)
32
40
├── tools/ # Tool/function definitions (.yml)
@@ -37,6 +45,9 @@ resources/
37
45
├── scenarios/ # Test case scripts (.yml)
38
46
├── tests/ # Simulation runs (.yml)
39
47
└── suites/ # Grouped simulation batches (.yml)
48
+
49
+
scripts/
50
+
└── mock-vapi-webhook-server.ts # Local webhook receiver for server message testing
40
51
```
41
52
42
53
---
@@ -601,6 +612,8 @@ The gitops engine resolves these local filenames to Vapi UUIDs automatically dur
601
612
602
613
The markdown body of an assistant `.md` file is the system prompt — the core instructions that define how the AI behaves on a call. This is the most important part to get right.
603
614
615
+
**Before drafting or changing prompts:** work through **`docs/Vapi Prompt Optimization Guide.md`** so structure, guardrails, and voice-specific habits stay consistent across agents.
616
+
604
617
### Recommended Structure
605
618
606
619
```markdown
@@ -670,6 +683,7 @@ npm run push:dev resources/assistants/my-agent.md # Push single file
670
683
# Testing
671
684
npm run call:dev -- -a <assistant-name> # Call an assistant via WebSocket
672
685
npm run call:dev -- -s <squad-name> # Call a squad via WebSocket
686
+
npm run mock:webhook # Run local webhook receiver for server message testing
If you need a local mock server to validate webhook payloads or message delivery behavior, you can add scripts under `/scripts` (for example: `scripts/mock-vapi-webhook-server.ts`) and run them locally during testing.
771
+
772
+
- Default expectation: no provider API key is needed for local receive-only mock testing.
773
+
- If a provider-specific key is required, refer to the Vapi monorepo secrets workflow and use `dotenvx` to decrypt the needed values.
774
+
- Assume decryption only works when the corresponding private keys are already available in your zsh environment.
775
+
- For local webhook validation, prioritize core `serverMessages` event types such as `speech-update`, `status-update`, and `end-of-call-report`.
776
+
- To test callbacks from Vapi into your local machine, expose the mock server with a tunnel like `ngrok` and use that public HTTPS URL in `assistant.server.url`.
This repository uses two instruction sources for Claude:
4
+
5
+
1.`AGENTS.md` is the primary, comprehensive guide for this codebase.
6
+
2.`CLAUDE.md` contains Claude-specific reinforcement and policy reminders.
7
+
8
+
When both files exist, follow both. If guidance overlaps, treat `AGENTS.md` as the canonical project playbook and use this file to reinforce Claude-specific behavior.
9
+
10
+
## Required Reading Order
11
+
12
+
1. Read `AGENTS.md` first.
13
+
2. Then read this file (`CLAUDE.md`) for additional policy constraints.
14
+
15
+
## Changelog Discipline
16
+
17
+
Always update `docs/changelog.md` when making significant configuration changes.
18
+
19
+
Significant changes include:
20
+
- Assistant updates (prompt or YAML frontmatter)
21
+
- Tool updates (new tools, changed parameters, changed behavior)
22
+
- Squad updates (members, handoffs, overrides)
23
+
- Other behavior-impacting resource changes (structured outputs, simulations)
|`npm run pull:dev`| Pull platform state, preserve local changes |
85
+
|`npm run pull:stg`| Pull staging state, preserve local changes |
66
86
|`npm run pull:dev:force`| Pull platform state, overwrite everything |
87
+
|`npm run pull:stg:force`| Pull staging state, overwrite everything |
67
88
|`npm run pull:prod`| Pull from prod, preserve local changes |
68
89
|`npm run pull:prod:force`| Pull from prod, overwrite everything |
69
90
|`npm run push:dev`| Push local files to Vapi (dev) |
91
+
|`npm run push:stg`| Push local files to Vapi (staging) |
70
92
|`npm run push:prod`| Push local files to Vapi (prod) |
71
93
|`npm run apply:dev`| Pull → Merge → Push in one shot (dev) |
94
+
|`npm run apply:stg`| Pull → Merge → Push in one shot (staging) |
72
95
|`npm run apply:prod`| Pull → Merge → Push in one shot (prod) |
73
96
|`npm run push:dev assistants`| Push only assistants (dev) |
74
97
|`npm run push:dev tools`| Push only tools (dev) |
75
98
|`npm run call:dev -- -a <name>`| Start a WebSocket call to an assistant (dev) |
76
99
|`npm run call:dev -- -s <name>`| Start a WebSocket call to a squad (dev) |
100
+
|`npm run mock:webhook`| Run local webhook receiver for Vapi server messages |
77
101
78
102
### Basic Workflow
79
103
80
104
```bash
81
-
# First time: pull all resources from Vapi
105
+
# First time: pull all resources from Vapi for your target env
82
106
npm run pull:dev:force
83
107
84
108
# Commit the initial state
85
109
git add .&& git commit -m "initial pull"
86
110
87
-
# Make changes to YAML/MD files...
111
+
# Make changes to YAML/MD files under resources/
88
112
89
-
# Push changes to Vapi
113
+
# Push your changes (full sync)
90
114
npm run push:dev
91
115
```
92
116
117
+
Promotion example:
118
+
119
+
```bash
120
+
# After validating in dev, promote selectively to staging
121
+
npm run push:stg resources/squads/your-squad.yml
122
+
123
+
# Promote to prod when ready
124
+
npm run push:prod resources/squads/your-squad.yml
125
+
```
126
+
93
127
#### Pulling Without Losing Local Work
94
128
95
129
By default, `pull` preserves any files you've locally modified or deleted:
@@ -193,12 +227,37 @@ If a dependency already exists on the platform (UUID in the state file) but its
193
227
194
228
This means you can work on everything in dev, then selectively push a single squad or assistant to staging or prod — no need for a full `push` that touches every resource.
195
229
230
+
### Webhook Local Testing
231
+
232
+
Use the local mock receiver when validating Vapi `serverMessages` delivery.
233
+
234
+
```bash
235
+
# 1) Run local receiver
236
+
npm run mock:webhook
237
+
238
+
# 2) Expose localhost (example)
239
+
ngrok http 8787
240
+
```
241
+
242
+
Then set your assistant `server.url` to the ngrok HTTPS URL and include event types like:
243
+
-`speech-update`
244
+
-`status-update`
245
+
-`end-of-call-report`
246
+
247
+
The mock server exposes:
248
+
-`POST /webhook` (or `POST /`)
249
+
-`GET /health`
250
+
-`GET /events`
251
+
196
252
---
197
253
198
254
## Project Structure
199
255
200
256
```
201
257
vapi-gitops/
258
+
├── docs/
259
+
│ ├── Vapi Prompt Optimization Guide.md # Prompt authoring reference
0 commit comments