6 — Workflow one stage
Lesson 06 — Workflow with one stage and a runbook
You are here: Lesson 6 of 8 · ← Skill · Hub · Next: Second agent →
Goal
Create a workflow with a single stage, bind aac-tutor to it, attach a runbook SOP, and pin the aac-hello skill by name.
What you will change
sg_runbook_sop.greetfromtemplates/greet.mdsg_workflow.tutorialwith one stage +stage_bindings- Full root:
steps/06-workflow/
Why it matters
Chat is free-form. Workflows are repeatable pipelines: named stages, required inputs, pinned procedures. Operators get the same shape every run.
ELI5: Chat is improvisation. A workflow is a play with one scene (for now), a script (runbook), and a cast member (agent).
HCL
resource "sg_runbook_sop" "greet" {
name = "aac-greet"
approve = true
description = trimspace(templatefile("${path.module}/templates/greet.md", {}))
}
resource "sg_workflow" "tutorial" {
name = "aac-tutorial-workflow"
domain = "sre"
description = "Agent as Code tutorial — single-stage greeting workflow."
approve = true
required_inputs = ["prompt"]
stages = [
{
stage_id = "greet"
description = "Load the tutorial skill and print the greeting. No investigation."
required = true
},
]
stage_bindings = [
{
stage_id = "greet"
agent_ref = sg_agent.tutor.name
runbook_refs = [sg_runbook_sop.greet.name]
skill_refs = ["aac-hello"]
},
]
}
| Field | Role |
|---|---|
stages[].description |
Operator-facing outcome |
runbook_refs |
Procedure text injected for that stage |
skill_refs |
Catalog skill names (bodies still from skillsync) |
agent_ref |
Which agent runs the stage — required for non-interactive runs |
Apply & verify
cd examples/scenarios/agent-as-code/steps/06-workflow
tofu init && tofu apply
tofu output workflow_name
tofu output runbook_name
Arrange: Workflow aac-tutorial-workflow in Aiden; skillsync still valid for aac-hello.
Sample prompt (start / run the workflow):
Say hello using the tutorial skill
Assert: Output matches the skill/runbook greeting (Hello from Agent as Code. / Skill: aac-hello); no investigation side quests.
Gotchas
- Always set
agent_refon bindings for automated runs. - Stage description ≠ runbook body — keep procedures in the SOP/skill files.
- If the skill name is missing from the catalog, the stage pin still exists but
load_skillfails — fix skillsync.
Checkpoint
- Workflow and runbook exist
- One successful workflow run
- Greeting matches the skill