C4 Diagrams for AI Systems, Written and Checked as Code
A diagram can hide a shortcut your own rules do not allow. Check the model before you draw it.
Video #241 ยท Enterprise architecture and AI agents
Steps in the video
Files
- c4.py (39 lines)
- compare.py (16 lines)
- model.py (24 lines)
Tested with
Python 3.12.15
What this does not show
A toy model at one C4 level with four planted mistakes; the Mermaid text is not rendered in the video; Structurizr and LikeC4 were not run; the script prints problems and exits 0, so it needs a non-zero exit before it can fail a build; the gateway rule is mine, not C4; a checked model can still differ from the real system.
Sources
Learning IT by Example.