dual-salmonD
VAPI4mo ago
dual-salmon

Agent does not respond after using a tool

I have an agent instrumented with a few tools. These tools are captured by my web app, when I detect a tool call, I fetch some data and pass it to the assistant. It used to work flawlessly for a few weeks.

But for the past few days the agent began to intermittently go quiet and not respond after fetching the data. I would have to manually ask it "let me know once you find something" and then it would respond.

Today the problem appears to be fixed, but I would like to understand this problem better in order to make sure it does not happen in production.

Example:
  • Call ID: 8482e644-349d-45e8-b2d6-17643edc048b
  • Time: 08/27/2025 15:39 NZT
Response I was expecting to receive:

"I've found your customer... <details>"

But what I got was silence.

Here is how I handle the tool call:

export default class HistoryRetrievalHandler extends ToolHandler {
    readonly functionName = SET_CUSTOMER_ID;

    async handle(args: { [key: string]: unknown }, vapi: Vapi) {
        const userName = useUserContextStore.getState().name;
        const userCode = useUserContextStore.getState().code;
        const { id } = args as unknown as HistoryRetrievalArgs;
        const dataCollectors = {
            events: `/api/events?customerId=${id}`,
            complaints: `/api/complaints?userCode=${encodeURIComponent(userCode)}&customerId=${id}`,
            opportunities: `/api/opportunities?customerId=${id}`,
        };
        let content = "";
        content = await appendLatestVisitInfo(content, id, userName);
        content = await aggregateData(content, dataCollectors);
        content += "\n I must let the user know what I have found and ask for further instructions";
        vapi.send({ type: "add-message", message: { role: "system", content } });
    }
}
Was this page helpful?