Skip to content

agent-core / Exports / AbstractAgent

Class: AbstractAgent<TConfig, TContext, TMessage>

Generic agent interface with type parameters for enhanced type safety

Template

Message type (defaults to TUniversalMessage for backward compatibility)

Type parameters

NameTypeDescription
TConfigIAgentConfigAgent configuration type (defaults to IAgentConfig for backward compatibility)
TContextIRunOptionsExecution context type (defaults to IRunOptions for backward compatibility)
TMessageTUniversalMessage-

Hierarchy

Implements

  • IAgent<TConfig, TContext, TMessage>

Table of contents

Constructors

Methods

Constructors

constructor

new AbstractAgent<TConfig, TContext, TMessage>(): AbstractAgent<TConfig, TContext, TMessage>

Type parameters

NameType
TConfigIAgentConfig
TContextIRunOptions
TMessageTUniversalMessage

Returns

AbstractAgent<TConfig, TContext, TMessage>

Methods

configure

configure(config): Promise<void>

Configure the agent with type-safe configuration

Parameters

NameType
configTConfig

Returns

Promise<void>

Implementation of

IAgent.configure

Defined in

packages/agent-core/src/abstracts/abstract-agent.ts:30


run

run(input, context?): Promise<string>

Run agent with user input and type-safe context

Parameters

NameType
inputstring
context?TContext

Returns

Promise<string>

Implementation of

IAgent.run

Defined in

packages/agent-core/src/abstracts/abstract-agent.ts:38


runStream

runStream(input, context?): AsyncGenerator<string, void, never>

Run agent with streaming response and type-safe context

Parameters

NameType
inputstring
context?TContext

Returns

AsyncGenerator<string, void, never>

Implementation of

IAgent.runStream

Defined in

packages/agent-core/src/abstracts/abstract-agent.ts:43


getHistory

getHistory(): TMessage[]

Get conversation history with type-safe messages

Returns

TMessage[]

Implementation of

IAgent.getHistory

Defined in

packages/agent-core/src/abstracts/abstract-agent.ts:48


clearHistory

clearHistory(): void

Clear conversation history

Returns

void

Implementation of

IAgent.clearHistory

Defined in

packages/agent-core/src/abstracts/abstract-agent.ts:55


dispose

dispose(): Promise<void>

Cleanup resources

Returns

Promise<void>

Defined in

packages/agent-core/src/abstracts/abstract-agent.ts:88

Released under the MIT License.