Class: Agent
Defined in: src/agent/Agent.ts:26
An agent that can use an AI to reason and execute tools.
Extended by
Constructors
Constructor
new Agent(
ai,tools,instruction,callbacks?):Agent
Defined in: src/agent/Agent.ts:35
Parameters
ai
tools
Tool[] = []
instruction
string = ''
callbacks?
Returns
Agent
Properties
ai
ai:
AI
Defined in: src/agent/Agent.ts:28
contextBuilder
contextBuilder:
Context
Defined in: src/agent/Agent.ts:31
isSessionActive
isSessionActive:
boolean=false
Defined in: src/agent/Agent.ts:33
lifecycleCallbacks?
optionallifecycleCallbacks:AgentLifecycleCallbacks
Defined in: src/agent/Agent.ts:32
memory
memory:
Memory
Defined in: src/agent/Agent.ts:30
tools
tools:
Tool[]
Defined in: src/agent/Agent.ts:29
dependencies
staticdependencies:object={}
Defined in: src/agent/Agent.ts:27
Methods
findTool()
findTool(
name):undefined|Tool
Defined in: src/agent/Agent.ts:104
Parameters
name
string
Returns
undefined | Tool
getSessionState()
getSessionState():
object
Defined in: src/agent/Agent.ts:112
Get the current session state.
Returns
object
Object containing session information
isActive
isActive:
boolean
memorySize
memorySize:
number
toolCount
toolCount:
number
start()
start(
prompt):Promise<string>
Defined in: src/agent/Agent.ts:53
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.