Skip to content

agent-core / Exports / IAgent

Interface: IAgent<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-

Implemented by

Table of contents

Methods

Methods

configure

configure(config): Promise<void>

Configure the agent with type-safe configuration

Parameters

NameType
configTConfig

Returns

Promise<void>

Defined in

packages/agent-core/src/interfaces/agent.ts:182


run

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

Run agent with user input and type-safe context

Parameters

NameType
inputstring
context?TContext

Returns

Promise<string>

Defined in

packages/agent-core/src/interfaces/agent.ts:187


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>

Defined in

packages/agent-core/src/interfaces/agent.ts:192


getHistory

getHistory(): TMessage[]

Get conversation history with type-safe messages

Returns

TMessage[]

Defined in

packages/agent-core/src/interfaces/agent.ts:197


clearHistory

clearHistory(): void

Clear conversation history

Returns

void

Defined in

packages/agent-core/src/interfaces/agent.ts:202

Released under the MIT License.