optimistic-gold
optimistic-gold4d ago

Variable values being modified by Vapi when passing to tool calls

I noticed in the Vapi SDK, we can pass in a key called "variableValues" on the Vapi instance instantiation but the value of these keys seem to be obfuscated /modified once Vapi recieves them and tries to use that value in tool calls. This is a major bug for my use case as it allows me to differentiate among user chat histories. I noticed when I told Vapi to pass this variableValue to the tool calls as a param, it would modify slight characters in the string value. These are some failed logs I found on my server when trying to make tool calls with Vapi. As you can see, it slightly obfuscates the string. Failed requests (10:41:50 - 10:42:32): - ❌ Request 1: 2536d197-fc73-497d-8c8a-e6755bfe404 (corrupted: d199 → d197, missing b) - ❌ Request 2: 2536d199-fc73-497d-8c8a-e67555bfe404 (corrupted: bbf → 55b, 4f missing) This is a CONSISTENT issue, and I've isolated it to be only occurring when the voice agent is required to use a variableValue to pass into a tool call. I have a text mode with a local LLM and it does not experience the same issue. Is there a patch to fix this soon or can your team look into this asap? It is a fairly critical bug, as this allows (not only myself but other users too) me to allow the Vapi instance to use tool calls and pass params in which is vital to the functionality of my app. Thank you.
1 Reply
optimistic-gold
optimistic-goldOP4d ago
example code showing no modification on my side from front end // Start Vapi call (called ONLY when voice mode is selected) const startVapi = (sessionToken, gmailAuthStatus, calendarAuthStatus) => { if (!vapiRef.current) { secureLog('Cannot start Vapi - not initialized'); return; } if (!VAPI_ASSISTANT_ID) { secureLog('VAPI Assistant ID not configured'); return; } // Pass session token and authentication status to Vapi const assistantOverrides = { recordingEnabled: false }; // Use passed token parameter or fall back to state const token = sessionToken || vapiSessionToken; if (token) { assistantOverrides.variableValues = { session_token: token, gmail_authenticated: gmailAuthStatus ?? isGmailAuthenticated, calendar_authenticated: calendarAuthStatus ?? isCalendarAuthenticated }; secureLog('Starting Vapi call with session token and auth status', { gmail: gmailAuthStatus ?? isGmailAuthenticated, calendar: calendarAuthStatus ?? isCalendarAuthenticated }); } vapiRef.current.start(VAPI_ASSISTANT_ID, assistantOverrides); };

Did you find this page helpful?