Skip to content

AgentBase

Defined in: src/agent/agent-base.ts:10

Interface defining the minimal contract for all agent types.

Both Agent (full orchestration agent) and A2AAgent (remote agent proxy) implement this interface, enabling polymorphic usage across the SDK.

invoke(args, options?): Promise<AgentResult>;

Defined in: src/agent/agent-base.ts:18

Invokes the agent and returns the final result.

ParameterTypeDescription
argsInvokeArgsArguments for invoking the agent
options?InvokeOptionsOptional invocation options (e.g. structured output schema)

Promise<AgentResult>

Promise that resolves to the final AgentResult


stream(args, options?): AsyncGenerator<AgentStreamEvent, AgentResult, undefined>;

Defined in: src/agent/agent-base.ts:27

Streams the agent execution, yielding events and returning the final result.

ParameterTypeDescription
argsInvokeArgsArguments for invoking the agent
options?InvokeOptionsOptional invocation options (e.g. structured output schema)

AsyncGenerator<AgentStreamEvent, AgentResult, undefined>

Async generator that yields AgentStreamEvent objects and returns AgentResult