Download PDF · Cloudnix: Agentic Workflows
Agents that plan, call tools and write are easy to demonstrate and hard to run. In production they drift, loop, invent facts and links, overrun budgets and leave no record anyone can audit. This report describes the patterns behind agentic systems we operate: an editorial pipeline in which agents brief, write, review, illustrate and publish under supervision; map-reduce generation pipelines that produce knowledge graphs, component maps, requirements and test cases from whole knowledge bases; and schema-constrained extraction confirmed by people. The common thread is supervision: stages with bounded retries, a different model provider checking each draft, a shared rulebook and verified facts, budgets in time and tokens, and a person at the gate.
| Failure | Symptom | Pattern (chapter) |
|---|---|---|
| Drift | Quality degrades over long runs | Stage pipeline with bounded retries (3) |
| Self-confirmation | A model approves its own mistakes | Cross-provider maker–checker (4) |
| Hallucinated claims | Invented features, figures and links | Rulebook, verified facts, link checks (5) |
| Context limits | Knowledge bases larger than any prompt | Map-reduce generation (6) |
| Unusable output | Free text breaks integrations | Schema-constrained extraction (7) |
| Runaway cost and latency | Callers time out; bills surprise | Budgets and usage logs (8) |
Each stage is a job with its own entry criteria. A run of the scheduler takes the first job that has work: a draft to fix, an idea sent back, or a new idea. The checker may approve, ask for revision or reject. Revision loops are capped at three rounds per run; an article that fails three runs returns to the idea stage for a new brief; an idea that fails after two new briefs is flagged for a person. Every article records its stage, the reason it is there and its history, so a board can show what is happening and why.
One job runs every three hours; publishing of approved work runs every five minutes. Long, unattended loops are not possible by construction.
Models share their own blind spots. The provider that writes is never the provider that reviews; the two swap roles each run. Roles are explicit per provider: maker (writes briefs and drafts), checker (scores against the rulebook) and a small model for image plans and photo selection. Over the period measured, 591 model calls were logged, 341 on one provider and 250 on the other [1, 2].
| Role | Task | Model class |
|---|---|---|
| Maker | briefs, outlines, drafts | large model |
| Checker | review against rules; approve, revise, reject with notes | large model, other provider |
| Small | image plans, photo choice | small model |
Every agent reads the same configuration: a rulebook (83 rules, edited by the editorial team), a verified feature list that bounds what may be claimed, a calendar, writer personas and a library of real screenshots. Prompts include only the feature areas, help articles and screenshots nearest the brief; the shared part of the prompt is cached [3]. After generation, every link is checked against real pages and removed if it is not one.
Generating a knowledge graph, a component map, requirements or test cases requires reading far more than one prompt holds. Marker fields on a request route it to one of five pipelines; each maps over retrieved chunks on local models, caching per chunk, then reduces on the provider the project chose (its own key, or ours).
map: for chunk in retrieve(project, scope): notes[chunk] = cache or local_model(prompt_map, chunk)
reduce: result = provider.generate(prompt_reduce, notes) # JSON, repaired if needed
budget: all attempts share 280 s; no new call with < 10 s left; 2 retries on 408/429/5xxPseudocode.
The budget keeps the whole request inside the caller's own timeout: one attempt may use all remaining time so long answers finish, and when too little remains the request ends with a clear error instead of overrunning.
When output crosses into another system it must be structured. Import mapping asks a model to map source columns to destinations under a strict JSON Schema [4] with an enumerated set of ten display types and exactly one title; a person confirms or edits the result; the confirmed map is saved and reused by scheduled syncs without calling the model again.
{ "mappings": [ { "source_field": string,
"destination": "TITLE" | field_id | "NEW" | "SKIP",
"display_type": enum(10) } ] } additionalProperties: falseExample exchange or schema.
| Risk | Control |
|---|---|
| Prompt injection via retrieved content | Content treated as data; outputs checked before they act [5] |
| Unverified claims | Verified fact list; reviewer model; editor approval |
| Unsafe links | Links checked against real pages |
| Key exposure | Keys in server-side configuration with restricted permissions; masked in logs |
| Runaway spend | Budgets, round limits, usage logs |
The approach aligns with the governance functions of the NIST AI Risk Management Framework [6]: map, measure, manage and govern.
Treating “the agent” as one entity hides where things go wrong. We separate roles, each with its own prompt, model class, inputs, outputs and failure handling.
| Role | Input | Output | On failure |
|---|---|---|---|
| Ideator | sources list, calendar, verified features | brief and outline (JSON) | new brief; flagged after two attempts |
| Writer (maker) | brief, persona, rulebook, nearest context | structured article blocks | revision with checker notes |
| Checker | draft, rulebook, verified features | approve / revise / reject with notes | reject returns to ideation |
| Image planner (small) | approved text | image plan per section | text-only fallback |
| Photo selector (small) | image plan, licensed photo search | chosen photos with credits | illustration instead of photo |
| Publisher | approved article | post with category, tags, author, media | retried on the next five-minute run |
Image planning and photo choice are short, frequent decisions. Running them on small models reduces cost without touching the quality of the writing, which stays on large models.
Every unit of work is a record with a stage, the reason it is in that stage and an append-only history. This is what makes a pipeline inspectable: the board is simply a view of these records.
article = { slug, stage: idea | writing | review | approval | published | stuck,
stage_note: "why it is here", persona, brief, draft_ref,
history: [ { at, from, to, by: agent | person, note } ],
usage: [ { call_id, provider, model, role, tokens_in, tokens_out, images } ] }Example exchange or schema.
Each scheduler run takes one job and holds a lock on the article list, so two runs never edit the same article. The review page writes decisions to a separate file that the publisher applies, so a person's action and an agent's action never collide.
Writer personas define tone, habits, topics and a photo description. Personas never claim invented personal facts; the rulebook enforces this.
| Check | Where | Effect |
|---|---|---|
| Rulebook compliance | checker model | revise or reject with notes |
| Claims against verified features | checker model | unsupported claims removed |
| Link validity | deterministic check | non-pages removed |
| Image suitability | small model + rules | off-topic or non-local images replaced |
| Title style | rulebook | no colon titles, no title case clichés |
| Human approval | editor on the board | publish, back to writing, back to idea |
Useful measures: share of drafts approved in the first round, average review rounds, ideas re-briefed, articles stuck, tokens per published article and time from idea to publication. Each is computed from the history and usage records without extra instrumentation.
| Pipeline | Marker | Output |
|---|---|---|
| Knowledge graph | group type | topics and relations across the project's knowledge base |
| Components | component type | one level of modules, sub-modules or features |
| Requirements | generation type | features, each with child requirements, from selected documents |
| Test cases | generation type | test cases for given requirements, keeping test-data variables |
| Image to markdown | extraction type | semantic markdown from one image |
A content programme for a commerce platform, run by agents with an editor at the gate.
The engine produces illustrated articles in the voices of a small set of writer personas. Each article moves through idea, writing, review, approval and publishing; images mix generated illustrations, licensed photos with credits, diagrams and real screenshots, with the lead image rotating between seven kinds. At the time of writing the board held 23 ideas, 9 articles awaiting approval and 8 published.
Content is produced continuously without the editor drafting; the editor's time goes into approvals and rules rather than first drafts; and every claim is bounded by the verified list.
| 1 | Is every agent job a stage with an exit? |
| 2 | Are retries capped? |
| 3 | Does a different provider review? |
| 4 | Is there one rulebook for maker and checker? |
| 5 | Are claims bounded by a verified list? |
| 6 | Are links validated? |
| 7 | Is structured output enforced by schema? |
| 8 | Does a person confirm new mappings? |
| 9 | Is confirmed work reused instead of regenerated? |
| 10 | Does every request have a time budget? |
| 11 | Is every call logged with tokens? |
| 12 | Are costs attributed per output? |
| 13 | Is anything published without approval? |
| 14 | Can a failing idea reach a person automatically? |
| 15 | Who owns the rules? |
The table follows one article through a real-shaped run. Token counts are illustrative; the sequence, roles and limits are those of the production pipeline.
| # | Step | Actor | Result | Recorded |
|---|---|---|---|---|
| 1 | Pick job | scheduler | oldest ready idea | lock taken |
| 2 | Load context | system | rulebook, persona, nearest feature areas and screenshots | prefix cache hit |
| 3 | Draft | maker, provider A | typed blocks, ~1,200 words | tokens in/out |
| 4 | Review | checker, provider B | revise: two notes (unsupported claim, title style) | notes saved |
| 5 | Redraft | maker, provider A | notes applied | tokens |
| 6 | Review | checker, provider B | approve | stage → approval |
| 7 | Images | small model | plan: hero infographic, two in-body photos, one diagram | images |
| 8 | Links | deterministic | one link removed (not a real page) | change logged |
| 9 | Approval | editor | publish | decision file |
| 10 | Publish | publisher (5-min job) | post with category, tags, author, featured image | published list |
A rulebook is code for language models: it should be specific, testable and owned. Rules that worked best were concrete and checkable.
| Weak rule | Strong rule |
|---|---|
| Write engagingly | 600–900 words; one idea per paragraph; no more than one list per article |
| Be accurate | Mention only features in the verified list; never quote prices or numbers not in it |
| Good titles | No colons; sentence case; no “The ultimate guide” |
| Use relevant images | Hero must match the topic; photos must show the target region; no text in generated images |
| Sound human | Write in the persona’s voice; never invent personal facts for a persona |
Every editor note that recurs becomes a rule; a previous version of the rulebook is kept so changes can be reviewed.
| Failure | Detection | Response |
|---|---|---|
| Provider timeout or 5xx | HTTP status | retry within budget; otherwise leave job for next run |
| Rate limit (429) | HTTP status | back off; retry within budget |
| Invalid structured output | schema validation | JSON repair; else retry once |
| Checker rejects | decision | new brief; flag after two |
| Image fetch fails | status / licence check | fall back to illustration |
| Publish fails | CMS response | retried on next five-minute run |
| Run crashes mid-job | lock age | lock released; job resumes from last saved stage |
Cost per output = Σ over calls (tokens in × input price + tokens out × output price) + images × image price. Three levers matter most: caching the shared prefix (largest input saving), keeping review rounds low (each round adds a maker and a checker call) and using small models for small decisions.
cost(article) = Σ_calls ( in_tokens·p_in(model) + out_tokens·p_out(model) ) + images·p_img rounds_effect ≈ (rounds − 1) × (cost(draft) + cost(review))
Example exchange or schema.
Usage records make each term observable per article, per provider and per role.
| Function | Practice |
|---|---|
| Govern | named owners for rulebook, facts and approvals |
| Map | stages, roles and their risks documented |
| Measure | first-round approval, rounds, stuck items, cost per output |
| Manage | budgets, limits, human approval, rollback of published items |
| Phase | Outcome | Activities |
|---|---|---|
| 1. Discovery | Work broken into stages | map the process; define roles, outputs, approvals and limits |
| 2. Grounding | Rules and facts in one place | write the rulebook; compile verified facts; collect references |
| 3. Pilot | One pipeline live with a person at the gate | maker and checker on two providers; usage logging; a review board |
| 4. Scale | More pipelines, measured | budgets, dashboards of rounds and cost, scheduled runs |
| Maker–checker | One party produces, a different one reviews. |
| Rulebook | Rules every agent follows, owned by people. |
| Verified facts | The only claims an agent may make. |
| Map-reduce | Process parts separately, then combine. |
| Budget | A hard limit on time, rounds or tokens. |
| Document control | |||
|---|---|---|---|
| Report | CNX-TR-2026-05 | Version | 1.1 |
| Issued | November 2026 | Status | Published |
| File | cloudnix-agentic-workflows-v1.1.pdf | ||