AgentWorkflow
Defined in: packages/workflow/src/agent/agent-workflow.ts:143
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.
Implements
Workflow
Constructors
Constructor
new AgentWorkflow(
__namedParameters
):AgentWorkflow
Defined in: packages/workflow/src/agent/agent-workflow.ts:152
Parameters
__namedParameters
Returns
AgentWorkflow
Methods
handle()
handle<
AcceptEvents
,Result
>(accept
,handler
):void
Defined in: packages/workflow/src/agent/agent-workflow.ts:198
Type Parameters
AcceptEvents
AcceptEvents
extends WorkflowEvent
<unknown
>[]
Result
Result
extends void
| WorkflowEventData
<unknown
, string
>
Parameters
accept
AcceptEvents
handler
Handler
<AcceptEvents
, Result
>
Returns
void
Implementation of
Workflow.handle
createContext()
createContext():
WorkflowContext
Defined in: packages/workflow/src/agent/agent-workflow.ts:205
Returns
WorkflowContext
Implementation of
Workflow.createContext
addAgent()
addAgent(
agent
):this
Defined in: packages/workflow/src/agent/agent-workflow.ts:259
Adds a new agent to the workflow
Parameters
agent
Returns
this
getAgents()
getAgents():
BaseWorkflowAgent
[]
Defined in: packages/workflow/src/agent/agent-workflow.ts:270
Gets all agents in this workflow
Returns
Array of agents in this workflow
fromTools()
static
fromTools(params
):AgentWorkflow
Defined in: packages/workflow/src/agent/agent-workflow.ts:279
Create a simple workflow with a single agent and specified tools
Parameters
params
Parameters for the single agent workflow
Returns
AgentWorkflow
A new AgentWorkflow instance
runStream()
runStream(
userInput
,params?
):WorkflowStream
<WorkflowEventData
<any
,string
>>
Defined in: packages/workflow/src/agent/agent-workflow.ts:584
Parameters
userInput
string
params?
chatHistory?
ChatMessage
[]
state?
Returns
WorkflowStream
<WorkflowEventData
<any
, string
>>
run()
run(
userInput
,params?
):Promise
<WorkflowEventData
<AgentResultData
>>
Defined in: packages/workflow/src/agent/agent-workflow.ts:606
Parameters
userInput
string
params?
chatHistory?
ChatMessage
[]
state?
Returns
Promise
<WorkflowEventData
<AgentResultData
>>