Logo
Classes

FunctionAgent

Defined in: packages/workflow/src/agent/function-agent.ts:104

Base interface for workflow agents

Implements

Constructors

Constructor

new FunctionAgent(__namedParameters): FunctionAgent

Defined in: packages/workflow/src/agent/function-agent.ts:112

Parameters

__namedParameters

FunctionAgentParams

Returns

FunctionAgent

Properties

name

readonly name: string

Defined in: packages/workflow/src/agent/function-agent.ts:105

Implementation of

BaseWorkflowAgent.name


systemPrompt

readonly systemPrompt: string

Defined in: packages/workflow/src/agent/function-agent.ts:106

Implementation of

BaseWorkflowAgent.systemPrompt


description

readonly description: string

Defined in: packages/workflow/src/agent/function-agent.ts:107

Implementation of

BaseWorkflowAgent.description


llm

readonly llm: ToolCallLLM

Defined in: packages/workflow/src/agent/function-agent.ts:108

Implementation of

BaseWorkflowAgent.llm


tools

readonly tools: BaseToolWithCall[]

Defined in: packages/workflow/src/agent/function-agent.ts:109

Implementation of

BaseWorkflowAgent.tools


canHandoffTo

readonly canHandoffTo: string[]

Defined in: packages/workflow/src/agent/function-agent.ts:110

Implementation of

BaseWorkflowAgent.canHandoffTo

Methods

takeStep()

takeStep(ctx, state, llmInput, tools): Promise<AgentOutput>

Defined in: packages/workflow/src/agent/function-agent.ts:167

Take a single step with the agent Using memory directly to get messages instead of requiring them to be passed in

Parameters

ctx

WorkflowContext

state

AgentWorkflowState

llmInput

ChatMessage[]

tools

BaseToolWithCall[]

Returns

Promise<AgentOutput>

Implementation of

BaseWorkflowAgent.takeStep


handleToolCallResults()

handleToolCallResults(state, results): Promise<void>

Defined in: packages/workflow/src/agent/function-agent.ts:228

Handle results from tool calls

Parameters

state

AgentWorkflowState

results

AgentToolCallResult[]

Returns

Promise<void>

Implementation of

BaseWorkflowAgent.handleToolCallResults


finalize()

finalize(state, output): Promise<AgentOutput>

Defined in: packages/workflow/src/agent/function-agent.ts:254

Finalize the agent's output

Parameters

state

AgentWorkflowState

output

AgentOutput

Returns

Promise<AgentOutput>

Implementation of

BaseWorkflowAgent.finalize


fromWorkflowStep()

static fromWorkflowStep(__namedParameters): FunctionAgent

Defined in: packages/workflow/src/agent/function-agent.ts:325

Create a FunctionAgent to handle a step of the workflow.

Parameters

__namedParameters

StepHandlerParams

Returns

FunctionAgent

A new FunctionAgent instance