import { z } from 'zod'; import { type SubAgentTaskPath, type SubAgentTaskPathPolicy } from './sub-agent-task-path'; import type { AgentExecutionCounter, FinishReason, GenerateResult, ModelConfig, StreamChunk, TokenUsage } from '../../types/sdk/agent'; import type { BuiltProviderTool, BuiltTool } from '../../types/sdk/tool'; import type { BuiltTelemetry } from '../../types/telemetry'; import type { JSONObject, JSONValue } from '../../types/utils/json'; export declare const DELEGATE_SUB_AGENT_TOOL_NAME = "delegate_subagent"; export declare const INLINE_SUB_AGENT_ID = "inline"; export declare const DELEGATED_CHILD_SUSPEND_UNSUPPORTED_MESSAGE = "agents.chat.delegate.childSuspendUnsupported"; export declare const INLINE_DELEGATE_SUB_AGENT_TOOL_METADATA_KEY = "inlineDelegateSubAgent"; export declare const SUB_AGENT_TASK_DIFFICULTIES: readonly ['low', 'medium', 'high']; declare const SubAgentTaskDifficultySchema: z.ZodEnum<["low", "medium", "high"]>; export type SubAgentTaskDifficulty = z.infer; declare const delegateSubAgentInputSchema: z.ZodObject<{ subAgentId: z.ZodString; taskName: z.ZodString; goal: z.ZodString; context: z.ZodOptional; expectedOutput: z.ZodOptional; difficulty: z.ZodOptional>; }, "strip", z.ZodTypeAny, { subAgentId: string; taskName: string; goal: string; context?: string | undefined; expectedOutput?: string | undefined; difficulty?: "high" | "low" | "medium" | undefined; }, { subAgentId: string; taskName: string; goal: string; context?: string | undefined; expectedOutput?: string | undefined; difficulty?: "high" | "low" | "medium" | undefined; }>; declare const delegateSubAgentOutputSchema: z.ZodObject<{ status: z.ZodEnum<["completed", "failed", "suspended", "cancelled"]>; taskPath: z.ZodOptional; runId: z.ZodOptional; threadId: z.ZodOptional; model: z.ZodOptional; answer: z.ZodString; structuredOutput: z.ZodOptional; usage: z.ZodOptional; completionTokens: z.ZodOptional; totalTokens: z.ZodOptional; cost: z.ZodOptional; }, "strip", z.ZodTypeAny, { promptTokens?: number | undefined; completionTokens?: number | undefined; totalTokens?: number | undefined; cost?: number | undefined; }, { promptTokens?: number | undefined; completionTokens?: number | undefined; totalTokens?: number | undefined; cost?: number | undefined; }>>; finishReason: z.ZodOptional; error: z.ZodOptional; resumeContext: z.ZodOptional>; pendingSuspend: z.ZodOptional; }, "strip", z.ZodTypeAny, { runId: string; toolCallId: string; toolName: string; input?: unknown; suspendPayload?: unknown; resumeSchema?: unknown; }, { runId: string; toolCallId: string; toolName: string; input?: unknown; suspendPayload?: unknown; resumeSchema?: unknown; }>, "many">>; }, "strip", z.ZodTypeAny, { status: "cancelled" | "completed" | "failed" | "suspended"; taskPath?: string | undefined; runId?: string | undefined; threadId?: string | undefined; model?: string | undefined; answer: string; structuredOutput?: unknown; usage?: { promptTokens?: number | undefined; completionTokens?: number | undefined; totalTokens?: number | undefined; cost?: number | undefined; } | undefined; finishReason?: string | undefined; error?: string | undefined; resumeContext?: JSONValue | undefined; pendingSuspend?: { runId: string; toolCallId: string; toolName: string; input?: unknown; suspendPayload?: unknown; resumeSchema?: unknown; }[] | undefined; }, { status: "cancelled" | "completed" | "failed" | "suspended"; taskPath?: string | undefined; runId?: string | undefined; threadId?: string | undefined; model?: string | undefined; answer: string; structuredOutput?: unknown; usage?: { promptTokens?: number | undefined; completionTokens?: number | undefined; totalTokens?: number | undefined; cost?: number | undefined; } | undefined; finishReason?: string | undefined; error?: string | undefined; resumeContext?: JSONValue | undefined; pendingSuspend?: { runId: string; toolCallId: string; toolName: string; input?: unknown; suspendPayload?: unknown; resumeSchema?: unknown; }[] | undefined; }>; declare const delegateSubAgentContinuationSchema: z.ZodObject<{ runId: z.ZodString; toolCallId: z.ZodString; taskPath: z.ZodString; subAgentId: z.ZodString; childCount: z.ZodNumber; threadId: z.ZodOptional; resumeContext: z.ZodOptional>; }, "strip", z.ZodTypeAny, { runId: string; toolCallId: string; taskPath: string; subAgentId: string; childCount: number; threadId?: string | undefined; resumeContext?: JSONValue | undefined; }, { runId: string; toolCallId: string; taskPath: string; subAgentId: string; childCount: number; threadId?: string | undefined; resumeContext?: JSONValue | undefined; }>; export type DelegateSubAgentContinuation = z.infer; export declare function parseDelegateSubAgentContinuation(value: unknown): DelegateSubAgentContinuation | undefined; export type DelegateSubAgentInput = z.infer; export type DelegateSubAgentPolicy = SubAgentTaskPathPolicy; export interface DelegateSubAgentRequest extends DelegateSubAgentInput { taskPath: SubAgentTaskPath; parentRunId?: string; parentThreadId?: string; parentResourceId?: string; parentHostMetadata?: JSONObject; parentToolCallId?: string; parentAbortSignal?: AbortSignal; parentExecutionCounter?: AgentExecutionCounter; parentTelemetry?: BuiltTelemetry; childCount: number; policy?: DelegateSubAgentPolicy; } export interface DelegateSubAgentToolOutput { status: 'completed' | 'failed' | 'suspended' | 'cancelled'; taskPath?: SubAgentTaskPath; runId?: string; threadId?: string; model?: string; answer: string; structuredOutput?: unknown; usage?: Pick; finishReason?: FinishReason; error?: string; resumeContext?: JSONValue; pendingSuspend?: GenerateResult['pendingSuspend']; } export interface DelegateSubAgentRunnerHelpers { runInlineSubAgent: (request: DelegateSubAgentRequest) => Promise; emitChunk: (chunk: StreamChunk) => void; } export type InlineSubAgentProviderToolsResolver = (modelConfig: ModelConfig) => BuiltProviderTool[] | Promise; export type DelegateSubAgentRunner = (request: DelegateSubAgentRequest, helpers: DelegateSubAgentRunnerHelpers) => Promise; export interface DelegateSubAgentResumeRequest extends DelegateSubAgentRequest { childRunId: string; childToolCallId: string; childThreadId?: string; resumeContext?: JSONValue; resumeData: unknown; } export type DelegateSubAgentResumeRunner = (request: DelegateSubAgentResumeRequest, helpers: DelegateSubAgentRunnerHelpers) => Promise; export interface DelegateSubAgentCancelRequest extends DelegateSubAgentRequest { childRunId: string; childToolCallId: string; childThreadId?: string; resumeContext?: JSONValue; reason: string; } export type DelegateSubAgentCancelRunner = (request: DelegateSubAgentCancelRequest, helpers: DelegateSubAgentRunnerHelpers) => Promise; export interface CreateDelegateSubAgentToolOptions { name?: string; description?: string | null; systemInstruction?: string | null; availableSubAgents?: Array<{ id: string; name: string; useWhen?: string; }>; policy?: DelegateSubAgentPolicy; inlineSubAgentBlockedTools?: string[]; inlineSubAgentModelsByDifficulty?: Partial>; resolveInlineSubAgentProviderTools?: InlineSubAgentProviderToolsResolver; runSubAgent?: DelegateSubAgentRunner; resumeSubAgent?: DelegateSubAgentResumeRunner; shouldRetrySubAgentResumeError?: (error: unknown) => boolean; cancelSubAgent?: DelegateSubAgentCancelRunner; toModelOutput?: (output: z.infer) => unknown; } export type DelegateSubAgentToolMetadata = CreateDelegateSubAgentToolOptions; export declare function createDelegateSubAgentTool(options?: CreateDelegateSubAgentToolOptions): BuiltTool; export declare function getInlineDelegateSubAgentToolOptions(tool: Pick): DelegateSubAgentToolMetadata | undefined; export declare function isDelegateSubAgentTool(tool: Pick): boolean; export declare function renderDelegateSubAgentPrompt(request: { goal: string; context?: string; expectedOutput?: string; }): string; export declare function failedDelegatedChildSuspendOutput(taskPath: SubAgentTaskPath, model?: string): DelegateSubAgentToolOutput; export declare function generateResultToDelegateSubAgentOutput(taskPath: SubAgentTaskPath, result: GenerateResult, threadId?: string): DelegateSubAgentToolOutput; export {};