UNPKG

@mastra/core

Version:
1 lines • 22 kB
{"version":3,"file":"tool-loop-agent--q5ddGzV.cjs","names":["ToolLoopAgent","getToolLoopAgentSettings","resolveModelConfig","isSupportedLanguageModel","generateId","Agent"],"sources":["../src/tool-loop-agent/utils.ts","../src/tool-loop-agent/tool-loop-processor.ts","../src/tool-loop-agent/index.ts"],"sourcesContent":["import { ToolLoopAgent } from '@internal/ai-v6';\nimport type { ToolLoopAgentSettings } from '@internal/ai-v6';\n\n/**\n * Shape of a ToolLoopAgent-like object for runtime extraction.\n * We use this looser type because TypeScript's structural typing doesn't work\n * well with private properties across different package declarations.\n */\nexport interface ToolLoopAgentLike {\n readonly id?: string;\n readonly version?: string;\n // The settings property is private in ToolLoopAgent but accessible at runtime\n // We don't declare it here since we access it via type casting\n}\n\nexport function isToolLoopAgentLike(obj: any): obj is ToolLoopAgentLike {\n if (!obj) return false;\n if (obj instanceof ToolLoopAgent) return true;\n return (\n 'version' in obj &&\n typeof obj.version === 'string' &&\n (obj.version === 'agent-v1' || obj.version.startsWith('agent-v'))\n );\n}\n\n/**\n * Extracts the settings from a ToolLoopAgent instance.\n * ToolLoopAgent.settings is private in TypeScript but accessible at runtime.\n */\nexport function getSettings(agent: ToolLoopAgentLike): ToolLoopAgentSettings<any, any, any> {\n const settings = (agent as unknown as { settings: ToolLoopAgentSettings<any, any, any> }).settings;\n if (!settings) {\n throw new Error('Could not extract settings from ToolLoopAgent. The agent may be from an incompatible version.');\n }\n return settings;\n}\n","import type {\n ToolLoopAgent,\n AgentCallParameters,\n ModelMessage,\n StepResult,\n ToolLoopAgentSettings,\n} from '@internal/ai-v6';\nimport { isSupportedLanguageModel } from '../agent';\nimport type { AgentExecutionOptions, AgentInstructions } from '../agent';\nimport { resolveModelConfig } from '../llm/model/resolve-model';\nimport type { MastraLanguageModel } from '../llm/model/shared.types';\nimport type { ProcessInputStepArgs, ProcessInputStepResult, Processor } from '../processors';\nimport { getSettings as getToolLoopAgentSettings } from './utils';\nimport type { ToolLoopAgentLike } from './utils';\n\ntype PrepareCallInput = AgentCallParameters<never> &\n Pick<\n ToolLoopAgentSettings<never, any, any>,\n | 'model'\n | 'tools'\n | 'maxOutputTokens'\n | 'temperature'\n | 'topP'\n | 'topK'\n | 'presencePenalty'\n | 'frequencyPenalty'\n | 'stopSequences'\n | 'seed'\n | 'headers'\n | 'instructions'\n | 'stopWhen'\n | 'experimental_telemetry'\n | 'activeTools'\n | 'providerOptions'\n | 'experimental_context'\n | 'experimental_download'\n >;\n\nexport class ToolLoopAgentProcessor implements Processor<'tool-loop-agent-processor'> {\n readonly id = 'tool-loop-agent-processor';\n readonly name = 'ToolLoop to Mastra Agent Processor';\n\n private agent: ToolLoopAgentLike;\n private settings: ToolLoopAgentSettings<any, any, any>;\n private prepareCallResult?: Awaited<ReturnType<NonNullable<ToolLoopAgentSettings<any, any, any>['prepareCall']>>>;\n\n constructor(agent: ToolLoopAgentLike) {\n this.agent = agent;\n this.settings = getToolLoopAgentSettings(agent);\n }\n\n public getAgentConfig() {\n const tools = 'tools' in this.agent ? (this.agent as ToolLoopAgent).tools : undefined;\n\n // Build default options from ToolLoopAgent config params\n const defaultOptions: Omit<AgentExecutionOptions<unknown>, 'abortSignal'> = {};\n\n // AgentExecutionOptions\n if (this.settings.toolChoice) {\n defaultOptions.toolChoice = this.settings.toolChoice;\n }\n if (this.settings.providerOptions) {\n defaultOptions.providerOptions = this.settings.providerOptions;\n }\n // AgentExecutionOptions[\"modelSettings\"]\n if (this.settings.temperature !== undefined) {\n defaultOptions.modelSettings = {\n ...(defaultOptions.modelSettings ?? {}),\n temperature: this.settings.temperature,\n };\n }\n if (this.settings.topP !== undefined) {\n defaultOptions.modelSettings = { ...(defaultOptions.modelSettings ?? {}), topP: this.settings.topP };\n }\n if (this.settings.topK !== undefined) {\n defaultOptions.modelSettings = { ...(defaultOptions.modelSettings ?? {}), topK: this.settings.topK };\n }\n if (this.settings.seed !== undefined) {\n defaultOptions.modelSettings = { ...(defaultOptions.modelSettings ?? {}), seed: this.settings.seed };\n }\n if (this.settings.maxOutputTokens !== undefined) {\n defaultOptions.modelSettings = {\n ...(defaultOptions.modelSettings ?? {}),\n maxOutputTokens: this.settings.maxOutputTokens,\n };\n }\n if (this.settings.presencePenalty !== undefined) {\n defaultOptions.modelSettings = {\n ...(defaultOptions.modelSettings ?? {}),\n presencePenalty: this.settings.presencePenalty,\n };\n }\n if (this.settings.frequencyPenalty !== undefined) {\n defaultOptions.modelSettings = {\n ...(defaultOptions.modelSettings ?? {}),\n frequencyPenalty: this.settings.frequencyPenalty,\n };\n }\n if (this.settings.stopSequences !== undefined) {\n defaultOptions.modelSettings = {\n ...(defaultOptions.modelSettings ?? {}),\n stopSequences: this.settings.stopSequences,\n };\n }\n if (this.settings.stopWhen) {\n // TODO: The callback signatures differ (Types of parameters stepResult and event are incompatible)\n defaultOptions.stopWhen = this.settings.stopWhen as any;\n }\n if (this.settings.onStepFinish) {\n // TODO: The callback signatures differ (Types of parameters stepResult and event are incompatible)\n defaultOptions.onStepFinish = this.settings.onStepFinish as any;\n }\n if (this.settings.onFinish) {\n // TODO: The callback signatures differ (Types of parameters 'event' and 'event' are incompatible)\n defaultOptions.onFinish = this.settings.onFinish as any;\n }\n\n return {\n id: this.settings.id,\n name: this.settings.id,\n instructions: (this.settings.instructions as AgentInstructions) ?? '',\n model: this.settings.model,\n tools,\n maxRetries: this.settings.maxRetries,\n defaultOptions: Object.keys(defaultOptions).length > 0 ? defaultOptions : undefined,\n };\n }\n\n /**\n * Maps prepareCall or prepareStep result to ProcessInputStepResult.\n * Both hooks return similar structures that can override model, tools, activeTools, etc.\n */\n private mapToProcessInputStepResult(\n result: Awaited<ReturnType<NonNullable<ToolLoopAgentSettings<any, any, any>['prepareCall']>>> | undefined,\n ): ProcessInputStepResult {\n if (!result) {\n return {};\n }\n\n const stepResult: ProcessInputStepResult = {};\n\n // Map model (both prepareCall and prepareStep can return this)\n if (result.model) {\n stepResult.model = result.model;\n }\n\n // Map tools (prepareCall can return this)\n if ('tools' in result && result.tools) {\n stepResult.tools = result.tools as Record<string, unknown>;\n }\n\n // Map toolChoice (prepareStep can return this)\n if ('toolChoice' in result && result.toolChoice !== undefined) {\n stepResult.toolChoice = result.toolChoice as ProcessInputStepResult['toolChoice'];\n }\n\n // Map activeTools (both can return this)\n if (result.activeTools) {\n stepResult.activeTools = result.activeTools as string[];\n }\n\n // Map providerOptions (prepareCall can return this)\n if ('providerOptions' in result && result.providerOptions) {\n stepResult.providerOptions = result.providerOptions;\n }\n\n // Map model settings (prepareCall can return individual settings)\n const modelSettings: ProcessInputStepResult['modelSettings'] = {};\n if ('temperature' in result && result.temperature !== undefined) {\n modelSettings.temperature = result.temperature;\n }\n if ('topP' in result && result.topP !== undefined) {\n modelSettings.topP = result.topP;\n }\n if ('topK' in result && result.topK !== undefined) {\n modelSettings.topK = result.topK;\n }\n if ('maxOutputTokens' in result && result.maxOutputTokens !== undefined) {\n modelSettings.maxOutputTokens = result.maxOutputTokens;\n }\n if ('presencePenalty' in result && result.presencePenalty !== undefined) {\n modelSettings.presencePenalty = result.presencePenalty;\n }\n if ('frequencyPenalty' in result && result.frequencyPenalty !== undefined) {\n modelSettings.frequencyPenalty = result.frequencyPenalty;\n }\n if ('stopSequences' in result && result.stopSequences !== undefined) {\n modelSettings.stopSequences = result.stopSequences;\n }\n if ('seed' in result && result.seed !== undefined) {\n modelSettings.seed = result.seed;\n }\n\n if (Object.keys(modelSettings).length > 0) {\n stepResult.modelSettings = modelSettings;\n }\n\n // Map system/instructions to systemMessages\n // prepareCall returns 'instructions', prepareStep returns 'system'\n const systemContent =\n 'instructions' in result ? result.instructions : 'system' in result ? result.system : undefined;\n if (systemContent) {\n // Convert to CoreMessageV4 format\n if (typeof systemContent === 'string') {\n stepResult.systemMessages = [{ role: 'system', content: systemContent }];\n } else if (Array.isArray(systemContent)) {\n stepResult.systemMessages = systemContent.map(msg =>\n typeof msg === 'string' ? { role: 'system' as const, content: msg } : msg,\n );\n } else if (typeof systemContent === 'object' && 'role' in systemContent && 'content' in systemContent) {\n stepResult.systemMessages = [systemContent as { role: 'system'; content: string }];\n }\n }\n\n // Map messages if prepareStep returns them\n // Convert AI SDK ModelMessage[] to MastraDBMessage[]\n if ('messages' in result && result.messages && Array.isArray(result.messages)) {\n // AI SDK v6 ModelMessage is compatible with MessageListInput at runtime\n // stepResult.messages = convertMessages(result.messages as any).to('Mastra.V2');\n stepResult.messages = result.messages as any;\n }\n\n return stepResult;\n }\n\n private async handlePrepareCall(args: ProcessInputStepArgs) {\n if (this.settings.prepareCall) {\n const { model, messages, activeTools, providerOptions, modelSettings, tools } = args;\n // TODO: This should probably happen in processInput, currently calling in processInputStep if stepNumber === 0\n\n // Build the prepareCall input object\n // AI SDK prepareCall expects: AgentCallParameters & Pick<ToolLoopAgentSettings, ...settings>\n const prepareCallInput: PrepareCallInput = {\n // TODO: prepareCall expects messages in AI SDK format, we have them in Mastra format\n messages: messages as unknown as any,\n model,\n tools,\n instructions: this.settings.instructions,\n stopWhen: this.settings.stopWhen,\n activeTools,\n providerOptions,\n\n // Model settings\n temperature: modelSettings?.temperature,\n topP: modelSettings?.topP,\n topK: modelSettings?.topK,\n maxOutputTokens: modelSettings?.maxOutputTokens,\n presencePenalty: modelSettings?.presencePenalty,\n frequencyPenalty: modelSettings?.frequencyPenalty,\n stopSequences: modelSettings?.stopSequences,\n seed: modelSettings?.seed,\n\n // Experimental options\n // experimental_telemetry: this.settings.experimental_telemetry,\n // experimental_context: this.settings.experimental_context,\n // experimental_download: this.settings.experimental_download,\n };\n\n // Call prepareCall and apply any returned overrides\n const prepareCallResult = await this.settings.prepareCall(prepareCallInput as any); // TODO: types\n this.prepareCallResult = prepareCallResult;\n }\n }\n\n private async handlePrepareStep(args: ProcessInputStepArgs, currentResult: ProcessInputStepResult) {\n if (this.settings.prepareStep) {\n const { messages, steps, stepNumber } = args;\n\n let model = args.model;\n if (currentResult.model) {\n const resolvedModel = await resolveModelConfig(currentResult.model);\n if (!isSupportedLanguageModel(resolvedModel)) {\n throw new Error('prepareStep returned an unsupported model version');\n }\n model = resolvedModel;\n }\n\n // Use the model from currentResult if prepareCall overrode it, otherwise use args.model\n\n // Note: We pass messages and steps in Mastra format rather than converting to AI SDK format.\n // This is intentional - most prepareStep callbacks only return overrides and don't inspect\n // the message content. The type casts handle the format difference at runtime.\n const prepareStepInputArgs: {\n /**\n * The steps that have been executed so far.\n */\n steps: Array<StepResult<NoInfer<any>>>;\n /**\n * The number of the step that is being executed.\n */\n stepNumber: number;\n /**\n * The model instance that is being used for this step.\n */\n model: MastraLanguageModel;\n /**\n * The messages that will be sent to the model for the current step.\n * Note: These are in Mastra format (MastraDBMessage[]), not AI SDK ModelMessage format.\n */\n messages: Array<ModelMessage>;\n /**\n * The context passed via the experimental_context setting (experimental).\n */\n experimental_context: unknown;\n } = {\n model,\n // Messages are in Mastra format (MastraDBMessage[])\n messages: messages as any,\n // Steps may have minor type differences in usage properties (inputTokenDetails/outputTokenDetails)\n steps: steps as any,\n stepNumber,\n experimental_context: undefined,\n };\n\n const prepareStepResult = await this.settings.prepareStep(prepareStepInputArgs);\n return prepareStepResult;\n }\n }\n\n async processInputStep(args: ProcessInputStepArgs): Promise<ProcessInputStepResult | undefined | void> {\n const { stepNumber } = args;\n\n if (stepNumber === 0 && this.settings.prepareCall) {\n await this.handlePrepareCall(args);\n }\n\n let result: ProcessInputStepResult = {};\n\n // Apply prepareCall result (only on step 0, already called above)\n if (this.prepareCallResult) {\n const mappedResult = this.mapToProcessInputStepResult(this.prepareCallResult);\n if (Object.keys(mappedResult).length > 0) {\n result = { ...result, ...mappedResult };\n }\n }\n\n // Apply prepareStep result (called on every step)\n // Pass the current result so prepareStep sees any overrides from prepareCall\n if (this.settings.prepareStep) {\n const prepareStepResult = await this.handlePrepareStep(args, result);\n if (prepareStepResult) {\n const mappedResult = this.mapToProcessInputStepResult(prepareStepResult as any);\n // prepareStep overrides prepareCall for this step\n result = { ...result, ...mappedResult };\n }\n }\n\n return result;\n }\n}\n","import { generateId } from '@internal/ai-sdk-v5';\nimport { Agent } from '../agent';\nimport { ToolLoopAgentProcessor } from './tool-loop-processor';\nimport type { ToolLoopAgentLike } from './utils';\nexport { type ToolLoopAgentLike, isToolLoopAgentLike, getSettings } from './utils';\n\n/**\n * Converts an AI SDK v6 ToolLoopAgent instance into a Mastra Agent.\n *\n * This enables users to create a ToolLoopAgent using AI SDK's API\n * while gaining access to Mastra features like memory, processors, scorers, and observability.\n *\n * @example\n * ```typescript\n * import { ToolLoopAgent, tool } from 'ai';\n * import { openai } from '@ai-sdk/openai';\n * import { toolLoopAgentToMastraAgent } from '@mastra/core/tool-loop-agent';\n *\n * const toolLoopAgent = new ToolLoopAgent({\n * id: 'weather-agent',\n * model: openai('gpt-4o'),\n * instructions: 'You are a helpful weather assistant.',\n * tools: { weather: weatherTool },\n * temperature: 0.7,\n * });\n *\n * const mastraAgent = toolLoopAgentToMastraAgent(toolLoopAgent);\n *\n * const result = await mastraAgent.generate({ prompt: 'What is the weather in NYC?' });\n * ```\n *\n * @param agent - The ToolLoopAgent instance\n * @param options - Optional name fallback since Mastra Agent requires id/name but ToolLoopAgent doesn't\n * @returns A Mastra Agent instance\n */\nexport function toolLoopAgentToMastraAgent(agent: ToolLoopAgentLike, options?: { fallbackName?: string }) {\n const processor = new ToolLoopAgentProcessor(agent);\n const agentConfig = processor.getAgentConfig();\n const id = agentConfig.id || options?.fallbackName || `tool-loop-agent-${generateId()}`;\n\n return new Agent({\n ...agentConfig,\n id,\n name: agentConfig.name || id,\n inputProcessors: [processor],\n });\n}\n"],"mappings":";;;;;;AAeA,SAAgB,oBAAoB,KAAoC;CACtE,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,eAAeA,qBAAAA,eAAe,OAAO;CACzC,OACE,aAAa,OACb,OAAO,IAAI,YAAY,aACtB,IAAI,YAAY,cAAc,IAAI,QAAQ,WAAW,SAAS;AAEnE;;;;;AAMA,SAAgB,YAAY,OAAgE;CAC1F,MAAM,WAAY,M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