Agent as Code — Zero to Hero

Codify Aiden agents in Terraform/OpenTofu with raw sg_* resources (the hard way), apply them, change them in Git, and re-apply. Same loop you already use for infrastructure — now for agents, knowledge, integrations, models, skills, workflows, and runbooks. Opinionated aios-* modules are an optional next step after this series.

Who this is for: you know basic Terraform (provider, module, resource, plan, apply). You do not need prior Aiden or StackGen experience.

Who this is not for: teaching Terraform from scratch, or running a full multi-cloud SRE demo. For SE demos, use Adopt Path 1.


How to use this path

  1. Complete Prerequisites once.
  2. Work the lessons in order (each step folder is cumulative).
  3. On every lesson page: read Goal → edit the matching step folder → Apply & verify → hit Checkpoint before Next.
  4. Prefer OpenTofu (tofu); HashiCorp Terraform works the same way.

Companion code lives under examples/scenarios/agent-as-code/steps/.


Lessons

# Lesson Outcome Step folder
00 Prerequisites Credentials, provider, map of what you will build —
01 Create an agent First sg_agent + persona in Git steps/01-agent
02 Add knowledge Knowledge base + memory/graph flags steps/02-knowledge
03 Add an integration Raw sg_integration → agent tools + knowledge source steps/03-integration
04 Add an LLM model Raw secret → provider → model on the agent steps/04-llm-model
05 Add a skill Skill card in git + skillsync steps/05-skill
06 Workflow (one stage) Workflow + runbook + one stage steps/06-workflow
07 Second agent & stage Multi-agent workflow with dependencies steps/07-multi-agent
08 Attach a runbook Extra SOP bound to the agent’s stage steps/08-runbook-attach

Optional reference: Concepts — sg_* used in this series.

Time: roughly 2–4 hours end-to-end if you apply every step; less if you read and jump to a later folder.


After the series

Start with prerequisites →