Company conference · 50 minutes + discussion

Finding
the flow

Loops, graphs, and more reliable AI agents

What if following the process wasn't up to the agent?

1 / 43

The familiar problem

“Done.”
According to whom?

The agent says it checked the facts.
The check never ran.
The next step happens anyway.

The system needs to enforce the rules described in the prompt.

2 / 43

A process you can point at

The arrows are rules

Draft
Check
Approve

↳ Check fails → revise the draft → check again

Nodes do work. Arrows are permitted transitions.
Guards decide whether an arrow can be taken.

Foundations: W3C state machines · LangGraph Graph API

3 / 43

What moves through the graph

The graph remembers facts

Work

Draft version: B
Order facts: current
Validation: failed

Control

Repair attempts: 1 of 3
Approved version: none
Next step: repair

The controller reads the recorded check result to establish whether the check ran.

4 / 43

The anatomy of one arrow

A transition is a small contract

Transition contractRequired fact or outcome
Before · work identifiedThis draft and this recipient
Before · checks establishedValidation passed for this version
Before · permission establishedA person approved this version
After · action recordedStore delivery outcome; unknown means reconcile

The send service evaluates the guard when it executes the action.

5 / 43

Graph engineering

Put agents inside
established workflows

State machines and workflows already describe steps, conditions, and recovery. Now some of those steps contain an AI agent.

“Graph engineering” covers several approaches. This talk focuses on controlling the workflow around an agent.

Context: LangChain: 3 Years of Graph Engineering · Feng et al., 2026 survey preprint

6 / 43

The grilling sub-loop · conceptual work

Make the goal testable

ready open questions Initial goalwhat is needed? Ask + challengeambiguity, assumptions Human decidesintent + tradeoffs Record contractgoal + non-goalscriteria + evidence Review contractgaps + human approval Begin workapproved outcomes

Goal → questions → human decisions → recorded contract → review. Open questions return to questioning. Resolved gaps and human approval permit execution.

“Improve customer replies” → correct order facts, no unsupported delivery promises, approval before send.

People or agents can lead the questions. People decide intent and tradeoffs.
Proposed conceptual workflow, informed by dev-loops grilling.

7 / 43

Illustrative example · a customer reply

Check and approve
before sending

Order facts
Agent draft
Validate
Person approves
Send

↳ Wrong order detail → repair the draft → validate again

The drafting agent has no direct send permission. The send service checks the approved version.

8 / 43

Customer reply · 1 / 3

Follow the happy path

readypassyesfailrecheckunknownfacts restoredbudget usedDraftagent workValidatefacts + versionApprovepersonSendguarded actionRepairnew versionRecover factsbounded waitHand overperson takes overrepair budget used → hand over

Draft → validate: pass → person approves A → send A.

Recorded state · illustrative
DraftA
Validationpass for A
ApprovalA
Nextsend A

The checks and approval refer to the same piece of work.

9 / 43

Customer reply · 2 / 3

A failed check sends it back

readypassyesfailrecheckunknownfacts restoredbudget usedDraftagent workValidatefacts + versionApprovepersonSendguarded actionRepairnew versionRecover factsbounded waitHand overperson takes overrepair budget used → hand over

Validation fails → repair draft A into B → validate B again.

Recorded state · illustrative
DraftA
Validationwrong order date
Approvalnone
Nextrepair → B

Useful feedback names the mismatch. A new draft starts with no passing evidence.

10 / 43

Customer reply · 3 / 3

Unknown takes another arrow

readypassyesfailrecheckunknownfacts restoredbudget usedDraftagent workValidatefacts + versionApprovepersonSendguarded actionRepairnew versionRecover factsbounded waitHand overperson takes overrepair budget used → hand over

Unknown → recover facts. Restored → validate again. Budget exhausted → person.

Recorded state · illustrative
Order serviceunavailable
Validationunknown
Budget2 waits left
Nextrecover facts

An unavailable service leaves validation unknown. Recover the facts before deciding whether to send.

11 / 43

A developer run · changed acceptance criteria

Changed criteria require
fresh clearance

askv2new evidenceCriteria v1prior clearanceHuman approvalrecorded spec changeCriteria v2old clearance staleReview v2fresh evidence

Criteria v1 → human-authorized change → criteria v2 → old clearance stale → review existing work against v2.

During development · illustrative
Codeunchanged
Criteriav1 → v2
Clearancev1: stale
Nextreview against v2

Acceptance criteria define what the work must satisfy. Developer agents can propose changes; only a human can authorize them.

12 / 43

Fail closed

Advancement requires
evidence.

Check resultWorkflow response
PassAllow the next permitted step
FailRepair or reject
Unknown / check crashedBlock advancement; recover the evidence

A broken check must never silently count as a pass.

Security principle: OWASP: Fail Securely.

13 / 43

Loops need an exit

“Try again” needs a reason

What went wrong?What happens next?
Temporary tool outageWait, then retry within a budget
Bad outputRepair with feedback, then recheck
Send timed outFind out whether it sent before repeating
Attempts exhaustedStop and hand over to a person

After a failed check, repair and recheck against the same requirements.

AWS: limit retries · Making retries safe

14 / 43

Room to think

Define where the agent
can choose

The agent chooses how

Explore, investigate, draft, compare, revise.

The system decides whether

Checks passed? Action allowed? Budget left? Approval current?

A step can contain an agent. When a model selects an arrow, that decision remains a model judgment.

Anthropic: Building effective agents · LangChain: Graph Engineering

15 / 43

Another useful graph shape

Parallel work still needs a join

Evidence bundleone versionFact checkorder detailsPolicy checkpermitted contentRecipient checkright destinationJoin resultsall required present

One version → fact check + policy check + recipient check → join all required results.

“Fan out” starts independent work. “Fan in” gathers the required outcomes before deciding.

16 / 43

The join has its own guard

Two passes and a missing check

Required checkOutcome
FactsPass
PolicyPass
RecipientNo result returned

The join is blocked.

The join requires an accountable outcome for every required check.

17 / 43

A real example · dev-loops

Apply it to AI development

The work is a proposed software change. Its record carries the scope, checks, review findings, and approval.

Scope
Implement
Draft gate
Review / repair
Pre-approval gate

↳ Findings return the change to repair and fresh checks

Simplified lifecycle; the outer router re-reads current state each cycle. Source: dev-loops public contract

18 / 43

dev-loops · the shared record

What does the router know?

Plain-language questionRecorded fieldExample
Which work?targetPull request 42
Who owns it?ownershipCopilot
Who should act now?nextActorReviewer
Where is it?statusActive
Is the action allowed?authorizationAuthorized

Illustrative values; field names come from the public routing contract.

19 / 43

dev-loops · deterministic routing

One state, one next action

Current factsRouter response
Blocked or not authorizedStop
Waiting for an external resultWait / watch
Reviewer should act nextReview / fix route
“Ready” but current approval evidence missingReconcile the evidence
Merge ready but not authorizedWait for merge authorization

Read current facts first. Apply the routing rules in a defined order.

20 / 43

dev-loops · a bounded handoff

Give the worker a job card

What to work on

Target and current step
Required context
One bounded next action

What counts as finished

Acceptance criteria
Required evidence
Stop and permission boundaries

The handoff envelope is derived from resolved state and settings. A fresh worker gets the same task contract.

The envelope guides the worker; separate runtime checks enforce protected actions.

21 / 43

dev-loops · outer control, inner work

A loop can contain another loop

stateallowed routeresultnext cyclemay containObserveread current factsResolvechoose routeBounded actionreview / fix / waitRefreshread resultsReview ↔ repairan inner loop

Observe → resolve → bounded action → refresh → observe. A bounded action may contain a review ↔ repair loop.

The outer loop chooses the next job. Inner loops do that job within their limits.

22 / 43

dev-loops · the review / repair loop

A review round has an output contract

dispatchresultsmissing→ blockedcompletedispositionactno blocking work → eligible for next gatenew revisionCurrent bundlescope + revisionRequired lensesindependent reviewsJoin + validatecoverage + resultsJudgerequired dispositionAct listpolicy + scopeFixonly actionable work

Bundle → required review lenses → validate coverage and results. Missing → blocked. Complete → judge → act list. Actionable work → fix → fresh bundle; no blocking work → eligible for next gate.

Coverage, result validity, and judge disposition are separate checks. Only actionable findings go to the fixer.

23 / 43

The UI design and review sub-loop

How this presentation was built

renderinspectlookfindingsrepair → fresh renderAuthoredits HTMLBrowser rendercurrent versionAutomated checksfit · accessibility · keysVisual reviewermeaning · legibilityFindingsreturn to authorchecks + visual findings addressed → exit evidence

Author edits → browser renders → automated checks and visual review → findings → author repairs → fresh render and checks.

One agent authored the deck. The parent agent reviewed screenshots. The shared browser suite checked fit, accessibility, and navigation.

24 / 43

Actual findings from the first expanded draft

Visual review caught
errors in the graph

Earlier screenshot: the graph highlighted handover even though its state snapshot said two waits remained.
Earlier render · before visual corrections
Hidden edge labelsShorten “draft ready” and “approved”
Wrong active routeKeep handover muted while budget remains
Crossed return lineMove the nested-loop callout off that path

The fit tests passed. Visual review then found errors in what the arrows meant.

25 / 43

Turn the sub-loop into a reusable contract

Exit on evidence for the current render

RuleWhat it controls
Any edit → fresh renderClearance requires screenshots of the current HTML
Checks + visual review completeEvery required result must be present
Actionable finding → author repairRepeat the affected sub-loop, then recheck
Budget exhausted → human decisionA proposed rule for future runs; this run had no configured cap

The outer workflow waits for this result, then refreshes. “Clean” means within the stated checks and review scope.

26 / 43

dev-loops · a failed check changes the route

Each revision needs
current evidence

Observed stateRequired response
Automated tests failRepair and rerun checks
A fix creates a new versionGet pre-approval evidence for that version
Required review evidence unavailableBlock the merge check

The recorded evidence names the exact code revision: the “head SHA.”

Source: sanctioned merge wrapper and its pre-merge checks. Full code map in speaker notes.

27 / 43

dev-loops · external work continues

Waiting survives the conversation

Record the waitwork + revision + reason
External result arrivescheck or review
Refresh and routecurrent state wins

A checkpoint helps the next session reattach and run fresh checks against current state.

Keep waiting while the recorded conditions hold. Reconcile changed or contradictory state.

28 / 43

dev-loops · evidence and authority

Publishing requires
separate authorization

Required evidence
Human approval
Merge authorization
Guarded merge

The supported merge path checks prerequisites and refuses when they are missing.

Documented rules and optional hooks have gaps in their enforcement coverage.

Merge preconditions · Enforcement coverage

29 / 43

dev-loops · the action boundary

The merge checks the actual version

MomentObserved revisionResult
Read candidateACheck its prerequisites
Read gate evidenceB, after a new pushReject the mismatch
Matching evidence for AAPin merge command to A
New push before mergeBVersion-pinned merge refuses

The merge wrapper checks the version again when it acts.

Two illustrative branches through the sanctioned merge wrapper.

30 / 43

People, time and cost · proposed operating choices

People own the decisions

Set the terms

Goals, acceptance criteria, permissions and budgets.
Resolve ambiguity and exceptions. Improve the process.

Make approval usable

Show the proposed action, current evidence, open risks and alternatives.
Name an owner. Offer a reject path.

Approval queues and fatigue can turn review into rubber-stamping. Track human effort and waiting time.

Design recommendation. Pause/resume mechanism: LangGraph interrupts.

31 / 43

Measure a fixed set of tasks

Cost per accepted result

All task-set costs
÷ accepted results

Include the failed attempts

Models, tools, compute, retries and human time.
Account for building and maintaining the workflow.

Keep quality beside cost

Completion rate and defects found after acceptance.
Elapsed time, human minutes and expensive outliers.

Compare the same tasks and acceptance criteria. Report zero completions explicitly.

Proposed scorecard; evaluation basis: Anthropic agent evaluations.

32 / 43

Context has a cost and a purpose

Choose what the next worker needs

ApproachUseful whenCost or risk
Continue the conversationEarlier reasoning still mattersStale and irrelevant material accumulates
Fresh context per taskA bounded task can stand aloneSetup repeats; missing context must be recovered
Scoped handoff + artifactsWork crosses a role or sessionSummaries need care; retrieval takes time

Prompt caching can reuse an identical prefix. Compare uncached input, cache writes, cache reads and output across every worker.

Context engineering · Prompt caching. Fresh context is not automatically cheaper.

33 / 43

Review design

Give each review a clear question

Review shapeTradeoff to test
One general reviewerLess coordination; test whether it catches the relevant defects
Distinct review anglesFocused questions; duplicated reading and correlated mistakes
Grouped anglesShare material; keep each required question accountable

Measure unique valid findings, missed defects, false alarms and human triage time. Deduplicate and resolve disagreements.

Documented example: Claude Code Review. dev-loops supports grouped review angles; task-based evaluation must establish their value.

34 / 43

Choose capability from task evidence

Match capability to the step

WorkCandidate to evaluate
Exact rules and recorded factsOrdinary code
Bounded extraction or classificationA lower-cost model that meets the task's bar
Difficult reasoning or higher riskA stronger model, with the required checks

Include routing mistakes and retries in the bill. A cheap failure plus an expensive retry can exceed a good first attempt.

Research: RouteLLM. dev-loops provides configurable role tiers; no savings estimate is claimed here.

35 / 43

Illustrative agent-facing tool result

Return the facts needed to act

FieldExample result
Status / reasonunknown / order service timed out
Affected itemsReply B · delivery date unchecked
Allowed next actionRecover order facts; send remains blocked
Evidence referencerun-42/check-7 · full log available on demand
CompletenessValidation incomplete · log excerpt truncated

Keep errors, missing results and truncation visible. Give the agent a way to retrieve the underlying evidence.

Design example informed by Anthropic: Writing effective tools. Evaluate the format for the task.

36 / 43

Proposed controller rule · spend, elapsed time, repair rounds

An exhausted budget pauses the work

Limit reachedno next attempt Preserve + pausework, evidence, costs Human decisionrecord authorization Extend budgetresume with fresh checks Change scopere-evaluate clearance Stoprecord incomplete work

Limit reached → preserve work and pause → human decision: extend the budget and recheck, authorize changed scope and re-evaluate clearance, or stop with work incomplete.

A limit cannot weaken acceptance criteria or mark unfinished work complete.

Retry limits: AWS Well-Architected. The spend and human-decision branches are proposed workflow design.

37 / 43

Your turn · two minutes

Which arrow is allowed?

SnapshotWhat should happen?
A · Draft ready; check timed outSend, repair, or recover evidence?
B · Approved A; current draft is BSend or obtain new clearance?
C · All checks pass; publish unauthorizedPublish or wait for authority?

Ask a neighbor: what fact is missing, and who is allowed to supply it?

38 / 43

The guarded routes

A pause can be the correct result

SnapshotAllowed next step
A · Unknown checkRecover evidence within a budget
B · Changed draftValidate and approve the current version
C · Missing authorityWait for an authorized decision

Advance when the required evidence and authority are present.

39 / 43

What this can promise

What do these
checks establish?

With the same validated state and rules, code can choose the same permitted next step.

The agent can still write a wrong answer. A check can miss it. The workflow itself can be wrong.

Passing a gate establishes what it tested. Rigid routes and wrong checks need maintenance.

40 / 43

Make reliability a question you can test

Test the wrong turns

Deliberately introduceObserve
A failed or missing checkDoes advancement stop?
Changed work after approvalDoes stale evidence get rejected?
A timeout after an actionDoes recovery avoid duplicate effects?
The same task, many timesSuccess, escapes, handovers, time, cost

Evaluation approach: Anthropic: Demystifying evals for AI agents.

41 / 43

Finding the flow

Make the next step
depend on evidence.

Draw one real process.
Mark what must be true before it advances.
Add the return paths—and the stops.

Let reliable results depend less on the agent following oh-so-sophisticated prompts.

42 / 43

Appendix · follow the sources

Further down the graph

Graphs and agents

Checks and recovery

Research checked 16 September 2026. Accompanying speaker notes include the full claim-to-source map, cost/context sources and limitations.

43 / 43