Most AI agents call tools one at a time. Every call re-sends your entire conversation to the model, which is why they get slow and expensive fast.
There's a better way: let the model write one script that calls all the tools itself. Anthropic and OpenAI ship versions of this in their own products, but it was never clear how to build it yourself with any model, any provider, any sandbox.
In this video I break down the concept until it clicks, then show you how to actually implement it with Mastra, working with any model through any provider.
Timestamps:
0:00 The problem
0:23 Why tool calls get expensive
1:05 What this video covers
1:29 Where I got stuck
2:10 The concept
2:26 What models are actually good at
3:24 Seeing it in action
4:13 The results
4:44 One tool instead of many
5:02 Setting up with Mastra
5:10 The classic agent
5:57 Adding code mode
6:30 Where the code actually runs
7:04 Choosing a sandbox
7:31 How the tools get declared
8:03 Tradeoffs
8:20 When to use this
Links:
Mastra: https://mastra.ai/blog/introducing-code-mode
Repo: https://github.com/Quintui/code-mode-mastra
X: https://x.com/kristianvtr/status/2079180359791444229
There's a better way: let the model write one script that calls all the tools itself. Anthropic and OpenAI ship versions of this in their own products, but it was never clear how to build it yourself with any model, any provider, any sandbox.
In this video I break down the concept until it clicks, then show you how to actually implement it with Mastra, working with any model through any provider.
Timestamps:
0:00 The problem
0:23 Why tool calls get expensive
1:05 What this video covers
1:29 Where I got stuck
2:10 The concept
2:26 What models are actually good at
3:24 Seeing it in action
4:13 The results
4:44 One tool instead of many
5:02 Setting up with Mastra
5:10 The classic agent
5:57 Adding code mode
6:30 Where the code actually runs
7:04 Choosing a sandbox
7:31 How the tools get declared
8:03 Tradeoffs
8:20 When to use this
Links:
Mastra: https://mastra.ai/blog/introducing-code-mode
Repo: https://github.com/Quintui/code-mode-mastra
X: https://x.com/kristianvtr/status/2079180359791444229
- Категория
- AI Инструменты
Комментариев нет.
