Repository navigation
Replies: 6 comments 2 replies
Corrections after internal reviewWe reviewed the plan against the code after posting it. Twelve things were weaker than the text said; none change the shape of the feature, but four of them change what phase 1 and phase 2 contain. The post above has been left as it was so the thread stays readable; the attached PDF is updated.
Two questions this adds for reviewers:
|
|
Thanks for this. the idea of AI informs, people and plain rules move things line is the right foundation, and the post-review corrections show the care. Comments from the agent/eval side, grounded in what the harness measured on the camera agent (#616, #617, #618, and the monitor-threshold PR). 1. Small models report success they didn't achieveAcross the live runs, the failure that worried me most wasn't wrong tool choice, it was confident false reports: qwen2.5:1.5b replied "I'm watching for more than 3 people" over a watch with no threshold; llama3.2:1b said it was watching after the camera lookup had refused its call; qwen2.5:1.5b answered "hi" with "I see the front door. It's 14:55." So:
2. Self-reported confidence from a 1–3B model isn't calibratedThe
Happy to measure all three with the harness before we pick one. 3. Schema-constrained output fixes shape, not contentConstrained decoding will stop malformed JSON, but the failure we measured is valid-shaped output with the wrong or missing content: qwen2.5:1.5b left 4. Investigate on CPU (Q6)Measured on 4 vCPU, no GPU: qwen3:1.7b ~9 s per tool-calling turn, llama3.2:3b ~40 s. An Investigate with 4–5 tool calls is 40 s+ on CPU at best. More important: with the router and grounding guard off, models chose the right tool themselves far less often (qwen3:1.7b 10/45 before the fixes; only llama3.2:3b did most of the work itself, 30/45). Investigate removes exactly those backstops. So:
5. Accuracy gating needs an interval, not a ratio"Accuracy target over 20 marked runs": 18/20 = 90% has a 95% Wilson interval of roughly 70–97%. I'd gate severity on the lower bound (the harness already reports Wilson intervals), otherwise a lucky 20 promotes an unreliable workflow. 6. Evaluation as a release gate
7. Q2 (one AI step, two modes)One step in the UI is fine. I'd keep them separate in traces, metrics and limits: their cost and failure profiles differ by an order of magnitude. Where I can helpI'd like to own the AI-step side of Phase 2: the SDK tool loop (with |
|
Read the full PDF and i am glad to see the harness as the gate for Investigate and Describe it, and the verify pattern already covers part of my point 1. One data point on the CPU limits (4 calls / 120 s): on 4 vCPU, qwen3:1.7b runs ~9 s per model turn, so it fits; llama3.2:3b runs ~40 s, so 4 calls plus the answer is 160 s+. But llama3.2:3b is the model that chose tools well on its own (30/45 vs 10/45 with router and guard off), and Investigate has neither. So on CPU the model that can pass the Investigate cases likely can't meet the limit, and the one that meets it likely can't pass. I'd expect Investigate to be effectively GPU-only at launch, which makes Look-on-CPU the important path. I can confirm that once the Investigate cases exist. On the 80%/20-runs gate: at exactly 16/20 the 95% interval is roughly 58–92%. I'm happy to write the Investigate and drafting cases for the harness (phase 2), and they'd tell us early whether any CPU model qualifies. |
Design note:
|
Decision: the workflow file is a public contractOne addition to the design before Phase 2 builds on it. A workflow is a YAML file. The visual builder edits it, "Describe it" drafts it, and the validator checks it. That makes anything that can produce the file a builder, so I want the file format treated as a public, versioned contract, like the event contracts ( What that buys:
Three things this asks of the Phase 2 design:
@Emart29 none of this changes the AI step library; it fixes what the engine imports and exports around it. Shout if any of it fights the design. |
Draft: the AI step schema and executor (Phase 1 Look, Phase 2 Investigate)For review before I build it, so the engine core (registry, validator, persistence, routers) can be built against it. Scope is the AI step only: how it reads in the workflow file, what the validator checks, what the executor returns, and what gets stored. Triggers, paths and actions are the engine's; where I assume something about them it's marked (engine). It follows the RFC's YAML (§5) and the decision above that the workflow file is a public contract ( 1. In the workflow fileThe RFC's AI step, with one new key, then:
- ai:
mode: investigate
goal: Decide whether the person in the yard is a threat.
instructions: Guards on patrol are not intruders. Alert only when someone who should not be there is on site.
tools: [describe_camera, recognize_faces, recent_events] # read / ask only, at most 5
decision: [ignore, watch, alert] # outcomes; unsure is always added
fields: { who: [staff, contractor, intruder, unknown] } # the facts the model reports
rules: # new: first match wins, no match = unsure
- { when: { who: intruder }, then: alert }
- { when: { who: [staff, contractor] }, then: ignore }
- { then: watch }
sure: 0.75
limits: { tool_calls: 6, seconds: 45 }
ignore: [ log: "{reason}" ]
watch: [ notify: { who: role:guard, severity: low, message: "{reason}" } ]
alert: [ alert: { severity: medium, title: "Intruder on {camera}" } ]
unsure: [ ask_person: { who: role:guard, message: "Possible intruder on {camera}. Threat?", replies: [Yes, No], timeout: 60s } ]
2. What the validator refusesThe AI step's checks already live in the SDK (
3. The executor
An 4. What gets stored
( 5. When a step is offered
Open questions
|
Uh oh!
There was an error while loading. Please reload this page.
We are planning a new feature, Agentic Workflows, and want the community's review before we build it. This post is the full design and implementation plan. A PDF with the screen mockups is attached below. Comments on everything are welcome, but section 12 lists the specific questions we would most like answered.
Summary
A Workflows page where a site builds automations from a short vertical flow: a trigger, a few steps, an outcome. One step kind, AI, is where the judgement lives: it looks at a picture or investigates with tools, and returns a typed decision the flow branches on. Site rules, kept in one place, make every AI step accurate for this site. People and plain rules move things; AI informs and recommends. Everything runs on the box.
1. Why this shape
Before designing, we studied eleven products: automation builders (n8n, Dify), no-code agent builders (Zapier Agents, Lindy, Relevance AI, Microsoft Copilot Studio), developer frameworks (OpenAI AgentKit, LangGraph and Anthropic's "Building effective agents"), voice-agent platforms (Retell, Vapi), and the camera platforms we compete with (Coram AI, Spot AI, plus what Frigate and Home Assistant users build by hand).
They have converged on one shape, and the design follows it:
2. The product
Workflows is a new item in the left pane, in the pinned NVR group after Cameras. A workflow has one trigger, then steps, then outcomes. AI, If, Ask a person and Call split the flow into one path per outcome. Paths never loop back. An Always section runs after whichever path ran.
unsureStates. Off, Test (everything runs, actions are recorded as "would have"), On. New workflows start in Test. A workflow whose step lost its provider shows Needs attention and stops.
Limits on every workflow, with defaults: cooldown 1 minute per camera, one run at a time per camera (or per plate or track), 30 runs an hour, 60 AI calls an hour, chain depth 3. Repeat triggers while a run waits for a person join it as "seen again".
Three ways to author. Add steps in the visual builder (a vertical flow of cards with a side panel for the selected step; decisions fan out into one lane per outcome); write YAML; or type a sentence and let the camera agent draft the steps for review. Templates are YAML files in the repository with prerequisites the editor checks.
3. The AI step
One step, two modes, one output shape.
Look
{plate},{camera}and other values from earlier steps.Investigate
Output, in both modes
unsure, which always has its own path.{colour}.If the model is down, slow or over budget, the step answers
unsureand the run continues. An AI step never crashes a workflow.4. Tools
Tools are what Investigate can do. They are the camera agent's existing tools plus a few from core, each with a description written for a model and a mode set by site policy. Installing an app or model that declares tools adds them.
camera_snapshot,describe_cameradescribe_event,describe_windowdetect_objectsrecent_events,recent_platesrecognize_facessearch_footage,search_historysite_lookupcamera_healthask_personnotify,alertsave_clip,ptz_presetspeak,callopen_gate,unlock,set_site_mode,sirenModes are a site policy: an admin sets each tool to auto, ask or not available once, on the Site rules page. A workflow may make a tool stricter for one step but never looser. An app action declared with
confirm=Truearrives as "not available to AI" and can only be placed as an Action after an Ask a person or an If on the same path.5. A worked example
Night intrusion triage, as the builder shows it:
The same workflow as YAML:
A run of it, as the Runs view shows it:
describe_camerasite_lookup: staff hoursrecent_eventssearch_footageEach run can be marked right or wrong, and the marks become the AI step's accuracy score.
6. Templates
Six ship with the feature, two more in phase 3. Each is named after its pattern and lists what it needs.
7. Accuracy and safety
Accuracy
Safety
workflows.approve); acknowledge-all cannot clear them; no answer means the step's default, deny unless changed.Permissions:
workflows.view(admin, operator, viewer),workflows.manage(admin, operator; workflows that neither move things nor read face or plate data),workflows.approve(admin, operator), and admin for Site rules, the tool policy and turning On anything that moves things or reads face or plate data.8. Architecture
app/src/views/Workflows*.tsxNAV_GROUPS; list, builder (Steps and YAML tabs), Runs, Versions, Site rules; approval card inAlertsIncidents.tsx. New deps: CodeMirror 6 with YAML, theyamlpackage; Vitest for tests.server/workflows/registry.py(steps and tools from core, app manifests and model tasks),schema.py,validator.py(the safety rule, caps,needs),engine.py(NATS queue-group consumer, runs persisted step by step, waits as due-time rows, limits, chain depth); routersworkflows.py,approvals.py,site_rules.py.opennvr_app_sdk/agent/opennvr.alerts.workflow.*, so the inbox, siren, alarm actions and notifier apply. App actions through a new internal route that audits workflow, version and owner.How a run works
opennvr.alerts.>, the contractedopennvr.events.>subjects, Tier-0 tracks for zone triggers, and core's camera connection events. Schedules are due-time rows.Tables:
workflows,workflow_versions,workflow_runs,workflow_run_steps,workflow_tool_calls,workflow_approvals,site_rules.Endpoints under
/api/v1:GET workflows/registry,GET workflows/schema,GET|POST workflows,PUT workflows/{id},POST workflows/{id}/state,POST workflows/{id}/try,GET workflows/{id}/runs,POST workflows/runs/{id}/mark,POST workflows/draft,GET|POST approvals,GET|PUT site-rules,POST internal/apps/{id}/actions/{name}.9. Implementation plan
Three phases, each shippable. Estimates assume one backend engineer, one frontend engineer, and the camera-agent owner for the SDK agent library.
Phase 1, about 9 weeks: Workflows and Look
emits,actions, published events) and model tasks; YAML schema; validator with the safety rule, caps,needs, located errors.site_lookupreadable by Look as input.Done when a site owner installs Gate concierge from the template, tries the Look step on ten recent gate events, runs it in Test for a day, turns it On, and an operator lets a delivery in from the inbox, with every step visible in Runs.
Phase 2, about 7 weeks: Investigate
opennvr_app_sdk.agent: tool registry with model-facing descriptions, traces, limits, typed results; the camera agent switches to it.site_lookup,camera_healthwith ping,ask_personon the approvals record.Done when Night intrusion triage reaches 80% marked accuracy over 20 Test runs on a real site, every run shows its tool calls, and an agent over budget returns
unsurewithout an error.Phase 3, about 8 weeks: Voice and reach
speakaction; talk-down and resident call-back templates.fields;workflows validateandapplyin the SDK command line.Done when the resident call-back runs end to end on a test line, its transcript is on the run, and a third-party app's tools appear in the Investigate panel with no change to OpenNVR.
Testing
unsureon timeout, error and budget; tool policy cannot be loosened by a step.10. Decisions made
11. Out of scope for version 1
12. What we would like reviewed
If you have a workflow you build by hand today, in Home Assistant, Node-RED or a script, please paste it. The templates list should come from real sites.
All reactions