Class: ReActAgentWorker
ReAct agent worker.
Implements
Constructors
constructor
• new ReActAgentWorker(«destructured»
): ReActAgentWorker
Parameters
Name | Type |
---|---|
«destructured» | ReActAgentWorkerParams |
Returns
Defined in
packages/core/src/agent/react/worker.ts:76
Properties
_getTools
• _getTools: (message
: string
) => Promise
<BaseTool
[]>
Type declaration
▸ (message
): Promise
<BaseTool
[]>
Parameters
Name | Type |
---|---|
message | string |
Returns
Promise
<BaseTool
[]>
Defined in
packages/core/src/agent/react/worker.ts:74
callbackManager
• callbackManager: CallbackManager
Defined in
packages/core/src/agent/react/worker.ts:72
llm
• llm: LLM
Defined in
packages/core/src/agent/react/worker.ts:65
maxInteractions
• maxInteractions: number
= 10
Defined in
packages/core/src/agent/react/worker.ts:68
outputParser
• outputParser: ReActOutputParser
Defined in
packages/core/src/agent/react/worker.ts:70
reactChatFormatter
• reactChatFormatter: ReActChatFormatter
Defined in
packages/core/src/agent/react/worker.ts:69
verbose
• verbose: boolean
Defined in
packages/core/src/agent/react/worker.ts:66
Methods
_getResponse
▸ _getResponse(currentReasoning
, sources
): AgentChatResponse
Get response.
Parameters
Name | Type | Description |
---|---|---|
currentReasoning | BaseReasoningStep [] | current reasoning steps |
sources | ToolOutput [] | tool outputs |
Returns
- agent chat response
Defined in
packages/core/src/agent/react/worker.ts:255
_getTaskStepResponse
▸ _getTaskStepResponse(agentResponse
, step
, isDone
): TaskStepOutput
Get task step response.
Parameters
Name | Type | Description |
---|---|---|
agentResponse | AgentChatResponse | agent chat response |
step | TaskStep | task step |
isDone | boolean | whether the task is done |
Returns
- task step output
Defined in
packages/core/src/agent/react/worker.ts:285
_processActions
▸ _processActions(task
, tools
, output
, isStreaming?
): Promise
<[BaseReasoningStep
[], boolean
]>
Process actions.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
task | Task | undefined | task |
tools | BaseTool [] | undefined | tools |
output | ChatResponse | undefined | chat response |
isStreaming | boolean | false | whether the chat response is streaming |
Returns
Promise
<[BaseReasoningStep
[], boolean
]>
- [reasoning steps, is done]
Defined in
packages/core/src/agent/react/worker.ts:192
_runStep
▸ _runStep(step
, task
, kwargs?
): Promise
<TaskStepOutput
>
Run a task step.
Parameters
Name | Type | Description |
---|---|---|
step | TaskStep | task step |
task | Task | task |
kwargs? | any | keyword arguments |
Returns
Promise
<TaskStepOutput
>
- task step output
Defined in
packages/core/src/agent/react/worker.ts:308
extractReasoningStep
▸ extractReasoningStep(output
, isStreaming
): [string
, BaseReasoningStep
[], boolean
]
Extract reasoning step from chat response.
Parameters
Name | Type | Description |
---|---|---|
output | ChatResponse | chat response |
isStreaming | boolean | whether the chat response is streaming |
Returns
[string
, BaseReasoningStep
[], boolean
]
- [message content, reasoning steps, is done]
Defined in
packages/core/src/agent/react/worker.ts:139
finalizeTask
▸ finalizeTask(task
, kwargs?
): void
Finalize a task.
Parameters
Name | Type | Description |
---|---|---|
task | Task | task |
kwargs? | any | keyword arguments |
Returns
void
Implementation of
Defined in
packages/core/src/agent/react/worker.ts:392
initializeStep
▸ initializeStep(task
, kwargs?
): TaskStep
Initialize a task step.
Parameters
Name | Type | Description |
---|---|---|
task | Task | task |
kwargs? | any | keyword arguments |
Returns
- task step
Implementation of
Defined in
packages/core/src/agent/react/worker.ts:112
runStep
▸ runStep(step
, task
, kwargs?
): Promise
<TaskStepOutput
>
Run a task step.
Parameters
Name | Type | Description |
---|---|---|
step | TaskStep | task step |
task | Task | task |
kwargs? | any | keyword arguments |
Returns
Promise
<TaskStepOutput
>
- task step output
Implementation of
Defined in
packages/core/src/agent/react/worker.ts:364
streamStep
▸ streamStep(step
, task
, kwargs?
): Promise
<TaskStepOutput
>
Run a task step.
Parameters
Name | Type | Description |
---|---|---|
step | TaskStep | task step |
task | Task | task |
kwargs? | any | keyword arguments |
Returns
Promise
<TaskStepOutput
>
- task step output