Walkthrough
Follow along in your own environment. Copy the commands and adapt them to match your setup. The walkthrough assumes you have completed the one-time environment setup and that bash and python3 (with pyyaml) resolve on your PATH.
Complete the Hello Two Picos lab so the multi-Pico runtime story (Manifold as RuntimeEnvironment on a Kubernetes RuntimeSubstrate, one Wrangler-declared Channel, one event, one Observation) is already familiar. This lab layers a provider-neutral message envelope on top of that runtime story without adding a second runtime.
Step 1 — Create a working directory and copy the downloads
From the root of your local clone of the academy repository:
mkdir -p work/hello-pico-nervous-system-mqtt && cd work/hello-pico-nervous-system-mqtt
cp -r ../../labs/hello-pico-nervous-system-mqtt/downloads/. .
ls -1Expected output (order-independent):
discovery.yaml
emqx-adapter.yaml
envelope.schema.json
messages
mqtt-topics.yaml
picos.yaml
topology.yaml
verify.sh
messages/ contains the seven sample messages — one per envelope kind (presence, discovery, observation, event, command, delegation, result).
Step 2 — Read the provider-neutral envelope schema
Before running anything, read envelope.schema.json. It is the authoritative shape of every Pico nervous-system message:
cat envelope.schema.jsonKey fields to notice:
source.picois the stable Pico identity. It is deliberately separate fromsource.transport.mqtt.client_idandsource.transport.kubernetes.pod.correlation_idgroups related messages (e.g. a delegation and its paired result);causation_idnames the specific message that caused this one (e.g. an event caused by an observation).authorizationis required oncommandanddelegation— the emitter must show which principal is acting and which capability is being invoked. Publishing to a topic is not itself authorization.
Step 3 — Read the Pico registry and discovery snapshot
cat picos.yaml
cat discovery.yamlpicos.yaml lists three Picos by stable identity (pico.architect.001, pico.detective.017, pico.garden.042) with transport identifiers (MQTT client_id, Kubernetes pod) that are different from the Pico identity. discovery.yaml is the local snapshot of what a live broker’s discovery view would advertise from combined presence messages and retained capability advertisements.
Step 4 — Read the seven sample messages
ls -1 messages
for f in messages/*.json; do echo "--- $f ---"; cat "$f"; doneTogether the seven messages form two complete flows:
- observation → event → command: the garden Pico observes moisture (
03-observation.json), emits asoil_dryevent citing that observation viacausation_id(04-event.json), and the architect Pico issues agarden.watercommand back to the garden Pico with a fullauthorizationcontext (05-command.json). - delegation → result: the architect Pico delegates
architecture.investigateto the detective Pico with a freshcorrelation_idand full authorization (06-delegation.json), and the detective Pico returns aresultsharing the samecorrelation_id, citing the delegation viacausation_id, and carrying the samedelegation.mission(07-result.json).
Step 5 — Run the deterministic local verifier
Run the shipped verification script. It performs the checks listed in Objectives without contacting a broker or a cluster:
bash verify.shExpected output ends with:
verify: static — envelope, identity, authorization, correlation, MQTT topic-map, EMQX adapter, and topology all OK
verify: OK — verify passed
If PyYAML is missing the verifier prints a clear verify: FAIL — PyYAML is required (pip install pyyaml) line and exits non-zero.
Step 6 — Read the MQTT topic map and EMQX adapter
cat mqtt-topics.yaml
cat emqx-adapter.yamlmqtt-topics.yaml declares a topic pattern for each of the seven envelope kinds and records that publishing to a topic is not itself authorization. emqx-adapter.yaml names how a real EMQX broker would attach without claiming to run one: status: optional-not-executed and no live endpoint, credentials, or shared secrets are shipped. The verifier in Step 5 already asserts this.
Step 7 — Read the Kubernetes-substrate topology
cat topology.yamlThe Wrangler-style InteractionTopology fragment binds the three Picos to runtimeEnvironment: manifold-on-kubernetes — the same RuntimeEnvironment stood up by the Hello Two Picos lab. No second runtime is introduced.
Step 8 — Capture the produced artifact
Capture the downloads and the verifier output into a single hello-pico-nervous-system-mqtt/ directory — this is the lab’s produces: artifact:
mkdir -p build/hello-pico-nervous-system-mqtt
cp -r . build/hello-pico-nervous-system-mqtt/
bash verify.sh > build/hello-pico-nervous-system-mqtt/verify.txt
grep -Fq 'verify: OK' build/hello-pico-nervous-system-mqtt/verify.txt \
&& echo "artifact OK"
ls -1 build/hello-pico-nervous-system-mqttverify.txt is the captured evidence line the local verifier prints; it is the Phase 7 counterpart of the observation.txt captured in the Hello Two Picos lab.
Step 9 — Cleanup
cd ../.. && rm -rf work/hello-pico-nervous-system-mqtt build/hello-pico-nervous-system-mqttTroubleshooting
- If
verify.shreportsPyYAML is required, runpip install pyyaml(orpython3 -m pip install pyyaml) inside the same Python environment and re-run the verifier. - If
verify.shreports asource.pico … not in Pico registryerror, confirm you copiedpicos.yamlalongside the sample messages — everysource.picovalue must be listed inpicos.yaml. - If you add a new envelope kind or a new Pico, remember to update both
envelope.schema.json(orpicos.yaml) and the corresponding entry undermessages/andmqtt-topics.yaml; the verifier will fail until all three files agree. - The lab does not stand up a live MQTT broker or EMQX cluster. If you want to carry the same envelope over a real broker, that is a follow-up lab and requires flipping
emqx-adapter.yaml’sstatus.
Next
Compare your work against the reference solution.