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.

readonly type: "agent";

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

Type discriminator for identifying agent instances in union types.


readonly id: string;

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

The unique identifier of the agent instance.


readonly optional name: string;

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

The name of the agent.


readonly optional description: string;

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

Optional description of what the agent does.

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

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

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:47

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