import { z } from 'zod'; import { ServiceBubble } from '../../types/service-bubble-class.js'; import type { BubbleContext } from '../../types/bubble.js'; import { CredentialType } from '@bubblelab/shared-schemas'; import { AIMessage, AIMessageChunk } from '@langchain/core/messages'; import type { BaseMessage } from '@langchain/core/messages'; import { type AvailableTool } from '../../types/available-tools.js'; import type { BubbleName, BubbleResult } from '@bubblelab/shared-schemas'; import type { StreamingEvent } from '@bubblelab/shared-schemas'; import { ConversationMessageSchema } from '@bubblelab/shared-schemas'; export type ToolHookContext = { toolName: AvailableTool; toolInput: unknown; toolOutput?: BubbleResult; messages: BaseMessage[]; bubbleContext?: BubbleContext; }; export type ToolHookAfter = (context: ToolHookContext) => Promise<{ messages: BaseMessage[]; shouldStop?: boolean; }>; export type ToolHookBefore = (context: ToolHookContext) => Promise<{ messages: BaseMessage[]; toolInput: Record; shouldSkip?: boolean; skipMessage?: string; }>; export type AfterLLMCallContext = { messages: BaseMessage[]; lastAIMessage: AIMessage | AIMessageChunk; hasToolCalls: boolean; }; export type AfterLLMCallHook = (context: AfterLLMCallContext) => Promise<{ messages: BaseMessage[]; continueToAgent?: boolean; }>; export type StreamingCallback = (event: StreamingEvent) => Promise | void; /** Type for conversation history messages - enables KV cache optimization */ export type ConversationMessage = z.infer; declare const AIAgentParamsSchema: z.ZodObject<{ message: z.ZodString; images: z.ZodDefault>; data: z.ZodString; mimeType: z.ZodDefault; description: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "base64"; mimeType: string; data: string; description?: string | undefined; }, { data: string; type?: "base64" | undefined; description?: string | undefined; mimeType?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"url">; url: z.ZodString; description: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "url"; url: string; description?: string | undefined; }, { type: "url"; url: string; description?: string | undefined; }>]>, "many">>; conversationHistory: z.ZodOptional; content: z.ZodString; toolCallId: z.ZodOptional; name: z.ZodOptional; toolCalls: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; id: string; args: Record; }, { name: string; id: string; args: Record; }>, "many">>; }, "strip", z.ZodTypeAny, { role: "user" | "assistant" | "tool"; content: string; toolCallId?: string | undefined; name?: string | undefined; toolCalls?: { name: string; id: string; args: Record; }[] | undefined; }, { role: "user" | "assistant" | "tool"; content: string; toolCallId?: string | undefined; name?: string | undefined; toolCalls?: { name: string; id: string; args: Record; }[] | undefined; }>, "many">>; systemPrompt: z.ZodDefault; name: z.ZodOptional>; model: z.ZodDefault; temperature: z.ZodDefault; maxTokens: z.ZodDefault>; reasoningEffort: z.ZodOptional>; maxRetries: z.ZodDefault; provider: z.ZodOptional>; jsonMode: z.ZodDefault; backupModel: z.ZodDefault; temperature: z.ZodOptional; maxTokens: z.ZodOptional; reasoningEffort: z.ZodOptional>; maxRetries: z.ZodOptional; }, "strip", z.ZodTypeAny, { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; }, { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; }>>>; }, "strip", z.ZodTypeAny, { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature: number; maxTokens: number; maxRetries: number; jsonMode: boolean; backupModel: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; }; reasoningEffort?: "low" | "medium" | "high" | undefined; provider?: string[] | undefined; }, { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; provider?: string[] | undefined; jsonMode?: boolean | undefined; backupModel?: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; } | undefined; }>>; tools: z.ZodDefault; credentials: z.ZodOptional, z.ZodString>>>; config: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "app-rankings-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool"; credentials?: Partial> | undefined; config?: Record | undefined; }, { name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "app-rankings-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool"; credentials?: Partial> | undefined; config?: Record | undefined; }>, "many">>; customTools: z.ZodOptional, z.ZodType]>; func: z.ZodFunction], z.ZodUnknown>, z.ZodPromise>; }, "strip", z.ZodTypeAny, { description: string; name: string; schema: Record | z.ZodTypeAny; func: (args_0: Record, ...args: unknown[]) => Promise; }, { description: string; name: string; schema: Record | z.ZodTypeAny; func: (args_0: Record, ...args: unknown[]) => Promise; }>, "many">>>; maxIterations: z.ZodDefault; credentials: z.ZodOptional, z.ZodString>>; credentialPool: z.ZodOptional, z.ZodArray; attributes: z.ZodOptional>; }, "strip", z.ZodTypeAny, { value: string; name: string; id: number; isDefault?: boolean | undefined; attributes?: Record | undefined; }, { value: string; name: string; id: number; isDefault?: boolean | undefined; attributes?: Record | undefined; }>, "many">>>; streaming: z.ZodDefault; capabilities: z.ZodOptional]>>>; credentials: z.ZodOptional, z.ZodString>>>; context: z.ZodOptional; }, "strip", z.ZodTypeAny, { id: string; inputs: Record; credentials?: Partial> | undefined; context?: string | undefined; }, { id: string; credentials?: Partial> | undefined; inputs?: Record | undefined; context?: string | undefined; }>, "many">>>; expectedOutputSchema: z.ZodOptional, z.ZodString]>>; memoryEnabled: z.ZodDefault; enableSlackHistory: z.ZodDefault; }, "strip", z.ZodTypeAny, { message: string; model: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature: number; maxTokens: number; maxRetries: number; jsonMode: boolean; backupModel: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; }; reasoningEffort?: "low" | "medium" | "high" | undefined; provider?: string[] | undefined; }; streaming: boolean; tools: { name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "app-rankings-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool"; credentials?: Partial> | undefined; config?: Record | undefined; }[]; images: ({ type: "base64"; mimeType: string; data: string; description?: string | undefined; } | { type: "url"; url: string; description?: string | undefined; })[]; systemPrompt: string; maxIterations: number; memoryEnabled: boolean; enableSlackHistory: boolean; name?: string | undefined; credentials?: Partial> | undefined; conversationHistory?: { role: "user" | "assistant" | "tool"; content: string; toolCallId?: string | undefined; name?: string | undefined; toolCalls?: { name: string; id: string; args: Record; }[] | undefined; }[] | undefined; customTools?: { description: string; name: string; schema: Record | z.ZodTypeAny; func: (args_0: Record, ...args: unknown[]) => Promise; }[] | undefined; credentialPool?: Partial | undefined; }[]>> | undefined; capabilities?: { id: string; inputs: Record; credentials?: Partial> | undefined; context?: string | undefined; }[] | undefined; expectedOutputSchema?: string | z.ZodTypeAny | undefined; }, { message: string; name?: string | undefined; credentials?: Partial> | undefined; model?: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; provider?: string[] | undefined; jsonMode?: boolean | undefined; backupModel?: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; } | undefined; } | undefined; streaming?: boolean | undefined; tools?: { name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "app-rankings-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool"; credentials?: Partial> | undefined; config?: Record | undefined; }[] | undefined; images?: ({ data: string; type?: "base64" | undefined; description?: string | undefined; mimeType?: string | undefined; } | { type: "url"; url: string; description?: string | undefined; })[] | undefined; conversationHistory?: { role: "user" | "assistant" | "tool"; content: string; toolCallId?: string | undefined; name?: string | undefined; toolCalls?: { name: string; id: string; args: Record; }[] | undefined; }[] | undefined; systemPrompt?: string | undefined; customTools?: { description: string; name: string; schema: Record | z.ZodTypeAny; func: (args_0: Record, ...args: unknown[]) => Promise; }[] | undefined; maxIterations?: number | undefined; credentialPool?: Partial | undefined; }[]>> | undefined; capabilities?: { id: string; credentials?: Partial> | undefined; inputs?: Record | undefined; context?: string | undefined; }[] | undefined; expectedOutputSchema?: string | z.ZodTypeAny | undefined; memoryEnabled?: boolean | undefined; enableSlackHistory?: boolean | undefined; }>; declare const AIAgentResultSchema: z.ZodObject<{ response: z.ZodString; reasoning: z.ZodOptional>; toolCalls: z.ZodArray, "many">; iterations: z.ZodNumber; totalCost: z.ZodOptional; error: z.ZodString; success: z.ZodBoolean; }, "strip", z.ZodTypeAny, { error: string; success: boolean; response: string; toolCalls: { tool: string; input?: unknown; output?: unknown; }[]; iterations: number; reasoning?: string | null | undefined; totalCost?: number | undefined; }, { error: string; success: boolean; response: string; toolCalls: { tool: string; input?: unknown; output?: unknown; }[]; iterations: number; reasoning?: string | null | undefined; totalCost?: number | undefined; }>; export type AIAgentParams = z.input & { beforeToolCall?: ToolHookBefore; afterToolCall?: ToolHookAfter; afterLLMCall?: AfterLLMCallHook; streamingCallback?: StreamingCallback; }; export type AIAgentParamsParsed = z.output & { beforeToolCall?: ToolHookBefore; afterToolCall?: ToolHookAfter; afterLLMCall?: AfterLLMCallHook; streamingCallback?: StreamingCallback; }; export type AIAgentResult = z.output; export declare class AIAgentBubble extends ServiceBubble { static readonly type: "service"; static readonly service = "ai-agent"; static readonly authType: "apikey"; static readonly bubbleName: BubbleName; static readonly schema: z.ZodObject<{ message: z.ZodString; images: z.ZodDefault>; data: z.ZodString; mimeType: z.ZodDefault; description: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "base64"; mimeType: string; data: string; description?: string | undefined; }, { data: string; type?: "base64" | undefined; description?: string | undefined; mimeType?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"url">; url: z.ZodString; description: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "url"; url: string; description?: string | undefined; }, { type: "url"; url: string; description?: string | undefined; }>]>, "many">>; conversationHistory: z.ZodOptional; content: z.ZodString; toolCallId: z.ZodOptional; name: z.ZodOptional; toolCalls: z.ZodOptional; }, "strip", z.ZodTypeAny, { name: string; id: string; args: Record; }, { name: string; id: string; args: Record; }>, "many">>; }, "strip", z.ZodTypeAny, { role: "user" | "assistant" | "tool"; content: string; toolCallId?: string | undefined; name?: string | undefined; toolCalls?: { name: string; id: string; args: Record; }[] | undefined; }, { role: "user" | "assistant" | "tool"; content: string; toolCallId?: string | undefined; name?: string | undefined; toolCalls?: { name: string; id: string; args: Record; }[] | undefined; }>, "many">>; systemPrompt: z.ZodDefault; name: z.ZodOptional>; model: z.ZodDefault; temperature: z.ZodDefault; maxTokens: z.ZodDefault>; reasoningEffort: z.ZodOptional>; maxRetries: z.ZodDefault; provider: z.ZodOptional>; jsonMode: z.ZodDefault; backupModel: z.ZodDefault; temperature: z.ZodOptional; maxTokens: z.ZodOptional; reasoningEffort: z.ZodOptional>; maxRetries: z.ZodOptional; }, "strip", z.ZodTypeAny, { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; }, { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; }>>>; }, "strip", z.ZodTypeAny, { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature: number; maxTokens: number; maxRetries: number; jsonMode: boolean; backupModel: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; }; reasoningEffort?: "low" | "medium" | "high" | undefined; provider?: string[] | undefined; }, { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; provider?: string[] | undefined; jsonMode?: boolean | undefined; backupModel?: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; } | undefined; }>>; tools: z.ZodDefault; credentials: z.ZodOptional, z.ZodString>>>; config: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "app-rankings-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool"; credentials?: Partial> | undefined; config?: Record | undefined; }, { name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "app-rankings-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool"; credentials?: Partial> | undefined; config?: Record | undefined; }>, "many">>; customTools: z.ZodOptional, z.ZodType]>; func: z.ZodFunction], z.ZodUnknown>, z.ZodPromise>; }, "strip", z.ZodTypeAny, { description: string; name: string; schema: Record | z.ZodTypeAny; func: (args_0: Record, ...args: unknown[]) => Promise; }, { description: string; name: string; schema: Record | z.ZodTypeAny; func: (args_0: Record, ...args: unknown[]) => Promise; }>, "many">>>; maxIterations: z.ZodDefault; credentials: z.ZodOptional, z.ZodString>>; credentialPool: z.ZodOptional, z.ZodArray; attributes: z.ZodOptional>; }, "strip", z.ZodTypeAny, { value: string; name: string; id: number; isDefault?: boolean | undefined; attributes?: Record | undefined; }, { value: string; name: string; id: number; isDefault?: boolean | undefined; attributes?: Record | undefined; }>, "many">>>; streaming: z.ZodDefault; capabilities: z.ZodOptional]>>>; credentials: z.ZodOptional, z.ZodString>>>; context: z.ZodOptional; }, "strip", z.ZodTypeAny, { id: string; inputs: Record; credentials?: Partial> | undefined; context?: string | undefined; }, { id: string; credentials?: Partial> | undefined; inputs?: Record | undefined; context?: string | undefined; }>, "many">>>; expectedOutputSchema: z.ZodOptional, z.ZodString]>>; memoryEnabled: z.ZodDefault; enableSlackHistory: z.ZodDefault; }, "strip", z.ZodTypeAny, { message: string; model: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature: number; maxTokens: number; maxRetries: number; jsonMode: boolean; backupModel: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; }; reasoningEffort?: "low" | "medium" | "high" | undefined; provider?: string[] | undefined; }; streaming: boolean; tools: { name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "app-rankings-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool"; credentials?: Partial> | undefined; config?: Record | undefined; }[]; images: ({ type: "base64"; mimeType: string; data: string; description?: string | undefined; } | { type: "url"; url: string; description?: string | undefined; })[]; systemPrompt: string; maxIterations: number; memoryEnabled: boolean; enableSlackHistory: boolean; name?: string | undefined; credentials?: Partial> | undefined; conversationHistory?: { role: "user" | "assistant" | "tool"; content: string; toolCallId?: string | undefined; name?: string | undefined; toolCalls?: { name: string; id: string; args: Record; }[] | undefined; }[] | undefined; customTools?: { description: string; name: string; schema: Record | z.ZodTypeAny; func: (args_0: Record, ...args: unknown[]) => Promise; }[] | undefined; credentialPool?: Partial | undefined; }[]>> | undefined; capabilities?: { id: string; inputs: Record; credentials?: Partial> | undefined; context?: string | undefined; }[] | undefined; expectedOutputSchema?: string | z.ZodTypeAny | undefined; }, { message: string; name?: string | undefined; credentials?: Partial> | undefined; model?: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; provider?: string[] | undefined; jsonMode?: boolean | undefined; backupModel?: { model: "anthropic/claude-haiku-4-5" | "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-5.1" | "openai/gpt-5.2" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | "google/gemini-3-pro-preview" | "google/gemini-3-pro-image-preview" | "google/gemini-3-flash-preview" | "google/gemini-3.1-pro-preview" | "google/gemini-3.1-flash-lite-preview" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "openrouter/x-ai/grok-code-fast-1" | "openrouter/z-ai/glm-4.6" | "openrouter/z-ai/glm-4.7" | "openrouter/anthropic/claude-sonnet-4.5" | "openrouter/anthropic/claude-sonnet-4.6" | "openrouter/anthropic/claude-opus-4.5" | "openrouter/anthropic/claude-opus-4.6" | "openrouter/google/gemini-3-pro-preview" | "openrouter/morph/morph-v3-large" | "openrouter/openai/gpt-oss-120b" | "openrouter/openai/o3-deep-research" | "openrouter/openai/o4-mini-deep-research" | "fireworks/accounts/fireworks/models/kimi-k2p6"; temperature?: number | undefined; maxTokens?: number | undefined; reasoningEffort?: "low" | "medium" | "high" | undefined; maxRetries?: number | undefined; } | undefined; } | undefined; streaming?: boolean | undefined; tools?: { name: "get-bubble-details-tool" | "get-trigger-detail-tool" | "list-bubbles-tool" | "list-capabilities-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool" | "code-edit-tool" | "instagram-tool" | "linkedin-tool" | "tiktok-tool" | "twitter-tool" | "google-maps-tool" | "app-rankings-tool" | "youtube-tool" | "amazon-shopping-tool" | "people-search-tool"; credentials?: Partial> | undefined; config?: Record | undefined; }[] | undefined; images?: ({ data: string; type?: "base64" | undefined; description?: string | undefined; mimeType?: string | undefined; } | { type: "url"; url: string; description?: string | undefined; })[] | undefined; conversationHistory?: { role: "user" | "assistant" | "tool"; content: string; toolCallId?: string | undefined; name?: string | undefined; toolCalls?: { name: string; id: string; args: Record; }[] | undefined; }[] | undefined; systemPrompt?: string | undefined; customTools?: { description: string; name: string; schema: Record | z.ZodTypeAny; func: (args_0: Record, ...args: unknown[]) => Promise; }[] | undefined; maxIterations?: number | undefined; credentialPool?: Partial | undefined; }[]>> | undefined; capabilities?: { id: string; credentials?: Partial> | undefined; inputs?: Record | undefined; context?: string | undefined; }[] | undefined; expectedOutputSchema?: string | z.ZodTypeAny | undefined; memoryEnabled?: boolean | undefined; enableSlackHistory?: boolean | undefined; }>; static readonly resultSchema: z.ZodObject<{ response: z.ZodString; reasoning: z.ZodOptional>; toolCalls: z.ZodArray, "many">; iterations: z.ZodNumber; totalCost: z.ZodOptional; error: z.ZodString; success: z.ZodBoolean; }, "strip", z.ZodTypeAny, { error: string; success: boolean; response: string; toolCalls: { tool: string; input?: unknown; output?: unknown; }[]; iterations: number; reasoning?: string | null | undefined; totalCost?: number | undefined; }, { error: string; success: boolean; response: string; toolCalls: { tool: string; input?: unknown; output?: unknown; }[]; iterations: number; reasoning?: string | null | undefined; totalCost?: number | undefined; }>; static readonly shortDescription = "AI agent with LangGraph for tool-enabled conversations, multimodal support, and JSON mode"; static readonly longDescription = "\n An AI agent powered by LangGraph that can use any tool bubble to answer questions.\n Use cases:\n - Add tools to enhance the AI agent's capabilities (web-search-tool, web-scrape-tool)\n - Multi-step reasoning with tool assistance\n - Tool-augmented conversations with any registered tool\n - JSON mode for structured output (strips markdown formatting)\n "; static readonly alias = "agent"; private factory; private beforeToolCallHook; private afterToolCallHook; /** Capability-scoped hooks: only fire for the capability's own tool names */ private capabilityBeforeHooks; private capabilityAfterHooks; private afterLLMCallHook; private streamingCallback; private shouldStopAfterTools; private shouldContinueToAgent; private rescueAttempts; /** Current graph messages — kept in sync by executeToolsWithHooks so that * the use-capability tool can snapshot master state before delegation. */ private _currentGraphMessages; /** Emit a trace event via executionMeta._onTrace (if wired by the host). */ private _trace; private static readonly MAX_RESCUE_ATTEMPTS; /** Max characters for a single tool result before truncation (~50k chars ≈ ~12k tokens). */ private static readonly MAX_TOOL_RESULT_CHARS; constructor(params?: AIAgentParams, context?: BubbleContext, instanceId?: string); testCredential(): Promise; /** * Build effective model config from primary and optional backup settings */ private buildModelConfig; /** * Core execution logic for running the agent with a given model config */ private executeWithModel; /** * Pre-execution pipeline: classify role, inject Pro context for flow-masters, * apply common setup (caps + capability pipeline + time + JSON mode), and * consume the `_isFlowMaster` marker so children stay clean. * * Implementation lives in `./ai-agent-before-action.ts` to keep this file * focused on lifecycle + execution. */ protected beforeAction(): Promise; protected performAction(context?: BubbleContext): Promise; /** * Run post-execution memory reflection if a callback was provided via executionMeta. * Fire-and-forget: doesn't block the response. */ private runMemoryReflectionIfNeeded; protected getCredentialType(): CredentialType; /** * Get credential type for a specific model string */ private getCredentialTypeForModel; protected chooseCredential(): string | undefined; /** * Check if the model is a deep research model that requires direct API call */ private isDeepResearchModel; /** * Execute deep research models via OpenRouter API directly * Bypasses LangChain since these models have compatibility issues */ private executeDeepResearchViaOpenRouter; private initializeModel; private initializeTools; /** * Resolves credentials for a capability by pulling from the bubble-level * credentials (this.params.credentials) for each type the capability requires, * then overlaying any explicitly set capConfig.credentials on top. */ private resolveCapabilityCredentials; /** * Resolves the variableId and uniqueId for a capability tool by walking the dependency graph. * Finds the child node matching the given tool name under the current ai-agent node. * Falls back to -999/empty string if the dependency graph is unavailable or the tool is not found. */ private resolveCapabilityToolNode; /** * Converts a JSON Schema object to a Zod schema for DynamicStructuredTool. * Handles common JSON Schema types used by capability tool definitions. */ private jsonSchemaToZod; /** * Custom tool execution node that supports hooks */ private executeToolsWithHooks; private createAgentGraph; private executeAgent; } export {}; //# sourceMappingURL=ai-agent.d.ts.map