Declarative Workflow
A method of defining workflows in a readable format like YAML, separating orchestration logic from application code.
Learn
When to use it
Use declarative workflows when embedding orchestration logic directly into application code becomes cumbersome or error-prone. Declarative workflows provide a clear, separate layer for defining sequences and conditions in formats like YAML, enabling complex task orchestration without altering the underlying application logic.
Quick example
In Claude Code, managing AI agent workflows often requires flexible orchestration without modifying the core application code. By using declarative workflows, you can define the sequence and conditions of tasks in YAML files. Claude Code supports this approach by allowing developers to manage workflows separately, ensuring that orchestration logic is distinct from the application code itself.
Ecosystem
Declarative workflows sit alongside other orchestration tools and methods, often integrating with CI/CD pipelines and infrastructure-as-code systems.
┌─ CI/CD ────┐
YAML →│ declarative workflow │→ application
└─ infrastructure ─┘
Misconceptions
| Misconception | Rebuttal |
|---|---|
| It modifies application code | It separates orchestration from code |
| YAML is the only format | Other formats like JSON can be used |
Trade-offs
- Readability — YAML can be verbose
- Flexibility — limited to predefined constructs
- Separation — requires maintaining additional files