The pattern
- Draft: the model proposes a full artifact (e.g., a Howgrams diagram JSON document).
- Validate: validate the output against your schema and invariants.
- Reflect: if validation fails, feed the error messages back to the model.
- Revise: the model outputs a corrected full artifact.
Why this works
- Schema errors are precise and actionable (“missing children”, “unexpected property”).
- The agent loop turns fuzzy language into deterministic structure.
- Retries converge quickly when the schema is strict.