UNPKG

adk-typescript

Version:

TypeScript port of Google's Agent Development Kit (ADK)

66 lines (65 loc) 1.81 kB
import { BaseTool, BaseToolOptions } from './BaseTool'; import { ToolContext } from './ToolContext'; import { LlmAgent } from '../agents'; export type BaseAgentType = LlmAgent; /** * Options for creating an AgentTool */ export interface AgentToolOptions extends BaseToolOptions { /** * The agent that will be used as a tool */ agent: BaseAgentType; /** * Optional function declaration schema override */ functionDeclaration?: Record<string, any>; /** * Optional key to store the tool output in the state */ outputKey?: string; /** * Optional flag to skip summarization of the agent's response */ skipSummarization?: boolean; } /** * A tool that uses an agent to perform a task */ export declare class AgentTool extends BaseTool { /** * The agent used by this tool */ private agent; /** * The function declaration schema */ private functionDeclaration?; /** * The key to store the tool output in the state */ private outputKey?; /** * Whether to skip summarization of the agent's response */ private skipSummarization; /** * Create a new agent tool * @param options Options for the agent tool */ constructor(options: AgentToolOptions); /** * Get the function declaration for the tool * * @returns The function declaration */ getFunctionDeclaration(): Record<string, any>; /** * Execute the tool by running the agent with the provided input * * @param params The parameters for the tool execution * @param context The context for the tool execution * @returns The result of the agent execution */ execute(params: Record<string, any>, context: ToolContext): Promise<any>; }