メインコンテンツまでスキップ

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:77

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:75


callbackManager

callbackManager: CallbackManager

Defined in

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


llm

llm: LLM

Defined in

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


maxInteractions

maxInteractions: number = 10

Defined in

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


outputParser

outputParser: ReActOutputParser

Defined in

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


reactChatFormatter

reactChatFormatter: ReActChatFormatter

Defined in

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


verbose

verbose: boolean

Defined in

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

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:256


_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:286


_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:193


_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:309


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:140


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:393


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:113


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:365


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:380