[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[AI SDK](/c/ai-sdk/62)

# Multi-agent workflow: Delegate agents via tool call?

434 views · 1 like · 5 posts


waso (@cervonwong) · 2025-10-30

I’m looking at implementing multi-agent workflows such as this example in Pydantic AI here: [Multi-Agent Patterns - Pydantic AI](https://ai.pydantic.dev/multi-agent-applications/#agent-delegation-and-dependencies)

I want to have two agents: Joke Selection Agent and Joke Generation Agent.

Joke Selection Agent will ask Joke Generation Agent to generate 5 jokes then Joke Selection Agent will choose the best one.

I want to display the chat output of both the agents in the UI so I was thinking of making both agents have their own API routes and use useChat for both of them. But then it becomes complicated trying to send the output of one agent which is in the UI stream into the tool response for another agent. Has anyone any advice on how to perform multi-agent workflows in Vercel AI SDK.

Thanks!

![image|432x500](upload://uoLNc322DiEFts3iJIYzso7qEHQ.png)


waso (@cervonwong) · 2025-10-31

Hi, I saw further now that in the v6 SDK there is mention of implementing the Agent interface to create an agent that can handle multi-agent workflows. Any guidance on that or should I read how ToolLoopAgent is implemented in the repo? https://v6.ai-sdk.dev/docs/announcing-ai-sdk-6-beta#custom-agent-implementations


Jacob Paris (@jacobparis) · 2025-11-04 · ♥ 1

This sort of setup is easier with the new Workflows DevKit, here's an example of an evaluator pattern

https://github.com/vercel/workflow-examples/blob/main/ai-sdk-workflow-patterns/workflows/evaluator-workflow.ts

Otherwise – 

I'd recommend using a single API route for the useChat endpoint, since keeping the streams straight is the hardest part. 

You can use ToolLoopAgent directly and just give it the requirements for 5 jokes with passing evaluations. As long as it has enough tools to generate a new joke and to evaluate one it will continue until the requirements are met 

https://v6.ai-sdk.dev/docs/agents/loop-control


waso (@cervonwong) · 2025-11-05

Hey, thanks for the reply.

I was wondering since generateText and streamText etc. can do multi-step reasoning and tool calling steps like agents, can we also stream their reasoning and toolcalling steps like working with agents in useChat? Except generateText/streamText doesn’t have  a nice `useChat` hook that comes with it for me to display their reasoning and tool calls. How should I implement this?


Sharathnb10 9222 (@sharathnb10-9222) · 2026-01-04

This is the same issue i am facing. You show us how to build agents. But we don’t have way to use this agents in [Workflow Patterns](https://ai-sdk.dev/docs/agents/workflows#workflow-patterns) you show. How do we use the sub agents then ?   How do we stream the tools call of agents back ?