adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
48 lines (47 loc) • 1.77 kB
TypeScript
/**
* Implementation of agent transfer processor.
*
* This processor allows agents to transfer control to other agents in specific conditions:
* 1. From parent to sub-agent
* 2. From sub-agent to parent
* 3. From sub-agent to its peer agents (when allowed)
*/
import { InvocationContext } from '../../agents/InvocationContext';
import { Event } from '../../events/Event';
import { LlmRequest } from '../../models/LlmRequest';
import { BaseLlmRequestProcessor } from './BaseLlmProcessor';
/**
* A request processor that adds agent transfer capability to LLM requests.
*/
declare class AgentTransferLlmRequestProcessor implements BaseLlmRequestProcessor {
/**
* Runs the processor asynchronously.
*
* @param invocationContext The invocation context
* @param llmRequest The LLM request to process
* @returns An async generator yielding events
*/
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, unknown>;
/**
* Adds the transfer_to_agent function definition to the LLM request.
*
* @param llmRequest The LLM request to add the function to
*/
private addTransferFunction;
/**
* Builds the list of available target agents for transfer.
*
* @param invocationContext The invocation context
* @returns List of target agent objects with name and description
*/
private buildTargetAgentsList;
/**
* Builds instructions for agent transfer capability.
*
* @param targetAgents List of target agents with name and description
* @returns Array of instruction strings
*/
private buildTargetAgentInstructions;
}
export declare const requestProcessor: AgentTransferLlmRequestProcessor;
export {};