Skip to main content

Sequential Pipeline

A multi-agent pipeline that chains two sub-agents: a researcher and a writer.

schema_version: "1.0.0"

metadata:
id: "research-pipeline"
name: "Research Pipeline"
version: "1.0.0"
description: "A sequential multi-agent pipeline"

interface:
input:
type: object
properties:
query:
type: string
required: [query]
output:
type: object
properties:
result:
type: string
required: [result]

execution_policy:
id: agf.sequential
config:
steps:
- agent: researcher
input_mapping:
query: "parent.input.query"
- agent: writer
input_mapping:
research: "researcher.output.result"
query: "parent.input.query"
output_from: "last"

action_space:
local_agents:
- alias: researcher
source: "./agents/researcher.agf.yaml"
description: "Researches the topic"
- alias: writer
source: "./agents/writer.agf.yaml"
description: "Writes the final response"

Key Concepts

Sequential Policy

The agf.sequential policy runs sub-agents in order. Each step completes before the next begins.

execution_policy:
id: agf.sequential
config:
steps:
- agent: researcher
input_mapping:
query: "parent.input.query"
- agent: writer
input_mapping:
research: "researcher.output.result"
query: "parent.input.query"
output_from: "last"
FieldDescription
steps[].agentAlias of the sub-agent (must match a local_agents entry)
steps[].input_mappingMaps data from parent input or previous agent outputs
output_fromWhich step's output becomes the pipeline output ("last" or a step alias)

Input Mapping Expressions

Input mappings use dot-notation paths:

ExpressionMeaning
parent.input.queryThe pipeline's own input field query
researcher.output.resultThe result field from the researcher's output

This lets you wire data between agents without code.

Local Agents

action_space:
local_agents:
- alias: researcher
source: "./agents/researcher.agf.yaml"
description: "Researches the topic"

Each sub-agent is defined in its own .agf.yaml file and referenced by relative path. The agf graph command visualizes these relationships:

info

The agf CLI will be publicly available soon. See the CLI Reference for the command reference. You can validate this example now using the Playground.

agf graph research-pipeline.agf.yaml
# research-pipeline
# ├── researcher (./agents/researcher.agf.yaml)
# └── writer (./agents/writer.agf.yaml)

Other Orchestration Policies

Agent Format supports several orchestration patterns beyond sequential:

PolicyDescription
agf.sequentialRun steps in order
agf.parallelRun branches concurrently, merge results
agf.loopRepeat until a condition is met
agf.batchApply the same agent to each item in a list
agf.conditionalRoute to different agents based on conditions