Skip to content

FunctionAgent

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

Base interface for workflow agents

new FunctionAgent(__namedParameters): FunctionAgent

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:118

FunctionAgentParams

FunctionAgent

readonly name: string

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:111

BaseWorkflowAgent.name


readonly systemPrompt: string

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

BaseWorkflowAgent.systemPrompt


readonly description: string

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:113

BaseWorkflowAgent.description


readonly llm: ToolCallLLM

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:114

BaseWorkflowAgent.llm


readonly tools: BaseToolWithCall[]

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:115

BaseWorkflowAgent.tools


readonly canHandoffTo: string[]

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:116

BaseWorkflowAgent.canHandoffTo

getStructuredOutput(responseFormat, response): Promise<any>

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:139

Take the final response and convert it to a structured output

ZodSchema

ChatMessage

Promise<any>

BaseWorkflowAgent.getStructuredOutput


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

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:181

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

WorkflowContext

AgentWorkflowState

ChatMessage[]

BaseToolWithCall[]

Promise<AgentOutput>

BaseWorkflowAgent.takeStep


handleToolCallResults(state, results): Promise<void>

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:242

Handle results from tool calls

AgentWorkflowState

AgentToolCallResult[]

Promise<void>

BaseWorkflowAgent.handleToolCallResults


finalize(state, output): Promise<AgentOutput>

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:268

Finalize the agent’s output

AgentWorkflowState

AgentOutput

Promise<AgentOutput>

BaseWorkflowAgent.finalize


static fromWorkflowStep(__namedParameters): FunctionAgent

Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:339

Create a FunctionAgent to handle a step of the workflow.

StepHandlerParams

FunctionAgent

A new FunctionAgent instance