Published: April 19, 2025
6
0
17

Here's a ๐Ÿงต on how to use AI SDK + stream nested agents in tool calls made by your main agent ๐Ÿ‘‡

1/ Create a function to help you setup the tools (it helps to inject the dataStream into its context)

Image in tweet by Thomas Jiang

2/ Create a stream helper to help you manipulate the dataStream we're manually writing to the dataStream according to AI SDK's stream protocol, not great, but works

Image in tweet by Thomas Jiang

3/ Create your tool spec

Image in tweet by Thomas Jiang

4/ Finally, put everything together

Image in tweet by Thomas Jiang

Share this thread

Read on Twitter

View original thread

Navigate thread

1/5