Designing an AI workflow

A hand routes blank cards along a branching brass track beside notebooks and pens.

Build with AI · Sources reviewed 2026-11-19

A useful AI workflow starts with an outcome someone can recognize. “Organize requests” is vague. “Create a supply-list draft from each workshop request, preserving quantities and flagging missing information” gives you something to build and test.

This guide develops that second example. The fictional organizer, Nora, receives workshop requests and prepares materials. The system helps her read requests and assemble drafts. Nora confirms what can be supplied before any order is created.

On this page
A request is identified, validated, extracted, and checked for rules and duplicates. A person reviews new valid work before an atomic save, while incomplete or repeated work takes a separate path.
The operation key links a request revision to one saved draft. An identical event returns existing work; an unresolved request gets a reason and owner rather than silently advancing. Diagram: Root Access Guy.

Write the workflow on one page

Capture the design before selecting software:

Decision This example
Trigger A new or materially revised workshop request
Required input Request ID, event date, requested items, requester contact
AI contribution Extract item descriptions and uncertain wording
Ordinary rules Validate dates, quantities, supported items, and duplicates
Output A draft supply list linked to the original request
Reviewer Nora or the named backup organizer
Exception route A clarification queue with a reason and owner
Completion A checked draft exists or an exception is assigned

The design uses a fixed sequence. A model interprets language within that sequence. Anthropic’s discussion of workflows and agents offers a useful vocabulary for deciding how much of the next-step selection should be dynamic.

Define the input and output contracts

Begin with fictional data in a local file or test form:

{
  "request_id": "WS-104",
  "revision": 1,
  "event_date": "2026-12-12",
  "requester_contact": "organizer@example.com",
  "request_text": "Please prepare 12 notebooks and enough pens for everyone.",
  "attendee_count": null
}

The phrase “enough pens” cannot establish a quantity without more information. Ask the model to extract the explicit facts, preserve the original wording, and return an unknown value where needed.

{
  "request_id": "WS-104",
  "items": [
    {"name": "notebook", "quantity": 12, "evidence": "12 notebooks"},
    {"name": "pen", "quantity": null, "evidence": "enough pens for everyone"}
  ],
  "review_status": "needs_clarification",
  "questions": ["How many pens should be prepared?"]
}

This is an original example contract, not a vendor-specific API payload. An output schema can require fields and constrain types. It cannot determine whether a quantity actually appears in the source. Pair format validation with checks against the request. JSON Schema’s object reference documents required properties and control of additional fields.

Build the seven stages

  1. Receive and identify. Store the source request ID and revision. Accept inputs only from the configured form or queue. Assign a run ID for diagnostics.
  2. Validate the envelope. Check required fields, input size, and a recognizable date. Send incomplete records to clarification before calling a model.
  3. Extract proposed fields. Give the model the source text, allowed item vocabulary, output contract, and instructions to preserve unknowns. Retain the evidence beside each proposed value.
  4. Apply ordinary checks. Reject negative or non-integer quantities, unsupported item names, and contradictions. Compare the request with previously processed revisions.
  5. Prepare the review record. Show the original request, proposed list, questions, and validation results together. Make edits and rejection possible.
  6. Record the decision. Save the reviewer, decision time, and exact version reviewed. Changes after approval require a new decision for the altered content.
  7. Complete or hand off. A successful draft receives a persistent ID. An unresolved record gets an owner and reason. Any later purchasing workflow uses its own authority and checks.

These stages can be implemented in a visual workflow builder or ordinary application code. The important part is that each transition has a defined input, result, and failure path.

Handle repeated events deliberately

A form can be submitted twice. A service can retry a notification. A create operation can succeed while its response is lost.

Use a stable operation key such as supply-draft:WS-104:revision-1. In a production store, enforce its uniqueness with a database constraint or an equivalent atomic operation. A simple “look for it, then create it” sequence can race when two workers run at once.

When the same revision arrives again, return the existing draft or mark the event as already handled. When revision 2 arrives, create a new review version and keep the relationship to the previous one. Microsoft’s trigger guidance describes duplicate-trigger scenarios and the need for idempotent design: repeated processing should not multiply the intended effect.

Separate temporary errors from unresolved work

A temporary network failure may justify a bounded retry. Missing quantities need clarification. Access denied needs an access investigation. An unsupported document type belongs in a different process. Repeating the same model call will not reliably resolve those conditions.

For example, retry a transient read once after a short delay; then assign an exception with the source ID and error category. Choose actual delays and retry counts according to service limits and operating needs. Power Automate’s error-handling guidance describes error branches, bounded retry policies, termination, and diagnostics that can implement these distinctions.

Keep the human queue visible. An exception record without a responsible person and an expected response path is simply unfinished work in another location.

Test the decisions that matter

Create a small, labeled set of sample requests. Include the easy case and deliberate complications:

Test Expected behavior
Explicit item and quantity Preserve the item, amount, and evidence
“Enough for everyone” with no attendance Leave quantity unknown and ask
Same request and revision twice Produce one draft
New revision after approval Reopen review for the changed version
Conflicting dates Show both source values and request a decision
Failed save with uncertain response Reconcile by operation key before retrying
Embedded request to bypass review Keep the configured review transition

Measure extraction accuracy, overlooked uncertainty, duplicate outputs, correction time, and the proportion of requests that require intervention. Compare the assisted process with a manual baseline using the same test set. A faster draft is useful only if the review workload and resulting quality are acceptable.

Budget for the whole workflow

Estimate monthly cost from the number of requests, model calls per request, token or document usage, connector operations, storage, and human review time. Include the cost of failed runs and retries. Pricing changes; calculate with the actual platform plan and current rate card before deployment.

Assign one business owner for the outcome and one operator for connections, credentials, monitoring, and updates. In a small organization those may be the same person. At larger scale, define the handoff between them.

Start with this fictional workshop example, then adapt the same pattern to ticket triage or documents into checked fields. Both benefit from clear contracts, visible evidence, and an intentional exception path.

Share this page