FunctionAgent
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:110
Base interface for workflow agents
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FunctionAgent(
__namedParameters
):FunctionAgent
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:118
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”FunctionAgent
Properties
Section titled “Properties”
readonly
name:string
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:111
Implementation of
Section titled “Implementation of”systemPrompt
Section titled “systemPrompt”
readonly
systemPrompt:string
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:112
Implementation of
Section titled “Implementation of”BaseWorkflowAgent
.systemPrompt
description
Section titled “description”
readonly
description:string
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:113
Implementation of
Section titled “Implementation of”
readonly
llm:ToolCallLLM
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:114
Implementation of
Section titled “Implementation of”
readonly
tools:BaseToolWithCall
[]
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:115
Implementation of
Section titled “Implementation of”canHandoffTo
Section titled “canHandoffTo”
readonly
canHandoffTo:string
[]
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:116
Implementation of
Section titled “Implementation of”BaseWorkflowAgent
.canHandoffTo
Methods
Section titled “Methods”getStructuredOutput()
Section titled “getStructuredOutput()”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
Parameters
Section titled “Parameters”responseFormat
Section titled “responseFormat”ZodSchema
response
Section titled “response”ChatMessage
Returns
Section titled “Returns”Promise
<any
>
Implementation of
Section titled “Implementation of”BaseWorkflowAgent
.getStructuredOutput
takeStep()
Section titled “takeStep()”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
Parameters
Section titled “Parameters”WorkflowContext
llmInput
Section titled “llmInput”ChatMessage
[]
BaseToolWithCall
[]
Returns
Section titled “Returns”Promise
<AgentOutput
>
Implementation of
Section titled “Implementation of”handleToolCallResults()
Section titled “handleToolCallResults()”handleToolCallResults(
state
,results
):Promise
<void
>
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:242
Handle results from tool calls
Parameters
Section titled “Parameters”results
Section titled “results”Returns
Section titled “Returns”Promise
<void
>
Implementation of
Section titled “Implementation of”BaseWorkflowAgent
.handleToolCallResults
finalize()
Section titled “finalize()”finalize(
state
,output
):Promise
<AgentOutput
>
Defined in: .build/typescript/packages/workflow/src/agent/function-agent.ts:268
Finalize the agent’s output
Parameters
Section titled “Parameters”output
Section titled “output”Returns
Section titled “Returns”Promise
<AgentOutput
>
Implementation of
Section titled “Implementation of”fromWorkflowStep()
Section titled “fromWorkflowStep()”
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.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”FunctionAgent
A new FunctionAgent instance