Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:ANative Lab EvoAgentX SequentialWorkFlowGraph

From Leeroopedia
Knowledge Sources
Domains Workflow
Last Updated 2026-10-21 00:00 GMT

Overview

Concrete tool for building sequential multi-agent workflow graphs from a list of task definition dicts with automatic edge inference.

Description

The SequentialWorkFlowGraph class extends WorkFlowGraph to simplify manual workflow construction. Instead of manually defining nodes and edges, the user provides a list of task dicts (each with name, description, prompt, inputs, outputs, parse_mode, and optional tool_names). The class infers WorkFlowNode objects and WorkFlowEdge connections by matching output parameter names of one task to input parameter names of the next. Each node embeds a CustomizeAgent config derived from the task dict.

Usage

  • Sequential pipelines: Define a chain of tasks (e.g., research → analyze → write) as dicts and let the graph infer connections.
  • Manual workflow construction: When full auto-generation is unnecessary, use `SequentialWorkFlowGraph` for precise control over task definitions.
  • Custom parse functions: Register custom parse functions via `register_parse_function` and reference them by name in task dicts.

Code Reference

Source Location

  • Repository: EvoAgentX
  • File: evoagentx/workflow/workflow_graph.py (L1662-1755)

Signature

class SequentialWorkFlowGraph(WorkFlowGraph):
    def __init__(self, goal: str, tasks: List[dict], **kwargs)

# Task dict schema:
# {
#     "name": str,                    # required
#     "description": str,              # required
#     "prompt": str | "prompt_template": PromptTemplate,  # one required
#     "inputs": List[dict],            # parameter specs
#     "outputs": List[dict],           # parameter specs
#     "system_prompt": str,            # optional
#     "output_parser": Type[ActionOutput],  # optional
#     "parse_mode": str = "str",       # default "str"
#     "parse_func": Callable,           # optional
#     "title_format": str,              # optional
#     "tool_names": List[str],          # optional
# }

Import

from evoagentx.workflow.workflow_graph import SequentialWorkFlowGraph

I/O Contract

Inputs

Name Type Required Description
goal str Yes Workflow goal
tasks List[dict] Yes List of task definition dicts

Outputs

Name Type Description
SequentialWorkFlowGraph WorkFlowGraph Subclass with inferred nodes and edges

Usage Examples

Build Sequential Workflow

from evoagentx.workflow.workflow_graph import SequentialWorkFlowGraph
from evoagentx.agents.agent_manager import AgentManager
from evoagentx.workflow.workflow import WorkFlow
from evoagentx.models.model_configs import OpenRouterConfig
from evoagentx.models.openrouter_model import OpenRouterLLM

# 1. Define sequential tasks
tasks = [
    {
        "name": "researcher",
        "description": "Researches a topic",
        "prompt": "Research the following topic and provide key points:\n{topic}",
        "inputs": [{"name": "topic", "type": "str", "description": "Topic to research"}],
        "outputs": [{"name": "key_points", "type": "str", "description": "Key research points"}],
        "parse_mode": "title",
    },
    {
        "name": "writer",
        "description": "Writes a report from key points",
        "prompt": "Write a structured report based on these key points:\n{key_points}",
        "inputs": [{"name": "key_points", "type": "str", "description": "Research key points"}],
        "outputs": [{"name": "report", "type": "str", "description": "Final report"}],
        "parse_mode": "title",
    },
]

# 2. Create graph (edges inferred from shared key_points)
graph = SequentialWorkFlowGraph(goal="Research and write a report", tasks=tasks)

# 3. Instantiate agents and execute
llm_config = OpenRouterConfig(model="anthropic/claude-3.5-sonnet", openrouter_key="sk-or-...")
llm = OpenRouterLLM(config=llm_config)
agent_manager = AgentManager()
agent_manager.add_agents_from_workflow(graph, llm_config=llm_config)

workflow = WorkFlow(graph=graph, llm=llm, agent_manager=agent_manager)
result = workflow.execute(inputs={"topic": "AI agents"})
print(result.result)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment