FlowDisplay Module
Visual display of agent workflows with agents centered and tools on sides
FlowDisplay Module
The FlowDisplay class provides visual display of agent workflows, showing agents in the center with their tools on the sides.
Import
from praisonaiagents import FlowDisplayQuick Example
from praisonaiagents import Agent, FlowDisplay
# Create flow display
flow = FlowDisplay()
# Start tracking
flow.start()
# Run your agents
agent = Agent(name="Researcher", tools=[web_search])
agent.start("Research AI trends")
# Stop and display the flow
flow.stop()Constructor
FlowDisplay()
Creates a new FlowDisplay instance.
No parameters required.
Methods
start()
Start tracking the workflow. Registers callbacks to capture agent interactions and tool calls.
flow = FlowDisplay()
flow.start()stop()
Stop tracking and display the flow chart.
flow.stop()display()
Manually display the current flow chart without stopping tracking.
flow.display()Attributes
| Attribute | Type | Description |
|---|---|---|
agents | list | List of agents in execution order |
agent_tools | dict | Mapping of agent names to their tools |
tracking | bool | Whether tracking is active |
Visual Output
The flow display shows:
┌─────────────────────────────────────────────────────────┐
│ Agent Workflow │
├─────────────────────────────────────────────────────────┤
│ │
│ [web_search] ──► Researcher ──► [file_write] │
│ │ │
│ ▼ │
│ [calculator] ──► Analyst ──► [chart_gen] │
│ │ │
│ ▼ │
│ Writer │
│ │
└─────────────────────────────────────────────────────────┘Example with Multiple Agents
from praisonaiagents import Agent, AgentTeam, FlowDisplay
# Create agents
researcher = Agent(
name="Researcher",
tools=[web_search, wikipedia]
)
analyst = Agent(
name="Analyst",
tools=[calculator, data_analysis]
)
writer = Agent(
name="Writer",
tools=[file_write]
)
# Create flow display
flow = FlowDisplay()
flow.start()
# Run workflow
agents = AgentTeam(
agents=[researcher, analyst, writer],
tasks=[research_task, analysis_task, writing_task]
)
agents.start()
# Display the flow
flow.stop()Thread Safety
The FlowDisplay class is thread-safe and uses locks to protect shared state when multiple agents run concurrently.
Related
- Agent Module – Agent class
- Agents Module – Multi-agent orchestration
- Display Module – Display utilities