Workflow

Building Efficient Workflows

Workflow Execution Logic

PuppyAgent workflows are visual pipelines built from Blocks (data containers) and Edges (processing operations). When you click Run, the backend automatically interprets your canvas layout, determines the flow of information, and executes all connected steps in the correct order.

The system processes workflows from start to end, identifying how data should be passed between each step, including cases with branching and merging paths.

Let's walk through some common examples to help you understand how execution works in different workflow structures.

How Execution Works Behind the Scenes

  • Blocks represent data inputs, intermediate states, or final outputs.
  • Edges define how to transform or process the data from one block to another.
  • Start Blocks are blocks that don't have any incoming edges—they initiate the workflow.
  • End Blocks are blocks with no outgoing edges—they receive the final output.

You won't see any labels like "START" or "END" in the user interface, but they are automatically identified by the backend to determine where execution begins and ends.


Example 1: A Simple Single-Step Workflow

eg1a

This workflow contains:

  • One input block a
  • One processing edge (e.g., an LLM)
  • One output block b

🟢 Execution:

  • The edge between a and b runs once you hit the Run button.
  • b is updated based on the processing result from the input a.

Example 2: A Linear Multi-Step Workflow

eg2a

This workflow connects three blocks in a straight line using two edges:

  • abc, each with its own processing edge

🟢 Execution:

  1. The edge between a and b runs first.
  2. Once b receives its content, the second edge runs to process b into c.

This is the most common setup for step-by-step processing.


Example 3: Parallel Processing with Merging Results

eg3a

This workflow contains two separate paths that merge into a single edge:

  • ab, and de
  • Then both b and e connect to the final edge → c

🟢 Execution:

  1. The edges ab and de run in parallel.
  2. Once both b and e are ready, the edge to c is triggered.

This structure is useful when you want to combine results from multiple sources before continuing.


Example 4: Three-Step Workflow with Dependency Merge

eg3a

This workflow includes:

  • Initial steps: ab, and de
  • Then bf
  • Finally, f and e are merged into c

🟢 Execution:

  1. The first layer runs in parallel: ab and de
  2. Once b is ready, it continues to f
  3. Once both f and e are ready, the final edge runs to update c

This setup is typical when combining results from separate sub-workflows.


Example 5: A RAG Workflow

eg5a

This workflow includes:

  • Retrieve steps: abcd
  • Then, d and e are merged into f
  • f and e generate g

🟢 Execution:

  1. The first layer runs: abcd
  2. Once both d and e are ready, the edge runs to update f
  3. Generate g

💡 Tips

  • You don’t need to manually define execution order – just connect blocks using edges, and PuppyAgent will handle it automatically.
  • To debug, try locking intermediate blocks so you can isolate and test specific steps.
  • Use parallel structures when two or more inputs are needed for a single operation, such as combining multiple documents for retrieval.