1. Your first agent
The smallest workflow is one flow with one task in it.
Code:
mermaid
agentflow TB
flow greeter["Greeter"]
hello["Say hello"]@{ instruction: "Greet the user warmly and ask how you can help." }
end
Line by line:
agentflow TBstarts the diagram.TBdraws it top to bottom;LRdraws it left to right.flow greeter["Greeter"]opens a flow with the idgreeterand the title "Greeter".endcloses it.hello["Say hello"]is a task with the idhelloand the label "Say hello".@{ instruction: "…" }holds the task's settings. Theinstructionsays what the step should do.
Every task lives inside a flow, and every task needs an instruction. A label alone names the step but doesn't say what to do.
Code:
mermaid
agentflow TB
flow greeter["Greeter"]
hello["Say hello"]
end
Task "hello" has no instruction, so the workflow can't run it. Add an instruction that says what the step should do.
A flow can also take settings. model picks the model, and the flow's own instruction gives guidance for its steps.
Code:
mermaid
agentflow TB
flow greeter["Greeter"]@{ model: "claude-sonnet-4-5", instruction: "You are a friendly front-desk assistant." }
hello["Say hello"]@{ instruction: "Greet the user warmly and ask how you can help." }
end
Next: 2. Steps in a flow.