Series: The Learn Arc — 50 posts teaching Active Inference through a live BEAM-native workbench. ← Part 26: Session 4.4. This is Part 27.
The session
Chapter 4, §5. Session title: Practice. Route: /learn/session/4/s5_practice.
Chapter 4 has given you the equations, the matrices, and a worked MDP. Session 4.5 is the chapter's final move: build one from scratch, end to end. Read the session. Open the Builder. Make the graph. Save the spec. Instantiate in Studio. Run. Inspect in Glass. Close the loop.
The workshop structure
Session 4.5 is longer than most — ~15 minutes if you actually build. The structure is deliberately full-stack:
- Pick a problem — a 3×3 maze with a goal in the corner. States, observations, actions from Session 4.1.
-
Open the Builder canvas —
/builder/new. Drop blocks:Perceive,Plan,Act, plus an observation adapter for the maze's wall signatures. - Fill parameters — Session 4.2's A, plus C (preference on the goal cell), B (wall-respecting transitions), D (uniform prior). The Inspector validates each field through Zoi.
-
Save+Instantiate — one click. The spec goes to Mnesia; a
Jido.AgentServerboots with a newagent_id. -
Attach to world in Studio — pick
tiny_open_goal; preflight runs; episode starts. -
Run + inspect — Step a few times, watch the belief heatmap, open
/glass/agent/<id>in a second tab, audit each signal.
Six steps. One agent. The whole chapter as a single exercise.
What you actually do
The session page walks you through each step with path-specific narration. A key snippet from the real-world path:
"Drop four blocks on the canvas:
Perceive,Plan,Act, and aPomdpWorldobservation adapter. Wire observation → Perceive → Plan → Act → world. Click Inspector, setpreference_strengthto 4.0,policy_depthto 5. Save the spec. Studio offers Instantiate — accept. Your agent is live."
The equation path adds the matrix-level specifics. The derivation path sketches the Zoi validator's contract (what makes a well-formed A matrix). The kid path replaces "preference_strength" with "how-much-the-agent-wants-it-ness."
The Save+Instantiate pipeline
The button is a three-stage pipeline under the hood:
Builder canvas state
↓ validate every param through Zoi
Spec (content-addressed, BLAKE2b)
↓ store to Mnesia via AgentRegistry
↓ resolve via SpecCompiler → Bundle
Jido.AgentServer boot
↓ register with AgentPlane.Instances
Studio lifecycle row (state = :live)
The spec is content-addressed — any two builds with the same parameters hash to the same spec_id. That's useful later when you want to reproduce a run: the spec_id in a cookbook recipe's Runtime block is exactly this hash.
The preflight
When you attach your new agent to a world, Studio runs a dimension preflight before connecting the episode. It asks:
- Does the agent's observation blanket match the world's
ObservationPacketschema? - Does the agent's action vocabulary subset the world's accepted actions?
- Do the state cardinalities align?
If anything mismatches, Studio refuses the attach with a friendly error and tells you exactly which field failed. No broken runs; no silent truncation.
What to inspect after running
Once the episode is running, the Studio run view shows everything Chapter 4 promised:
- Maze grid with agent position.
- Belief heatmap (Q_s, updated by Eq. 4.13).
- Policy posterior (Q_π, updated by Eq. 4.14).
- Predicted trajectory overlay (B applied to best_policy).
- Step history.
- F, G, risk, ambiguity columns per candidate policy.
And on /glass/agent/<id> — one audit row per signal, per equation, per tick. Clickable to the equation page. Tag-filterable by equation_id. Downloadable as CSV for further analysis.
The four-modality extension
The session's stretch exercise: replace the single wall-signature observation with a multi-modal observation space (walls + goal-proximity + direction-hint). Add a second A matrix. Watch the agent's belief update mix evidence across modalities.
This sets up /cookbook/multimodal-* recipes, which we'll pick up in later Chapter-7 sessions.
The concepts this session surfaces
- Spec — content-addressed agent specification.
- Bundle — runtime-instantiated A/B/C/D bundle.
- Preflight — dimension-check before attachment.
- Studio lifecycle — agent survives across episodes.
The quiz
Q: You build a spec in the Builder, save it, and try to attach the new agent to a world. Studio refuses with "preflight failed: observation dim mismatch." What's the most likely cause?
- ☐ The agent's C vector has the wrong length.
- ☐ The agent's A matrix has rows indexed over a different observation modality than the world emits. ✓
- ☐ The Jido supervisor didn't start.
- ☐ The Dirichlet prior on A is invalid.
Why: Preflight checks that the agent's expected observation shape matches the world's emitted
ObservationPacket. If A's rows are over{heads, tails}but the world emits{wall_north, wall_south, wall_east, wall_west}, they don't match. Studio catches this before the episode starts. Re-align either A or the world spec.
Run it yourself
-
/learn/session/4/s5_practice— the workshop itself. -
/builder/new— start your build. -
/studio/new— instantiate + attach flow. -
/guide/cookbook— how to structure your spec like the built-in recipes. -
/cookbook/pomdp-tiny-corridor— the reference implementation you're reproducing.
The mental move
Chapters 1–3 gave you the theory. Chapter 4 gave you the matrices. Session 4.5 asks: can you actually build one? When you finish this session with a custom agent running in Studio, you've moved from reading about Active Inference to practicing it. Everything from here on builds on that practice.
Next
Part 28: Session §5.1 — Factor graphs. We move into Chapter 5 — the neuroscience chapter. Starting with how the cortex can be read as a factor graph whose nodes are doing variational inference. The most grounded mapping from AI math to real neural circuits the book offers.
⭐ Repo: github.com/TMDLRG/TheORCHESTRATEActiveInferenceWorkbench · MIT license
📖 Active Inference, Parr, Pezzulo, Friston — MIT Press 2022, CC BY-NC-ND: mitpress.mit.edu/9780262045353/active-inference
← Part 26: Session 4.4 · Part 27: Session 4.5 (this post) · Part 28: Session 5.1 → coming soon

Top comments (0)