#1194·voltagent

[FEAT] Add tool suspend/resume functionality similar to Mastra

Author: lusonsCreated Apr 8, 2026Updated Aug 23, 2026
Labelsenhancement

Is your feature request related to a problem? Please describe.

Since Mastra offers a similar feature, it would be great if Voltagent could support this as well. From my experience, I can easily implement a similar AskUserTool.

Describe alternatives you've considered

No response

Additional context

No response

Describe the thing to improve

I hope Voltagent can support a similar usage, or does the team have a better solution?

bash
export const testToolB = createTool({
  id: 'test-tool-b',
  description: 'Fetches weather for a location',
  inputSchema: z.object({
    location: z.string(),
  }),
  outputSchema: z.object({
    weather: z.string(),
  }),
  resumeSchema: z.object({
    approved: z.boolean(),
  }),
  suspendSchema: z.object({
    reason: z.string(),
  }),
  execute: async (inputData, context) => {
    const { resumeData: { approved } = {}, suspend } = context?.agent ?? {}

    if (!approved) {
      return suspend?.({ reason: 'Approval required.' })
    }

    const response = await fetch(`https://wttr.in/${inputData.location}?format=3`)
    const weather = await response.text()

    return { weather }
  },
})