Architecture
How does Agent Actions decide which actions run first? How does data flow from one action to the next? Understanding the architecture helps you design better agentic workflows and debug issues when they arise.
Agent Actions uses a Directed Acyclic Graph (DAG) execution model—think of it like a recipe where some steps can happen in parallel (chopping vegetables while water boils) but others must wait for dependencies (you can't strain pasta until it's cooked). This architecture enables parallel execution, deterministic ordering, and clear data flow.
DAG Execution Model
Let's walk through how actions are organized for execution. The diagram below shows four actions grouped into levels:
Notice that action_1 and action_2 have no dependencies, so they can run in parallel. action_3 waits for both to complete, and action_4 waits for action_3.
Actions are organized into levels based on their dependencies:
| Level | Description | Execution |
|---|---|---|
| Level 0 | Actions with no dependencies | Execute in parallel |
| Level 1 | Actions depending only on Level 0 | Execute after Level 0 completes |
| Level N | Actions depending on Levels 0..N-1 | Execute after all dependencies complete |
Actions within the same level execute concurrently up to the concurrency limit (default: 5, max: 50). This is a practical limitation to avoid overwhelming API rate limits.
Data Flow
You might wonder: how does data get from one action to the next? Field references work like spreadsheet formulas—when you write {{ extract_facts.facts }}, you're pointing to a cell that will be filled in when that action completes.
Data flows through the DAG via field references:
The arrows show data dependencies. validate_facts can't run until extract_facts produces its output.
When an action references {{ upstream_action.field }}:
- Locate - Find the output file from the upstream action
- Extract - Parse JSON and extract the specified field
- Inject - Make value available in prompt template
Component Architecture
Here's how the pieces fit together. Each layer handles a specific concern:
Notice the dotted line from Reprompting back to Template—this is the retry loop that fires when validation fails.
Execution Lifecycle
Let's walk through what happens when you run agac run -a my_workflow.
1. Configuration Loading
- Parse
agent_actions.yml(project config) - Parse agentic workflow YAML
- Merge configuration hierarchy (project defaults -> agentic workflow defaults -> action)
- Validate configuration
2. Pre-flight Validation
- Check all field references resolve
- Validate schema files exist
- Verify vendor compatibility
- Detect circular dependencies
3. DAG Construction
- Build dependency graph from action
dependencies - Compute execution levels
- Validate DAG is acyclic
4. Execution
For each level:
- Evaluate guards (skip/filter actions)
- Prepare prompts (resolve field references, apply context scope)
- Execute actions in parallel (up to concurrency limit)
- Validate outputs against schemas
- Reprompt on validation failure (if enabled)
- Write outputs to target directory
5. Output
- JSON files per action per record in
target/ - Lineage tracking via
source_guidandnode_id - Passthrough fields merged from context scope
This lineage tracking is important: it lets you trace any output back through the actions that produced it, which is invaluable for debugging and auditing.
See Also
- Run Modes — Batch vs online execution
- Granularity — Record vs file processing
- Data I/O — Directory structure and file formats
- Validation — Pre-flight and schema validation