Edge Agent Workflow Examples: Sensor-to-Action Patterns
These are worked sensor-to-action patterns for the open-source edge-agents runtime — each is a small graph of nodes connected by typed edges that reads hardware, reasons with an agent step, and acts, entirely on-device. They build on the quickstart; if you have not run a workflow yet, start there. For the runtime itself, see Open-Source Edge Agent Runtime.
Recall the five edge types: control, tool, agentTask, agentChoice, agentDelegate. GPIO, ADC, DAC, PWM and UART are first-class nodes, and MQTT is a first-class transport. The patterns below combine those primitives.
Pattern 1: GPIO Read → agentChoice → PWM Write
A closed local control loop with an agent in the middle making the branching decision.
[GPIO read: sensor]
│ control
▼
[agentChoice: above threshold?]
│ control │ control
▼ ▼
[PWM write: ramp up] [PWM write: hold]
- The GPIO read node samples a digital input (for example a level switch or a tachometer pulse).
- The
agentChoiceedge lets the agent branch: based on the reading (and any policy in its context), it picks a path. - Each branch ends in a PWM write node that drives an actuator at a different duty cycle.
Because GPIO and PWM are native nodes and the decision runs on-device, this loop needs no network at all — a good fit for the air-gapped scenarios in Offline AI Agents.
Pattern 2: UART Sensor → agentTask (local LLM) → MQTT Publish
A sense-reason-report loop using a local model for the reasoning step.
[UART read: sensor frame]
│ control
▼
[agentTask: interpret reading with local LLM]
│ control
▼
[MQTT publish: advisory topic]
- The UART read node parses a frame from a serial sensor.
- The
agentTaskstep hands the reading to a locally served model (the llama.cpp server from step 5 of the quickstart) to produce a short interpretation or anomaly note. - The MQTT publish node posts the result to a status/advisory topic that a plant dashboard subscribes to.
Local or cloud LLM is a configuration choice here — point the agentTask at http://localhost:8090 for offline operation, or at a cloud endpoint when connectivity is available. Model sizing per board is covered in Local LLMs for Edge Devices.
Pattern 3: Predictive-Maintenance Advisory
The agentic version of the AI service technician loop documented in Edge Agents for Machine Service, expressed as a workflow.
[MQTT sub: drive fault code]
│ control
▼
[tool: look up fault catalog]
│ tool
▼
[agentTask: explain + rank likely causes (local LLM)]
│ control
▼
[agentDelegate: escalate if safety-critical]
│ control
▼
[MQTT publish: technician advisory]
- An incoming fault code arrives over MQTT.
- A
tooledge invokes a fault-catalog lookup. - An
agentTaskstep uses the local model to turn the raw code plus catalog entry into a ranked, plain-language explanation. - An
agentDelegateedge hands off to a higher-tier agent when the fault is flagged safety-critical — modelling the human-in-the-loop escalation that safety-relevant maintenance requires. - The advisory is published back over MQTT to the technician UI.
This is the same machine-service pattern, now as a buildable my.workflow.json you can validate with fh-workflow check-schema and fh-workflow validate (see the quickstart).
Build These Yourself
Each pattern is a my.workflow.json you can open in the visual builder, validate, and deploy to a Pi, Jetson, NUC, STM32MP25 or ctrlX CORE (see the hardware matrix). The full source is on GitHub. edge-agents is built by ForestHub.ai; for help taking these patterns to production, book an architecture call.
Related Pages
- Edge Agent Quickstart — build and run your first workflow
- Open-Source Edge Agent Runtime — the runtime and its graph model
- Edge Agents for Machine Service — the predictive-maintenance use case in depth
- Edge Agent Hardware Support Matrix — target devices
FAQ
Are these full, runnable workflow files?
They are annotated patterns showing the node/edge structure. Recreate them in the visual builder (fh-workflow open) and validate with check-schema / validate before deploying. See the quickstart.
Do these run offline?
Yes — with a local LLM (quickstart step 5) every pattern runs on-device with no cloud round-trip. The agentTask steps can target a cloud model instead if you prefer.
What is the difference between agentTask, agentChoice and agentDelegate?
agentTask hands a unit of work to an agent step, agentChoice lets the agent branch between alternatives, and agentDelegate hands a sub-goal to another agent. Pattern 1 uses agentChoice, Pattern 3 uses both agentTask and agentDelegate.