Setting Tools to async

Hey Sahil,

I'm trying to understand the data structure for setting tools to async when creating an (ephemeral) assistant. I'm doing this because currently the agent's behavior when firing the tool is inconsistent and weird, sometimes it gives a response AND fires the tool, sometimes it just says "one sec" and fires the tool (which is not the desired behavior). I have the tools created in my VAPI account and I'm just passing the tool ID's to the agent when I create it. So I'm not sure if I'm supposed to set the async property at the agent level or if I need to somehow set it on all the tools I'm passing with ID's. Here is the payload below that I'm trying to use. This currently gives me a 404 error when I include 'tools: [{ async: true }]'.

  1. I'm
const newAgent = {
name: agent.name,
image: agent.image,
description: agent.description,

payload: {
...setup,

firstMessage: agent.firstMessage,
name: agent.name,
model: {
...setup.model,
toolIds: agent.toolIds,
messages: [
{
content: agent.systemMessage,
role: "system",
},
],
tools: [{ async: true }],
},
endCallFunctionEnabled: agent.endCallFunctionEnabled,
transcriber: { ...setup.transcriber, language: agent.language },
voice: { provider: agent.voiceEngine, voiceId: agent.voiceId },
// filler_words: true,
analysisPlan: {
summaryPrompt: My summary prompt,
summaryRequestTimeoutSeconds: 10.5,
successEvaluationRubric: "AutomaticRubric",
},
serverMessages: ["end-of-call-report", "hang"],
serverUrl: "https://roley.ai/api/end-of-call-report",
},
};
Was this page helpful?