aws-samples / aws-samples/sample-autonomous-cloud-coding-agents

RFC: Workflow graph syntax compiled to step-runner IR

Open
#565 0 comments 0 reactions 0 assignees View on GitHub
agent-runtime registry RFC-proposal
Dominant language
TypeScript
Stars
143
Forks
46
Avg merge
3d 9h
Merged PRs (30d)
20

Description

## Primary area

Agent (Python runtime)

## Related issue or feature request

- [WORKFLOWS.md](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/blob/main/docs/design/WORKFLOWS.md) — linear YAML steps today
- [ADR-014](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/blob/main/docs/decisions/ADR-014-workflow-driven-tasks.md)
- #457 (fix loops / `retry_target` on verify steps)
- #230 (event-driven governance — sync checkpoints for plan-before-code)

## Summary

When linear YAML steps become limiting, introduce a **workflow graph authoring format** that compiles to the existing step-runner intermediate representation (ordered steps with explicit jump metadata). The runner execution engine stays unchanged in v1; the compiler is the new component.

## Use case and motivation

Current workflows are intentionally linear with one `run_agent` ([WORKFLOWS.md](https://github.com/aws-samples/sample-autonomous-cloud-coding-agents/blob/main/docs/design/WORKFLOWS.md)). Fix loops and human gates add control flow via fields on steps, but complex flows (parallel review, plan-revise loops, conditional skip) become awkward as YAML lists.

A graph syntax makes branching, loops, and parallelism **visible in review** and diffable. Compilation to IR keeps the runtime simple and testable.

## Proposal

### Authoring

- New workflow file with format TBD instead of `steps:` in YAML.
- Nodes map to step kinds; edges carry conditions (`outcome=succeeded`, human choice keys).
- `model` / stylesheet attributes on graph or nodes compile to per-step overrides.

### Compilation

- CDK synth-time and `agent` loader invoke compiler → normalized `steps` + `control_flow` IR validated by existing JSON Schema where possible.
- Golden fixtures in `contracts/workflow-graph/` (graph input → expected IR).

### Execution (phased)

- **v1:** Compiler emits linearized steps with `jump_to` metadata; runner gains minimal jump support.
- **v2:** Parallel fan-out (explicitly out of scope for #248 / #99 today).

## Out of scope

- Visual editor / web UI for graphs
- Meta-agents that generate graphs at runtime
- Replacing YAML for simple workflows — graph is opt-in
- Multi-`run_agent` without explicit RFC approval

## Potential challenges

- **Validator parity** — Graph cross-field rules must match YAML rules (cedar-parity lesson).
- **Resume/checkpoint** — Jump targets must serialize in `workflow_state.json`.
- **Authoring burden** — learning curve; mitigate with examples in `agent/workflows/`.

## Dependencies and integrations

- `agent/src/workflow/compiler/` (new)
- `agent/workflows/schema/`
- `cdk/` synth-time validation
- `contracts/workflow-validation/` corpus extension

## Alternative solutions

1. **YAML-only control flow** — `retry_target`, human gates via #230; sufficient for medium term.
2. **Python DSL** — More expressive but not reviewable by non-Python authors.
3. **Registry-stored graphs** — Phase 4 #246; local compiler still needed for dev.

---

**Note:** Non-triaged RFCs may not get timely review. PRs on non-triaged issues might not be accepted.

Contributor guide

Open the contributing guide

Research direction

Read docs/design/WORKFLOWS.md and ADR-014 first, then inspect the existing agent/workflows/schema/ and contracts/workflow-validation/ structures. The proposed work would add agent/src/workflow/compiler/ and golden fixtures under contracts/workflow-graph/; done means the graph format and compilation behavior are specified well enough to produce validated step-runner IR without changing the execution engine beyond the stated v1 scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
build-system, compilers, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.