learning-it by example

Back to the video

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

  1. 0:00 A diagram can hide a shortcut that the rules do not allow
  2. 0:35 The idea
  3. 1:10 Setup
  4. 1:39 The model
  5. 2:16 The checks
  6. 2:46 The diagram as text
  7. 3:52 What this does not show
  8. 4:22 Mistakes to avoid
  9. 4:47 My take and next steps
  10. 5:16 Recap

Files

  • c4.py (39 lines)
  • compare.py (16 lines)
  • model.py (24 lines)

Download the code (zip)

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.