Skip to main content

Class: Agent

Defined in: src/agent/Agent.ts:12

An agent that can use an AI to reason and execute tools.

Extended by

Constructors

Constructor

new Agent(ai, tools, instruction): Agent

Defined in: src/agent/Agent.ts:19

Parameters

ai

AI

tools

Tool[] = []

instruction

string = ''

Returns

Agent

Properties

ai

ai: AI

Defined in: src/agent/Agent.ts:14


contextBuilder

contextBuilder: Context

Defined in: src/agent/Agent.ts:17


memory

memory: Memory

Defined in: src/agent/Agent.ts:16


tools

tools: Tool[]

Defined in: src/agent/Agent.ts:15


dependencies

static dependencies: object = {}

Defined in: src/agent/Agent.ts:13

Methods

findTool()

findTool(name): undefined | Tool

Defined in: src/agent/Agent.ts:80

Parameters

name

string

Returns

undefined | Tool


start()

start(prompt): Promise<string>

Defined in: src/agent/Agent.ts:31

Starts the agent's reasoning loop with an initial prompt.

Parameters

prompt

string

The initial prompt from the user.

Returns

Promise<string>

The final text response from the agent.