Logo
Classes

AgentWorkflow

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

AgentWorkflow - An event-driven workflow for executing agents with tools

This class provides a simple interface for creating and running agent workflows based on the LlamaIndexTS workflow system. It supports single agent workflows with multiple tools.

Constructors

Constructor

new AgentWorkflow(__namedParameters): AgentWorkflow

Defined in: packages/workflow/src/agent/agent-workflow.ts:121

Parameters

__namedParameters

AgentWorkflowParams

Returns

AgentWorkflow

Methods

addAgent()

addAgent(agent): this

Defined in: packages/workflow/src/agent/agent-workflow.ts:217

Adds a new agent to the workflow

Parameters

agent

BaseWorkflowAgent

Returns

this


getAgents()

getAgents(): BaseWorkflowAgent[]

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

Gets all agents in this workflow

Returns

BaseWorkflowAgent[]

Array of agents in this workflow


fromTools()

static fromTools(params): AgentWorkflow

Defined in: packages/workflow/src/agent/agent-workflow.ts:237

Create a simple workflow with a single agent and specified tools

Parameters

params

SingleAgentParams

Parameters for the single agent workflow

Returns

AgentWorkflow

A new AgentWorkflow instance


run()

run(userInput, params?): Promise<StopEvent<string>> & AsyncIterable<WorkflowEvent<any>, any, any> & object

Defined in: packages/workflow/src/agent/agent-workflow.ts:557

Parameters

userInput

string

params?
chatHistory?

ChatMessage[]

context?

AgentWorkflowContext

Returns

Promise<StopEvent<string>> & AsyncIterable<WorkflowEvent<any>, any, any> & object

On this page