declarative workflows
A framework where the orchestration of agent interactions is defined in a document, such as YAML, separate from application code, improving manageability and reviewability.
Learn
When to use it
Use declarative workflows when embedding orchestration logic directly in application code becomes cumbersome. Declarative workflows separate orchestration into a document like YAML, making it easier to manage and review complex interactions such as multi-step data processing or automated deployment pipelines.
Quick example
In Claude Code, you might need to orchestrate a sequence of model interactions for a complex task like processing user queries, updating databases, and generating reports. You define this sequence in a YAML file, specifying each step and the conditions for transitions. In this setup, Claude Code uses the declarative workflow to manage the orchestration, separating it from the core application logic.
prompt → declarative workflow → model interactions → stop
Ecosystem
Declarative workflows integrate with various components to streamline orchestration. They sit alongside tools and models, defining how these elements interact without embedding logic directly in code.
┌─ tools ──┐
prompt →│ declarative workflow │→ model
└─ APIs ───┘
Misconceptions
| Misconception | Rebuttal |
|---|---|
| It's only for CI/CD | It applies to any orchestrated process, not just CI/CD |
| Requires custom code | Uses standard formats like YAML, not custom code |
Trade-offs
- Manageability — increased complexity in YAML structure
- Reviewability — separation from code can obscure context
- Flexibility — less adaptable to on-the-fly changes