Basics
Research & Report Flow
Build a multi-agent TaskFlow with Tool, Agent, AgentProtocol, and custom behavior.
๐ Overview
This intermediate tutorial demonstrates how to:
- Define multiple agent types (class-based, decorator-based)
- Use tools for data retrieval
- Use
custom_start
to override agent logic - Orchestrate them in a flow using
TaskFlow
In this flow, a user input goes through three stages:
- ResearchAgent fetches content
- SummarizerAgent condenses it
- ReporterAgent formats the result as a final report
๐ฆ File Structure
๐ง Step 1 โ Define a Tool
๐ง Step 2 โ ResearchAgent (Custom Start)
This agent uses the web tool and formats the tool result into a paragraph.
๐งพ Step 3 โ SummarizerAgent (Standard)
๐ค Step 4 โ ReporterAgent (AgentProtocol)
This agent implements AgentProtocol
and formats output as an email.
๐ Step 5 โ TaskFlow Assembly
โ Output Sample
๐ Notes
add_agent(name, agent)
registers agentsstep(name, {inputs})
sets how data flows- Use
{{previous.output}}
syntax for chaining outputs - Agents can be class-based or decorator-based
๐งช Full Code: research_flow.py
research_flow.py
โ Output Example
๐ง Takeaways
- Use
Tool
for modular utility - Combine
Agent
types (class, decorator) for flexibility - Extend with custom logic via
custom_start
- Chain steps clearly with
TaskFlow
๐ Next
- Add error handling, retries
- Split tasks conditionally
- Add memory/state passing between agents