'use client'; import { motion } from 'framer-motion'; export function AgentCodeSlide(): React.ReactElement { return (
Pass meta-tools to generateText with maxSteps
const
result =
await
generateText
{'({'}
{'\n'}
{' '}
model
:
openai
(
{"'gpt-4o'"}
),
{'\n'}
{' '}
tools
{': {'}
{'\n'}
{' '}
search
:
searchTpmjsToolsTool
,
{'\n'}
{' '}
execute
:
registryExecuteTool
,
{'\n'}
{' },'}
{'\n'}
{' '}
maxSteps
:
10
,
{' // Allow multiple tool calls'}
{'\n'}
{' '}
system
:
`You are an assistant that can find and use
{'\n'}
{' '}
tools from the TPMJS registry. First search for
{'\n'}
relevant tools, then execute them.`
,
{'\n'}
{' '}
prompt
: userRequest,
{'\n'}
{'});'}
Key: maxSteps allows the agent to search, then execute, then reason about results