Agent Workflow
AgentWorkflow
is a powerful system that enables you to create and orchestrate one or multiple agents with tools to perform specific tasks. It's built on top of the base Workflow
system and provides a streamlined interface for agent interactions.
Installation
You'll need to install the @llamaindex/workflow
package:
Usage
Single Agent Workflow
The simplest use case is creating a single agent with specific tools. Here's an example of creating an assistant that tells jokes:
Event Streaming
AgentWorkflow
provides a unified interface for event streaming, making it easy to track and respond to different events during execution:
Multi-Agent Workflow
AgentWorkflow
can orchestrate multiple agents, enabling complex interactions and task handoffs. Each agent in a multi-agent workflow requires:
name
: Unique identifier for the agentdescription
: Purpose description used for task routingtools
: Array of tools the agent can usecanHandoffTo
(optional): Array of agent names or agent instances that this agent can delegate tasks to
Here's an example of a multi-agent system that combines joke-telling and weather information:
The workflow will coordinate between agents, allowing them to handle different aspects of the request and hand off tasks when appropriate.
Last updated on