Ga naar hoofdinhoud

Class: ReActAgentWorker

ReAct agent worker.

Implements

Constructors

constructor

new ReActAgentWorker(«destructured»): ReActAgentWorker

Parameters

NameType
«destructured»ReActAgentWorkerParams

Returns

ReActAgentWorker

Defined in

packages/core/src/agent/react/worker.ts:75

Properties

_getTools

_getTools: (message: string) => Promise<BaseTool[]>

Type declaration

▸ (message): Promise<BaseTool[]>

Parameters
NameType
messagestring
Returns

Promise<BaseTool[]>

Defined in

packages/core/src/agent/react/worker.ts:73


callbackManager

callbackManager: CallbackManager

Defined in

packages/core/src/agent/react/worker.ts:71


llm

llm: LLM

Defined in

packages/core/src/agent/react/worker.ts:64


maxInteractions

maxInteractions: number = 10

Defined in

packages/core/src/agent/react/worker.ts:67


outputParser

outputParser: ReActOutputParser

Defined in

packages/core/src/agent/react/worker.ts:69


reactChatFormatter

reactChatFormatter: ReActChatFormatter

Defined in

packages/core/src/agent/react/worker.ts:68


verbose

verbose: boolean

Defined in

packages/core/src/agent/react/worker.ts:65

Methods

_getResponse

_getResponse(currentReasoning, sources): AgentChatResponse

Get response.

Parameters

NameTypeDescription
currentReasoningBaseReasoningStep[]current reasoning steps
sourcesToolOutput[]tool outputs

Returns

AgentChatResponse

  • agent chat response

Defined in

packages/core/src/agent/react/worker.ts:254


_getTaskStepResponse

_getTaskStepResponse(agentResponse, step, isDone): TaskStepOutput

Get task step response.

Parameters

NameTypeDescription
agentResponseAgentChatResponseagent chat response
stepTaskSteptask step
isDonebooleanwhether the task is done

Returns

TaskStepOutput

  • task step output

Defined in

packages/core/src/agent/react/worker.ts:284


_processActions

_processActions(task, tools, output, isStreaming?): Promise<[BaseReasoningStep[], boolean]>

Process actions.

Parameters

NameTypeDefault valueDescription
taskTaskundefinedtask
toolsBaseTool[]undefinedtools
outputChatResponseundefinedchat response
isStreamingbooleanfalsewhether the chat response is streaming

Returns

Promise<[BaseReasoningStep[], boolean]>

  • [reasoning steps, is done]

Defined in

packages/core/src/agent/react/worker.ts:191


_runStep

_runStep(step, task, kwargs?): Promise<TaskStepOutput>

Run a task step.

Parameters

NameTypeDescription
stepTaskSteptask step
taskTasktask
kwargs?anykeyword arguments

Returns

Promise<TaskStepOutput>

  • task step output

Defined in

packages/core/src/agent/react/worker.ts:307


extractReasoningStep

extractReasoningStep(output, isStreaming): [string, BaseReasoningStep[], boolean]

Extract reasoning step from chat response.

Parameters

NameTypeDescription
outputChatResponsechat response
isStreamingbooleanwhether the chat response is streaming

Returns

[string, BaseReasoningStep[], boolean]

  • [message content, reasoning steps, is done]

Defined in

packages/core/src/agent/react/worker.ts:138


finalizeTask

finalizeTask(task, kwargs?): void

Finalize a task.

Parameters

NameTypeDescription
taskTasktask
kwargs?anykeyword arguments

Returns

void

Implementation of

AgentWorker.finalizeTask

Defined in

packages/core/src/agent/react/worker.ts:391


initializeStep

initializeStep(task, kwargs?): TaskStep

Initialize a task step.

Parameters

NameTypeDescription
taskTasktask
kwargs?anykeyword arguments

Returns

TaskStep

  • task step

Implementation of

AgentWorker.initializeStep

Defined in

packages/core/src/agent/react/worker.ts:111


runStep

runStep(step, task, kwargs?): Promise<TaskStepOutput>

Run a task step.

Parameters

NameTypeDescription
stepTaskSteptask step
taskTasktask
kwargs?anykeyword arguments

Returns

Promise<TaskStepOutput>

  • task step output

Implementation of

AgentWorker.runStep

Defined in

packages/core/src/agent/react/worker.ts:363


streamStep

streamStep(step, task, kwargs?): Promise<TaskStepOutput>

Run a task step.

Parameters

NameTypeDescription
stepTaskSteptask step
taskTasktask
kwargs?anykeyword arguments

Returns

Promise<TaskStepOutput>

  • task step output

Implementation of

AgentWorker.streamStep

Defined in

packages/core/src/agent/react/worker.ts:378