This page walks through every built-in OpenAgentFlow example and teaches you to build your own workflows.
OpenAgentFlow ships with four example workflows of increasing complexity:
| Example | Agents | Features |
|---|---|---|
| hello.oaf | 1 | Simplest possible workflow |
| summarize.oaf | 2 | Shared state, @required, inputs/outputs |
| software-dev.oaf | 3 | Tools, config block, temperature tuning |
File: examples/hello.oaf
The simplest possible OpenAgentFlow workflow: one agent, no state.
// Minimal workflow: single agent, no state
workflow "Hello" {
agent Greeter {
instructions: "Say hello to the user."
model: "gemini-2.0-flash"
}
flow {
start -> Greeter
Greeter -> end
}
}
graph LR
S((start)) --> G["Greeter"]
G --> E((end))
instructions and model — no state neededstart -> Agent -> end flowoaf run examples/hello.oaf
File: examples/summarize.oaf
A two-agent pipeline that analyzes text and produces a summary, demonstrating shared state and the @required option.
// Summarize workflow: analyze text then produce a summary
workflow "Summarize" {
state {
request: string
source_text: string @required
key_points: list[string]
summary: string
}
agent Analyst {
instructions: """
Analyze the request and source text.
Identify the most important facts, themes, and action items.
Produce concise key_points only.
"""
inputs: [request, source_text]
outputs: [key_points]
model: "gemini-2.0-flash"
}
agent Writer {
instructions: """
Use the key_points to write a clear, concise summary.
Preserve meaning, remove redundancy, and match the requested tone.
"""
inputs: [key_points]
outputs: [summary]
model: "gemini-2.0-flash"
}
flow {
start -> Analyst
Analyst -> Writer
Writer -> end
}
config {
version: "0.1"
runtime: "langgraph"
}
}
graph LR
S((start)) --> A["Analyst"]
A --> W["Writer"]
W --> E((end))
string, list[string])@required option on source_text — must be provided via --inputrequest + source_text, produces key_points → Writer reads key_points, produces summary# With input data
oaf run examples/summarize.oaf --input examples/summarize-input.json
summarize-input.json)The summarize-input.json file provides the required source_text:
{
"source_text": "Your text to summarize...",
"request": "Summarize the key technical findings"
}
File: examples/software-dev.oaf
A three-agent pipeline simulating a software development process with tools and configuration.
// Three-agent pipeline: research → design → implement
workflow "Software Development" {
state {
requirements: string
analysis: string
architecture: string
implementation: string
status: string
}
agent Analyst {
instructions: """
Analyze the requirements document.
Identify key features, constraints, and acceptance criteria.
Produce a structured analysis.
"""
model: "gemini-2.0-flash"
temperature: 0.3
inputs: [requirements]
outputs: [analysis]
}
agent Architect {
instructions: """
Based on the analysis, design a technical architecture.
Include component diagrams, data flow, and API contracts.
"""
model: "gemini-2.0-flash"
temperature: 0.5
inputs: [analysis]
outputs: [architecture]
}
agent Developer {
instructions: """
Implement the solution based on the architecture.
Write clean, tested, production-ready code.
"""
model: "gemini-2.0-flash"
temperature: 0.2
tools: ["code_interpreter", "file_writer"]
inputs: [architecture]
outputs: [implementation, status]
}
flow {
start -> Analyst
Analyst -> Architect
Architect -> Developer
Developer -> end
}
config {
version: "0.1"
timeout_seconds: 600
}
}
graph LR
S((start)) --> A["Analyst<br/>temp: 0.3"]
A --> R["Architect<br/>temp: 0.5"]
R --> D["Developer<br/>temp: 0.2"]
D --> E((end))
implementation and statusWhat task should the workflow accomplish? Break it into distinct steps that could each be handled by a specialized agent.
What data flows between agents? Define variables for each piece of information:
state {
// Inputs — what starts the workflow
user_query: string @required
// Intermediate — data passed between agents
research_results: list[string]
analysis: string
// Outputs — what the workflow produces
final_report: string
}
Create one agent per distinct task. Write clear, specific instructions:
agent Researcher {
instructions: """
Search for relevant information about the user's query.
Return 3-5 key findings as a structured list.
"""
model: "gemini-2.0-flash"
temperature: 0.3
inputs: [user_query]
outputs: [research_results]
}
agent Analyst {
instructions: """
Analyze the research results.
Identify patterns, contradictions, and key insights.
Produce a structured analysis.
"""
model: "gemini-2.0-flash"
temperature: 0.4
inputs: [research_results]
outputs: [analysis]
}
agent ReportWriter {
instructions: """
Write a comprehensive report combining the analysis
and original query context.
Target: 500-800 words, professional tone.
"""
model: "gemini-2.0-flash"
temperature: 0.7
inputs: [user_query, analysis]
outputs: [final_report]
}
flow {
start -> Researcher
Researcher -> Analyst
Analyst -> ReportWriter
ReportWriter -> end
}
Always validate first to catch errors cheaply:
oaf validate my-workflow.oaf
Create a JSON file with test data:
{
"user_query": "What are the latest trends in renewable energy?"
}
oaf run my-workflow.oaf --input test-data.json
The most common pattern — agents process data sequentially:
flow {
start -> A
A -> B
B -> C
C -> end
}
One agent’s output feeds multiple downstream agents:
flow {
start -> Router
Router -> PathA
Router -> PathB
PathA -> end
PathB -> end
}
Multiple paths converge on a single agent:
flow {
start -> Splitter
Splitter -> AnalystA
Splitter -> AnalystB
AnalystA -> Merger
AnalystB -> Merger
Merger -> end
}
Note: In v0.1, all paths execute sequentially (LangGraph processes nodes in topological order). True parallel execution is planned for future versions.
.oaf Language — Full syntax reference