@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
36 lines • 1.41 kB
TypeScript
import { Agent } from '../agent/index.js';
import type { ToolLoopAgentLike } from './utils.js';
export { type ToolLoopAgentLike, isToolLoopAgentLike, getSettings } from './utils.js';
/**
* Converts an AI SDK v6 ToolLoopAgent instance into a Mastra Agent.
*
* This enables users to create a ToolLoopAgent using AI SDK's API
* while gaining access to Mastra features like memory, processors, scorers, and observability.
*
* @example
* ```typescript
* import { ToolLoopAgent, tool } from 'ai';
* import { openai } from '@ai-sdk/openai';
* import { toolLoopAgentToMastraAgent } from '@mastra/core/tool-loop-agent';
*
* const toolLoopAgent = new ToolLoopAgent({
* id: 'weather-agent',
* model: openai('gpt-4o'),
* instructions: 'You are a helpful weather assistant.',
* tools: { weather: weatherTool },
* temperature: 0.7,
* });
*
* const mastraAgent = toolLoopAgentToMastraAgent(toolLoopAgent);
*
* const result = await mastraAgent.generate({ prompt: 'What is the weather in NYC?' });
* ```
*
* @param agent - The ToolLoopAgent instance
* @param options - Optional name fallback since Mastra Agent requires id/name but ToolLoopAgent doesn't
* @returns A Mastra Agent instance
*/
export declare function toolLoopAgentToMastraAgent(agent: ToolLoopAgentLike, options?: {
fallbackName?: string;
}): Agent<string, {}, unknown, unknown>;
//# sourceMappingURL=index.d.ts.map