Voice Approval (Vapi)
Last reviewed August 21, 2026.
CPLai ships a phone-based approval gate for high-stakes agent decisions. When an agent hits a moment that should require explicit human sign-off (prod deploy, sending a customer email, charging a card), it can call your phone, summarize the decision in ~8 seconds, and wait for a spoken yes/no.
Default failure on every error path is no. Vapi being misconfigured, unreachable, or slow can never accidentally green-light a high-stakes action.
What do I need?
- A Vapi account (vapi.ai).
- A configured assistant in Vapi. The assistant persona should be short and businesslike - it reads CPLai's per-call prompt as the first message and captures the operator's response.
- A phone number in Vapi to place outbound calls from.
- The destination phone number (your own, in E.164 format, e.g.
+19195551234).
How do I configure Vapi credentials?
In CPLai, open Settings -> Keychain and choose Add an item. Add the Vapi API key from Known service, then add the three supporting values as Custom credential entries:
| Entry flow | Label | Env var | Secret value |
|---|---|---|---|
| Known service -> Vapi | Vapi API key | VAPI_API_KEY |
your private API key |
| Custom credential | Vapi assistant | VAPI_ASSISTANT_ID |
the assistant UUID |
| Custom credential | Destination/operator phone number | VAPI_PHONE_NUMBER |
the number CPLai calls, in E.164 format such as +1XXXXXXXXXX |
| Custom credential | Vapi outbound phone number ID | VAPI_PHONE_NUMBER_ID |
the Vapi-issued UUID for the number that places the call |
Link the entries to whichever company should be able to gate decisions via voice. Every agent in that company will inherit the four env vars on next launch.
How do I use voice approval from an integration?
Voice approval is an advanced integration boundary, not an end-user button. A trusted desktop workflow or autonomous agent must resolve the selected agent's four linked Vapi variables and pass only those values to its reviewed call wrapper. Never log or persist the resolved environment because it can contain other company credentials.
The wrapper must proceed only when Vapi finishes successfully and the normalized decision is yes. Timeout, hangup, missing credentials, an unmatched transcript, or any network error must deny the action.
Tip: Keep approval choices to
yesandno. The first option is treated as the affirmative choice, while every failure path denies the action.
How do autonomous CLI agents request approval?
Autonomous agents inherit linked Keychain values in their spawned environment. They can use a reviewed wrapper around the Vapi REST API, such as the flow below. This shell example shows the request shape only. A production wrapper must bound the polling loop, validate the call id, and default to no on every error.
Direct example a CLI agent can run with bash:
# Place the call. Vapi reads the firstMessage to the operator and listens.
CALL_ID=$(curl -sS -X POST https://api.vapi.ai/call \
-H "Authorization: Bearer $VAPI_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"assistantId\": \"$VAPI_ASSISTANT_ID\",
\"phoneNumberId\": \"$VAPI_PHONE_NUMBER_ID\",
\"customer\": { \"number\": \"$VAPI_PHONE_NUMBER\" },
\"assistantOverrides\": {
\"firstMessage\": \"Deploy v2 to production right now? Please say yes or no.\"
}
}" | jq -r '.id')
# Poll until ended (truncated; production callers should add a timeout):
while true; do
STATUS=$(curl -sS -H "Authorization: Bearer $VAPI_API_KEY" \
https://api.vapi.ai/call/$CALL_ID | jq -r '.status')
[ "$STATUS" = "ended" ] && break
sleep 3
done
# Read the transcript and act:
curl -sS -H "Authorization: Bearer $VAPI_API_KEY" \
https://api.vapi.ai/call/$CALL_ID | jq -r '.transcript'
What happens when the call fails?
| Scenario | decision | ok |
|---|---|---|
| Operator said the first option | yes |
true |
| Operator said the second option | no |
true |
| Operator hung up before answering | hangup |
false |
| Call did not end within timeout | timeout |
false |
| Transcript didn't match an option | no |
false |
| Credentials missing | no |
false |
| Network or Vapi error | no |
false |
| Empty prompt | no |
false |
Treat ok: false as a hard deny. The error field carries a short
human-readable reason for the agent's run log.
What are the current boundaries?
Voice approval is currently an advanced integration helper, not a button in the CPLai
interface and not a registered native agent tool. It does not automatically
intercept deploys, messages, payments, or other high-stakes actions. The calling
workflow must invoke the helper or a reviewed Vapi wrapper and must proceed only
when the result is explicitly ok: true with decision: 'yes'.
The desktop helper uses Tauri's HTTP client, so it is not available in the web dashboard. Browser-based workflows should hand the decision to a desktop or autonomous agent that has the required Keychain values.