ai 6.0.0-beta.56 → 6.0.0-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
 - package/README.md +4 -4
 - package/dist/index.d.mts +21 -16
 - package/dist/index.d.ts +21 -16
 - package/dist/index.js +6 -6
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +5 -5
 - package/dist/index.mjs.map +1 -1
 - package/dist/internal/index.js +1 -1
 - package/dist/internal/index.mjs +1 -1
 - package/package.json +1 -1
 
    
        package/CHANGELOG.md
    CHANGED
    
    
    
        package/README.md
    CHANGED
    
    | 
         @@ -69,9 +69,9 @@ const { object } = await generateObject({ 
     | 
|
| 
       69 
69 
     | 
    
         
             
            ### Agents
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
71 
     | 
    
         
             
            ```ts
         
     | 
| 
       72 
     | 
    
         
            -
            import {  
     | 
| 
      
 72 
     | 
    
         
            +
            import { ToolLoopAgent } from 'ai';
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
            const sandboxAgent = new  
     | 
| 
      
 74 
     | 
    
         
            +
            const sandboxAgent = new ToolLoopAgent({
         
     | 
| 
       75 
75 
     | 
    
         
             
              model: 'openai/gpt-5-codex',
         
     | 
| 
       76 
76 
     | 
    
         
             
              system: 'You are an agent with access to a shell environment.',
         
     | 
| 
       77 
77 
     | 
    
         
             
              tools: {
         
     | 
| 
         @@ -101,9 +101,9 @@ npm install @ai-sdk/react 
     | 
|
| 
       101 
101 
     | 
    
         | 
| 
       102 
102 
     | 
    
         
             
            ```ts
         
     | 
| 
       103 
103 
     | 
    
         
             
            import { openai } from '@ai-sdk/openai';
         
     | 
| 
       104 
     | 
    
         
            -
            import {  
     | 
| 
      
 104 
     | 
    
         
            +
            import { ToolLoopAgent, InferAgentUIMessage } from 'ai';
         
     | 
| 
       105 
105 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
            export const imageGenerationAgent = new  
     | 
| 
      
 106 
     | 
    
         
            +
            export const imageGenerationAgent = new ToolLoopAgent({
         
     | 
| 
       107 
107 
     | 
    
         
             
              model: openai('gpt-5'),
         
     | 
| 
       108 
108 
     | 
    
         
             
              tools: {
         
     | 
| 
       109 
109 
     | 
    
         
             
                image_generation: openai.tools.imageGeneration({
         
     | 
    
        package/dist/index.d.mts
    CHANGED
    
    | 
         @@ -2375,8 +2375,11 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2375 
2375 
     | 
    
         
             
            };
         
     | 
| 
       2376 
2376 
     | 
    
         | 
| 
       2377 
2377 
     | 
    
         
             
            /**
         
     | 
| 
       2378 
     | 
    
         
            -
             * An  
     | 
| 
       2379 
     | 
    
         
            -
             *  
     | 
| 
      
 2378 
     | 
    
         
            +
             * An Agent receives a prompt (text or messages) and generates or streams an output
         
     | 
| 
      
 2379 
     | 
    
         
            +
             * that consists of steps, tool calls, data parts, etc.
         
     | 
| 
      
 2380 
     | 
    
         
            +
             *
         
     | 
| 
      
 2381 
     | 
    
         
            +
             * You can implement your own Agent by implementing the `Agent` interface,
         
     | 
| 
      
 2382 
     | 
    
         
            +
             * or use the `ToolLoopAgent` class.
         
     | 
| 
       2380 
2383 
     | 
    
         
             
             */
         
     | 
| 
       2381 
2384 
     | 
    
         
             
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> {
         
     | 
| 
       2382 
2385 
     | 
    
         
             
                /**
         
     | 
| 
         @@ -2408,7 +2411,7 @@ Callback that is set using the `onFinish` option. 
     | 
|
| 
       2408 
2411 
     | 
    
         | 
| 
       2409 
2412 
     | 
    
         
             
            @param event - The event that is passed to the callback.
         
     | 
| 
       2410 
2413 
     | 
    
         
             
             */
         
     | 
| 
       2411 
     | 
    
         
            -
            type  
     | 
| 
      
 2414 
     | 
    
         
            +
            type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: StepResult<TOOLS> & {
         
     | 
| 
       2412 
2415 
     | 
    
         
             
                /**
         
     | 
| 
       2413 
2416 
     | 
    
         
             
            Details for all steps.
         
     | 
| 
       2414 
2417 
     | 
    
         
             
               */
         
     | 
| 
         @@ -2424,12 +2427,12 @@ Callback that is set using the `onStepFinish` option. 
     | 
|
| 
       2424 
2427 
     | 
    
         | 
| 
       2425 
2428 
     | 
    
         
             
            @param stepResult - The result of the step.
         
     | 
| 
       2426 
2429 
     | 
    
         
             
             */
         
     | 
| 
       2427 
     | 
    
         
            -
            type  
     | 
| 
      
 2430 
     | 
    
         
            +
            type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: StepResult<TOOLS>) => Promise<void> | void;
         
     | 
| 
       2428 
2431 
     | 
    
         | 
| 
       2429 
2432 
     | 
    
         
             
            /**
         
     | 
| 
       2430 
2433 
     | 
    
         
             
             * Configuration options for an agent.
         
     | 
| 
       2431 
2434 
     | 
    
         
             
             */
         
     | 
| 
       2432 
     | 
    
         
            -
            type  
     | 
| 
      
 2435 
     | 
    
         
            +
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> = CallSettings & {
         
     | 
| 
       2433 
2436 
     | 
    
         
             
                /**
         
     | 
| 
       2434 
2437 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2435 
2438 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2485,11 +2488,11 @@ type BasicAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTI 
     | 
|
| 
       2485 
2488 
     | 
    
         
             
                /**
         
     | 
| 
       2486 
2489 
     | 
    
         
             
                 * Callback that is called when each step (LLM call) is finished, including intermediate steps.
         
     | 
| 
       2487 
2490 
     | 
    
         
             
                 */
         
     | 
| 
       2488 
     | 
    
         
            -
                onStepFinish?:  
     | 
| 
      
 2491 
     | 
    
         
            +
                onStepFinish?: ToolLoopAgentOnStepFinishCallback<NoInfer<TOOLS>>;
         
     | 
| 
       2489 
2492 
     | 
    
         
             
                /**
         
     | 
| 
       2490 
2493 
     | 
    
         
             
                 * Callback that is called when all steps are finished and the response is complete.
         
     | 
| 
       2491 
2494 
     | 
    
         
             
                 */
         
     | 
| 
       2492 
     | 
    
         
            -
                onFinish?:  
     | 
| 
      
 2495 
     | 
    
         
            +
                onFinish?: ToolLoopAgentOnFinishCallback<NoInfer<TOOLS>>;
         
     | 
| 
       2493 
2496 
     | 
    
         
             
                /**
         
     | 
| 
       2494 
2497 
     | 
    
         
             
              Additional provider-specific options. They are passed through
         
     | 
| 
       2495 
2498 
     | 
    
         
             
              to the provider from the AI SDK and enable provider-specific
         
     | 
| 
         @@ -2507,17 +2510,19 @@ type BasicAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTI 
     | 
|
| 
       2507 
2510 
     | 
    
         
             
            };
         
     | 
| 
       2508 
2511 
     | 
    
         | 
| 
       2509 
2512 
     | 
    
         
             
            /**
         
     | 
| 
       2510 
     | 
    
         
            -
             *  
     | 
| 
       2511 
     | 
    
         
            -
             * and  
     | 
| 
       2512 
     | 
    
         
            -
             *
         
     | 
| 
       2513 
     | 
    
         
            -
             * It handles the agent loop for you, allowing the LLM to call tools multiple times in
         
     | 
| 
       2514 
     | 
    
         
            -
             * sequence to accomplish complex tasks.
         
     | 
| 
      
 2513 
     | 
    
         
            +
             * A tool loop agent is an agent that runs tools in a loop. In each step,
         
     | 
| 
      
 2514 
     | 
    
         
            +
             * it calls the LLM, and if there are tool calls, it executes the tools
         
     | 
| 
      
 2515 
     | 
    
         
            +
             * and calls the LLM again in a new step with the tool results.
         
     | 
| 
       2515 
2516 
     | 
    
         
             
             *
         
     | 
| 
       2516 
     | 
    
         
            -
             *  
     | 
| 
      
 2517 
     | 
    
         
            +
             * The loop continues until:
         
     | 
| 
      
 2518 
     | 
    
         
            +
             * - A finish reasoning other than tool-calls is returned, or
         
     | 
| 
      
 2519 
     | 
    
         
            +
             * - A tool that is invoked does not have an execute function, or
         
     | 
| 
      
 2520 
     | 
    
         
            +
             * - A tool call needs approval, or
         
     | 
| 
      
 2521 
     | 
    
         
            +
             * - A stop condition is met (default stop condition is stepCountIs(20))
         
     | 
| 
       2517 
2522 
     | 
    
         
             
             */
         
     | 
| 
       2518 
     | 
    
         
            -
            declare class  
     | 
| 
      
 2523 
     | 
    
         
            +
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> implements Agent<TOOLS, OUTPUT, OUTPUT_PARTIAL> {
         
     | 
| 
       2519 
2524 
     | 
    
         
             
                private readonly settings;
         
     | 
| 
       2520 
     | 
    
         
            -
                constructor(settings:  
     | 
| 
      
 2525 
     | 
    
         
            +
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT, OUTPUT_PARTIAL>);
         
     | 
| 
       2521 
2526 
     | 
    
         
             
                /**
         
     | 
| 
       2522 
2527 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2523 
2528 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -4906,4 +4911,4 @@ declare global { 
     | 
|
| 
       4906 
4911 
     | 
    
         
             
                var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
         
     | 
| 
       4907 
4912 
     | 
    
         
             
            }
         
     | 
| 
       4908 
4913 
     | 
    
         | 
| 
       4909 
     | 
    
         
            -
            export { AbstractChat, Agent, AsyncIterableStream,  
     | 
| 
      
 4914 
     | 
    
         
            +
            export { AbstractChat, Agent, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferAgentUIMessage, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
         
     | 
    
        package/dist/index.d.ts
    CHANGED
    
    | 
         @@ -2375,8 +2375,11 @@ type TextStreamPart<TOOLS extends ToolSet> = { 
     | 
|
| 
       2375 
2375 
     | 
    
         
             
            };
         
     | 
| 
       2376 
2376 
     | 
    
         | 
| 
       2377 
2377 
     | 
    
         
             
            /**
         
     | 
| 
       2378 
     | 
    
         
            -
             * An  
     | 
| 
       2379 
     | 
    
         
            -
             *  
     | 
| 
      
 2378 
     | 
    
         
            +
             * An Agent receives a prompt (text or messages) and generates or streams an output
         
     | 
| 
      
 2379 
     | 
    
         
            +
             * that consists of steps, tool calls, data parts, etc.
         
     | 
| 
      
 2380 
     | 
    
         
            +
             *
         
     | 
| 
      
 2381 
     | 
    
         
            +
             * You can implement your own Agent by implementing the `Agent` interface,
         
     | 
| 
      
 2382 
     | 
    
         
            +
             * or use the `ToolLoopAgent` class.
         
     | 
| 
       2380 
2383 
     | 
    
         
             
             */
         
     | 
| 
       2381 
2384 
     | 
    
         
             
            interface Agent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> {
         
     | 
| 
       2382 
2385 
     | 
    
         
             
                /**
         
     | 
| 
         @@ -2408,7 +2411,7 @@ Callback that is set using the `onFinish` option. 
     | 
|
| 
       2408 
2411 
     | 
    
         | 
| 
       2409 
2412 
     | 
    
         
             
            @param event - The event that is passed to the callback.
         
     | 
| 
       2410 
2413 
     | 
    
         
             
             */
         
     | 
| 
       2411 
     | 
    
         
            -
            type  
     | 
| 
      
 2414 
     | 
    
         
            +
            type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: StepResult<TOOLS> & {
         
     | 
| 
       2412 
2415 
     | 
    
         
             
                /**
         
     | 
| 
       2413 
2416 
     | 
    
         
             
            Details for all steps.
         
     | 
| 
       2414 
2417 
     | 
    
         
             
               */
         
     | 
| 
         @@ -2424,12 +2427,12 @@ Callback that is set using the `onStepFinish` option. 
     | 
|
| 
       2424 
2427 
     | 
    
         | 
| 
       2425 
2428 
     | 
    
         
             
            @param stepResult - The result of the step.
         
     | 
| 
       2426 
2429 
     | 
    
         
             
             */
         
     | 
| 
       2427 
     | 
    
         
            -
            type  
     | 
| 
      
 2430 
     | 
    
         
            +
            type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: StepResult<TOOLS>) => Promise<void> | void;
         
     | 
| 
       2428 
2431 
     | 
    
         | 
| 
       2429 
2432 
     | 
    
         
             
            /**
         
     | 
| 
       2430 
2433 
     | 
    
         
             
             * Configuration options for an agent.
         
     | 
| 
       2431 
2434 
     | 
    
         
             
             */
         
     | 
| 
       2432 
     | 
    
         
            -
            type  
     | 
| 
      
 2435 
     | 
    
         
            +
            type ToolLoopAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> = CallSettings & {
         
     | 
| 
       2433 
2436 
     | 
    
         
             
                /**
         
     | 
| 
       2434 
2437 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2435 
2438 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -2485,11 +2488,11 @@ type BasicAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTI 
     | 
|
| 
       2485 
2488 
     | 
    
         
             
                /**
         
     | 
| 
       2486 
2489 
     | 
    
         
             
                 * Callback that is called when each step (LLM call) is finished, including intermediate steps.
         
     | 
| 
       2487 
2490 
     | 
    
         
             
                 */
         
     | 
| 
       2488 
     | 
    
         
            -
                onStepFinish?:  
     | 
| 
      
 2491 
     | 
    
         
            +
                onStepFinish?: ToolLoopAgentOnStepFinishCallback<NoInfer<TOOLS>>;
         
     | 
| 
       2489 
2492 
     | 
    
         
             
                /**
         
     | 
| 
       2490 
2493 
     | 
    
         
             
                 * Callback that is called when all steps are finished and the response is complete.
         
     | 
| 
       2491 
2494 
     | 
    
         
             
                 */
         
     | 
| 
       2492 
     | 
    
         
            -
                onFinish?:  
     | 
| 
      
 2495 
     | 
    
         
            +
                onFinish?: ToolLoopAgentOnFinishCallback<NoInfer<TOOLS>>;
         
     | 
| 
       2493 
2496 
     | 
    
         
             
                /**
         
     | 
| 
       2494 
2497 
     | 
    
         
             
              Additional provider-specific options. They are passed through
         
     | 
| 
       2495 
2498 
     | 
    
         
             
              to the provider from the AI SDK and enable provider-specific
         
     | 
| 
         @@ -2507,17 +2510,19 @@ type BasicAgentSettings<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTI 
     | 
|
| 
       2507 
2510 
     | 
    
         
             
            };
         
     | 
| 
       2508 
2511 
     | 
    
         | 
| 
       2509 
2512 
     | 
    
         
             
            /**
         
     | 
| 
       2510 
     | 
    
         
            -
             *  
     | 
| 
       2511 
     | 
    
         
            -
             * and  
     | 
| 
       2512 
     | 
    
         
            -
             *
         
     | 
| 
       2513 
     | 
    
         
            -
             * It handles the agent loop for you, allowing the LLM to call tools multiple times in
         
     | 
| 
       2514 
     | 
    
         
            -
             * sequence to accomplish complex tasks.
         
     | 
| 
      
 2513 
     | 
    
         
            +
             * A tool loop agent is an agent that runs tools in a loop. In each step,
         
     | 
| 
      
 2514 
     | 
    
         
            +
             * it calls the LLM, and if there are tool calls, it executes the tools
         
     | 
| 
      
 2515 
     | 
    
         
            +
             * and calls the LLM again in a new step with the tool results.
         
     | 
| 
       2515 
2516 
     | 
    
         
             
             *
         
     | 
| 
       2516 
     | 
    
         
            -
             *  
     | 
| 
      
 2517 
     | 
    
         
            +
             * The loop continues until:
         
     | 
| 
      
 2518 
     | 
    
         
            +
             * - A finish reasoning other than tool-calls is returned, or
         
     | 
| 
      
 2519 
     | 
    
         
            +
             * - A tool that is invoked does not have an execute function, or
         
     | 
| 
      
 2520 
     | 
    
         
            +
             * - A tool call needs approval, or
         
     | 
| 
      
 2521 
     | 
    
         
            +
             * - A stop condition is met (default stop condition is stepCountIs(20))
         
     | 
| 
       2517 
2522 
     | 
    
         
             
             */
         
     | 
| 
       2518 
     | 
    
         
            -
            declare class  
     | 
| 
      
 2523 
     | 
    
         
            +
            declare class ToolLoopAgent<TOOLS extends ToolSet = {}, OUTPUT = never, OUTPUT_PARTIAL = never> implements Agent<TOOLS, OUTPUT, OUTPUT_PARTIAL> {
         
     | 
| 
       2519 
2524 
     | 
    
         
             
                private readonly settings;
         
     | 
| 
       2520 
     | 
    
         
            -
                constructor(settings:  
     | 
| 
      
 2525 
     | 
    
         
            +
                constructor(settings: ToolLoopAgentSettings<TOOLS, OUTPUT, OUTPUT_PARTIAL>);
         
     | 
| 
       2521 
2526 
     | 
    
         
             
                /**
         
     | 
| 
       2522 
2527 
     | 
    
         
             
                 * The id of the agent.
         
     | 
| 
       2523 
2528 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -4906,4 +4911,4 @@ declare global { 
     | 
|
| 
       4906 
4911 
     | 
    
         
             
                var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
         
     | 
| 
       4907 
4912 
     | 
    
         
             
            }
         
     | 
| 
       4908 
4913 
     | 
    
         | 
| 
       4909 
     | 
    
         
            -
            export { AbstractChat, Agent, AsyncIterableStream,  
     | 
| 
      
 4914 
     | 
    
         
            +
            export { AbstractChat, Agent, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferAgentUIMessage, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolApprovalRequestOutput, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
         
     | 
    
        package/dist/index.js
    CHANGED
    
    | 
         @@ -23,11 +23,10 @@ __export(src_exports, { 
     | 
|
| 
       23 
23 
     | 
    
         
             
              AISDKError: () => import_provider18.AISDKError,
         
     | 
| 
       24 
24 
     | 
    
         
             
              APICallError: () => import_provider18.APICallError,
         
     | 
| 
       25 
25 
     | 
    
         
             
              AbstractChat: () => AbstractChat,
         
     | 
| 
       26 
     | 
    
         
            -
              BasicAgent: () => BasicAgent,
         
     | 
| 
       27 
26 
     | 
    
         
             
              DefaultChatTransport: () => DefaultChatTransport,
         
     | 
| 
       28 
27 
     | 
    
         
             
              DownloadError: () => DownloadError,
         
     | 
| 
       29 
28 
     | 
    
         
             
              EmptyResponseBodyError: () => import_provider18.EmptyResponseBodyError,
         
     | 
| 
       30 
     | 
    
         
            -
              Experimental_Agent: () =>  
     | 
| 
      
 29 
     | 
    
         
            +
              Experimental_Agent: () => ToolLoopAgent,
         
     | 
| 
       31 
30 
     | 
    
         
             
              HttpChatTransport: () => HttpChatTransport,
         
     | 
| 
       32 
31 
     | 
    
         
             
              InvalidArgumentError: () => InvalidArgumentError,
         
     | 
| 
       33 
32 
     | 
    
         
             
              InvalidDataContentError: () => InvalidDataContentError,
         
     | 
| 
         @@ -57,6 +56,7 @@ __export(src_exports, { 
     | 
|
| 
       57 
56 
     | 
    
         
             
              TextStreamChatTransport: () => TextStreamChatTransport,
         
     | 
| 
       58 
57 
     | 
    
         
             
              TooManyEmbeddingValuesForCallError: () => import_provider18.TooManyEmbeddingValuesForCallError,
         
     | 
| 
       59 
58 
     | 
    
         
             
              ToolCallRepairError: () => ToolCallRepairError,
         
     | 
| 
      
 59 
     | 
    
         
            +
              ToolLoopAgent: () => ToolLoopAgent,
         
     | 
| 
       60 
60 
     | 
    
         
             
              TypeValidationError: () => import_provider18.TypeValidationError,
         
     | 
| 
       61 
61 
     | 
    
         
             
              UI_MESSAGE_STREAM_HEADERS: () => UI_MESSAGE_STREAM_HEADERS,
         
     | 
| 
       62 
62 
     | 
    
         
             
              UnsupportedFunctionalityError: () => import_provider18.UnsupportedFunctionalityError,
         
     | 
| 
         @@ -870,7 +870,7 @@ function detectMediaType({ 
     | 
|
| 
       870 
870 
     | 
    
         
             
            var import_provider_utils2 = require("@ai-sdk/provider-utils");
         
     | 
| 
       871 
871 
     | 
    
         | 
| 
       872 
872 
     | 
    
         
             
            // src/version.ts
         
     | 
| 
       873 
     | 
    
         
            -
            var VERSION = true ? "6.0.0-beta. 
     | 
| 
      
 873 
     | 
    
         
            +
            var VERSION = true ? "6.0.0-beta.57" : "0.0.0-test";
         
     | 
| 
       874 
874 
     | 
    
         | 
| 
       875 
875 
     | 
    
         
             
            // src/util/download/download.ts
         
     | 
| 
       876 
876 
     | 
    
         
             
            var download = async ({ url }) => {
         
     | 
| 
         @@ -6525,8 +6525,8 @@ function convertToModelMessages(messages, options) { 
     | 
|
| 
       6525 
6525 
     | 
    
         
             
            }
         
     | 
| 
       6526 
6526 
     | 
    
         
             
            var convertToCoreMessages = convertToModelMessages;
         
     | 
| 
       6527 
6527 
     | 
    
         | 
| 
       6528 
     | 
    
         
            -
            // src/agent/ 
     | 
| 
       6529 
     | 
    
         
            -
            var  
     | 
| 
      
 6528 
     | 
    
         
            +
            // src/agent/tool-loop-agent.ts
         
     | 
| 
      
 6529 
     | 
    
         
            +
            var ToolLoopAgent = class {
         
     | 
| 
       6530 
6530 
     | 
    
         
             
              constructor(settings) {
         
     | 
| 
       6531 
6531 
     | 
    
         
             
                this.settings = settings;
         
     | 
| 
       6532 
6532 
     | 
    
         
             
              }
         
     | 
| 
         @@ -11193,7 +11193,6 @@ function readUIMessageStream({ 
     | 
|
| 
       11193 
11193 
     | 
    
         
             
              AISDKError,
         
     | 
| 
       11194 
11194 
     | 
    
         
             
              APICallError,
         
     | 
| 
       11195 
11195 
     | 
    
         
             
              AbstractChat,
         
     | 
| 
       11196 
     | 
    
         
            -
              BasicAgent,
         
     | 
| 
       11197 
11196 
     | 
    
         
             
              DefaultChatTransport,
         
     | 
| 
       11198 
11197 
     | 
    
         
             
              DownloadError,
         
     | 
| 
       11199 
11198 
     | 
    
         
             
              EmptyResponseBodyError,
         
     | 
| 
         @@ -11227,6 +11226,7 @@ function readUIMessageStream({ 
     | 
|
| 
       11227 
11226 
     | 
    
         
             
              TextStreamChatTransport,
         
     | 
| 
       11228 
11227 
     | 
    
         
             
              TooManyEmbeddingValuesForCallError,
         
     | 
| 
       11229 
11228 
     | 
    
         
             
              ToolCallRepairError,
         
     | 
| 
      
 11229 
     | 
    
         
            +
              ToolLoopAgent,
         
     | 
| 
       11230 
11230 
     | 
    
         
             
              TypeValidationError,
         
     | 
| 
       11231 
11231 
     | 
    
         
             
              UI_MESSAGE_STREAM_HEADERS,
         
     | 
| 
       11232 
11232 
     | 
    
         
             
              UnsupportedFunctionalityError,
         
     |