UNPKG

adk-typescript

Version:

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

87 lines (86 loc) 2.49 kB
import { LlmResponse } from '../models/LlmResponse'; import { EventActions } from './EventActions'; import { FunctionCall, FunctionResponse } from '../models/types'; /** * Represents an event in a conversation between agents and users. * * It is used to store the content of the conversation, as well as the actions * taken by the agents like function calls, etc. */ export declare class Event extends LlmResponse { /** * The invocation ID of the event. */ invocationId: string; /** * 'user' or the name of the agent, indicating who appended the event to the session. */ author: string; /** * The actions taken by the agent. */ actions: EventActions; /** * Set of ids of the long running function calls. * Agent client will know from this field about which function call is long running. * only valid for function call event */ longRunningToolIds?: Set<string>; /** * The branch of the event. * * The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of * agent_2, and agent_2 is the parent of agent_3. * * Branch is used when multiple sub-agent shouldn't see their peer agents' * conversation history. */ branch?: string; /** * The unique identifier of the event. */ id: string; /** * The timestamp of the event. */ timestamp: number; /** * Constructor for Event class */ constructor(params: { invocationId?: string; author: string; actions?: EventActions; longRunningToolIds?: Set<string>; branch?: string; id?: string; timestamp?: number; content?: any; partial?: boolean; turnComplete?: boolean; errorCode?: string; errorMessage?: string; interrupted?: boolean; customMetadata?: Record<string, any>; }); /** * Returns whether the event is the final response of the agent. */ isFinalResponse(): boolean; /** * Returns the function calls in the event. */ getFunctionCalls(): FunctionCall[]; /** * Returns the function responses in the event. */ getFunctionResponses(): FunctionResponse[]; /** * Returns whether the event has a trailing code execution result. */ hasTrailingCodeExecutionResult(): boolean; /** * Generate a new random ID for an event. */ static newId(): string; }