Dokki Blog logo

AI Agent Workflow: Design, Handoffs & Control

An AI agent workflow is a repeatable sequence of states that lets an agent gather context, create a bounded change, hand work to another actor, obtain approval, execute an action, and verify the result.

The important word is workflow. A useful agent is not just a prompt that produces text. It operates inside a contract: an outcome, allowed context, available tools, explicit state, authority boundaries, failure paths, and evidence that the task actually finished.

The short answer

A reliable AI agent workflow follows seven stages:

  1. frame the outcome and acceptance criteria;

  2. gather permission-scoped context;

  3. draft a bounded artifact or change;

  4. review claims, risk, and evidence;

  5. hand off a compact context envelope;

  6. approve and deliver the consequential action;

  7. verify the destination and record what was learned.

Each stage should have an owner, an artifact, an exit condition, and a safe way to stop. That structure makes the workflow resumable, reviewable, and reusable across agents and sessions.

AI agent workflow state machine from framing and gathering through drafting, review, approval, and delivery with safe failure paths

The workflow is a state machine: each transition requires an artifact and exit condition, while missing evidence, review changes, denied approval, and uncertain delivery follow explicit recovery paths.

Why prompt chains are not enough

A prompt chain connects model calls. An agent workflow connects responsibility and state.

A chain may pass one model response into the next. That is useful for transformations such as extract, classify, summarize, and format. But a production task usually has more requirements:

  • the source may be stale or inaccessible;

  • the agent may lack permission for a resource;

  • a tool call may succeed only partially;

  • another person may need to review the result;

  • an external action may require approval;

  • a retry may duplicate an already completed action;

  • the final destination may not match the tool's response.

The workflow must represent those conditions instead of hiding them inside a long prompt.

The AI agent workflow state machine

A state machine makes progress explicit. The agent cannot silently jump from “researching” to “published,” and a later actor can see where the work stopped.

1. Frame

Framing defines what success means before the agent retrieves anything.

A good frame includes:

  • the desired outcome;

  • the canonical output artifact;

  • constraints and non-goals;

  • the decision owner;

  • the due date or service level;

  • acceptance criteria;

  • actions that require confirmation.

“Research competitors” is not a sufficient frame. “Create a source-backed comparison of five competitors, verified this week, with pricing, permissions, and workflow fit; do not contact vendors; deliver a reviewable table and brief” is much stronger.

2. Gather

The agent retrieves only the context required for the task. Sources should be checked for identity, access, freshness, and authority.

The output of gathering is not a hidden prompt. It is an evidence set that can be inspected:

  • source links or resource IDs;

  • captured facts;

  • timestamps;

  • contradictions;

  • missing information;

  • permission boundaries;

  • confidence notes.

3. Draft

The draft stage creates a bounded change. It may be a document, table update, code patch, issue proposal, email draft, or structured plan.

Bounded work is easier to review than a broad autonomous transformation. The draft should make assumptions visible and keep evidence attached to the claims it supports.

4. Review

Review checks the result against the frame, not merely for fluency.

A reviewer should inspect:

  • whether the requested outcome was addressed;

  • whether important claims have evidence;

  • whether sources are current and authoritative;

  • whether uncertainty is visible;

  • whether the agent exceeded scope;

  • whether downstream actions are reversible;

  • whether the acceptance criteria are actually met.

Review may send the task back to Gather when evidence is weak or back to Draft when the structure is wrong.

5. Approve

Approval authorizes a defined consequence. It should identify the approving actor, the exact artifact, and the permitted action.

Approval is not a vague thumbs-up to “continue.” It might authorize publishing one frozen version to one site, sending one reviewed email to named recipients, or applying one exact change to a staging environment.

6. Deliver

Delivery performs the authorized operation and records a receipt. The agent should know whether the operation is idempotent, how to handle timeouts, and what a partial success looks like.

7. Verify

Verification reads the destination after delivery. It checks the real outcome against the acceptance criteria.

A successful API response is evidence about the request. It is not always proof that the user-visible result is correct. Publishing, for example, still requires checking the public URL, metadata, images, links, sitemap, and rendered layout.

State, artifact, and evidence

Every stage should update three separate things.

State

State answers: where is the task now?

Examples include Framed, Gathering, Draft, Editorial Review, Approved, Delivered, Verified, Blocked, and Superseded.

Artifact

The artifact is the durable object being produced: a canonical document, table row, pull request, design file, ticket, or published snapshot.

The artifact should have a stable identity. Replacing it with a new duplicate during every agent run breaks links, review history, and ownership.

Evidence

Evidence proves why the workflow moved to the next state. It may include source citations, a diff, test output, a confirmation record, a delivery receipt, or a destination readback.

Keeping these three concepts separate prevents status inflation. A tool receipt can support Delivered; only a destination readback can support Verified.

How to design an agent handoff

A handoff should let the next authorized actor continue without reading the previous chat.

The most useful format is a compact context envelope attached to the canonical artifact.

The six-part context envelope

  1. Goal: the outcome, constraints, and acceptance test.

  2. Artifact: the stable resource, version, or change set.

  3. State: what is done, open, blocked, or uncertain.

  4. Evidence: sources, receipts, tests, and relevant dates.

  5. Authority: what the next actor may do and what requires approval.

  6. Next: the next owner, action, and completion condition.

This envelope is much smaller than a transcript, but more useful because it carries operational meaning.

AI agent handoff context envelope containing goal, canonical artifact, state, evidence, authority, and next action

A durable handoff transfers the minimum operational context the next actor needs: goal, artifact, state, evidence, authority, and the next acceptance test.

What not to hand off

Do not rely on:

  • “continue from the conversation”;

  • a raw transcript with no state summary;

  • links to temporary duplicates;

  • hidden assumptions;

  • credentials or sensitive context copied into prose;

  • authority borrowed from another actor;

  • an output with no acceptance test.

Example handoff

A research agent might hand a draft to an editor with this record:

  • Goal: explain AI workspace architecture for B2B teams;

  • Artifact: canonical document resource ID;

  • State: draft complete, three diagrams inserted, pricing excluded as out of scope;

  • Evidence: eight public documentation sources verified today;

  • Authority: editor may revise the document; publishing requires confirmation;

  • Next: verify metadata, internal references, and public rendering.

The editor can start from the work rather than reconstruct the agent's reasoning.

Context should be assembled, not accumulated

Long-lived workflows need continuity, but more context is not automatically better.

A practical context package contains:

  • the current canonical artifact;

  • the frame and acceptance criteria;

  • the latest relevant decisions;

  • permission-scoped evidence;

  • unresolved questions;

  • current workflow state;

  • the next allowed operations.

It should exclude obsolete drafts, unrelated history, duplicated sources, and secrets that the agent does not need.

Reusable context versus memory

Reusable context is task-specific and inspectable. Memory is broader continuity about preferences, conventions, or prior outcomes.

Both can help, but neither should silently override the current frame or grant authority. A remembered preference can shape formatting. It cannot authorize publishing, deleting, spending, or changing access.

Tool contracts for AI agent workflows

Agent tools should behave like dependable workflow components.

A useful contract defines:

  • required inputs;

  • output shape;

  • allowed resource scope;

  • validation rules;

  • idempotency behavior;

  • confirmation requirements;

  • timeout and retry semantics;

  • audit fields;

  • readable failure states.

Read before write

Before editing a shared artifact, the agent should read the current version and use stable node, row, or version identifiers where available. Compare-and-set guards prevent a stale agent from overwriting newer work.

Idempotency

If a write is retried, the system should avoid creating duplicates. An idempotency key, stable resource ID, or destination readback can help distinguish “not sent” from “sent but response lost.”

Confirmation

Consequential operations should return a clear plan or confirmation request before executing. The confirmation must bind to the action and arguments so that a later retry cannot expand the scope.

Failure messages

“Something went wrong” is not operationally useful. A failure should distinguish validation, permission denial, conflict, timeout, partial success, unavailable dependency, and unknown final state.

Recovery: never confuse a retry with proof

The most dangerous retry happens when the agent does not know whether the first action completed.

Suppose an agent publishes an article and the request times out. Repeating the call may create a duplicate, overwrite a newer snapshot, or trigger a second notification.

Use a four-step recovery pattern.

AI agent recovery and verification flow separating action, receipt, destination readback, and proof of success

A request, a receipt, a destination readback, and proof are four different things. Verification closes the gap before the workflow claims completion.

1. Inspect

Read the external destination before writing again. Check whether the resource exists, which version is live, and whether the expected change is already present.

2. Classify

Classify the result:

  • not sent: safe to attempt the original operation;

  • sent: do not repeat; proceed to verification;

  • partial: repair the missing part;

  • unknown: stop or escalate until state can be established.

3. Decide

Choose one bounded action: resume, repair, rollback, or stop. Do not rerun the whole workflow automatically.

4. Verify

After the action, read the destination again and compare it with the acceptance criteria. Store the result as evidence.

Human control in agent workflows

Human control works best at decision boundaries, not as constant supervision.

People should usually retain approval for:

  • external publishing or messaging;

  • permission and membership changes;

  • deletion or irreversible transforms;

  • purchases and billing;

  • production deployments;

  • legal, financial, medical, or reputational commitments;

  • actions with unresolved evidence conflicts.

Agents can often perform reversible preparation without interruption: gathering sources, creating drafts, suggesting table updates, running read-only checks, or preparing a release plan.

The boundary should be explicit in the workflow contract.

Parallel agents without duplicated work

Parallelism can shorten a workflow, but only when tasks have independent inputs and clear merge points.

A coordinator should assign bounded roles such as:

  • source discovery;

  • product documentation review;

  • competitive pricing verification;

  • structure and synthesis;

  • visual explanation;

  • final QA.

Each agent should return a compact result with evidence. The coordinator, not every subtask, owns the canonical artifact and reconciliation.

Avoid parallelizing two agents over the same document section without an ownership rule. That creates conflicts rather than speed.

Example: an agentic SEO publishing workflow

A practical SEO workflow may look like this:

Frame

Define the keyword, search intent, audience, unique answer, target slug, and publication criteria.

Gather

Collect search demand, competing pages, product evidence, public sources, and related canonical resources.

Draft

Write a direct answer, structured sections, FAQ, sources, and metadata. Keep Related Reading as typed resource references rather than internal URLs.

Visualize

Create a banner for distribution and content diagrams that explain the article's actual architecture, flow, or scenario.

Review

Check claims, internal-link targets, body-only formatting, image relevance, alt text, and duplicate resources.

Approve and publish

Freeze the canonical document to an explicit public slug.

Verify

Check the generated title, description, canonical, social image, Related Reading URLs, image loading, responsive layout, and sitemap uniqueness.

This workflow produces more than an article. It produces a traceable publication that can be refreshed without rediscovering its structure.

Metrics that reveal workflow quality

Measure outcomes and repair cost, not just agent activity.

Useful metrics include:

  • time from frame to verified outcome;

  • percentage of tasks completed without manual context reconstruction;

  • review corrections per artifact;

  • percentage of claims with usable evidence;

  • handoff acceptance rate;

  • duplicate or stale resource count;

  • retries caused by unknown external state;

  • percentage of delivered tasks with destination verification;

  • cost per successful, accepted task.

A fast workflow that creates unreviewable output is not efficient. It moves cost into cleanup.

Common failure modes

The agent optimizes for activity

Many tool calls can look productive while the task remains undefined. Fix the frame and acceptance criteria first.

The workflow state lives only in chat

A new participant cannot tell what is current. Store state with the canonical work.

A handoff transfers too much context

Transcript dumps increase noise and can leak sensitive information. Use the context envelope.

Review checks style but not evidence

Fluent prose hides unsupported claims. Review against sources and acceptance criteria.

Approval is detached from the artifact

A generic “go ahead” can be misapplied after the draft changes. Bind approval to the exact resource or version.

Timeouts trigger blind retries

Inspect the destination first, then repair only what is missing.

Delivery is treated as completion

Verify the user-visible destination and save the readback.

A rollout checklist

Start with one workflow

Choose a recurring task with a clear owner, durable output, visible quality criteria, and manageable consequence.

Define states and owners

List every state, who may move the task forward, and which transitions require approval.

Name the canonical artifact

Decide where the durable result lives and how other resources refer to it.

Specify tool contracts

Document required inputs, scope, failure states, idempotency, and confirmation.

Build the context envelope

Make handoff fields mandatory for multi-session or multi-actor work.

Add destination verification

Write a concrete readback for each external action.

Run failure drills

Test stale data, permission denial, concurrent edits, timeouts, partial success, revoked access, and rejected approval.

Expand from evidence

Automate only the stages that repeatedly succeed and remain observable.

Frequently asked questions

What is an AI agent workflow?

An AI agent workflow is a stateful, repeatable process in which an agent uses scoped context and tools to create a durable artifact, pass review and approval gates, perform allowed actions, and verify the outcome.

How is an agent workflow different from automation?

Traditional automation follows predefined rules. An agent workflow can use models for interpretation, planning, retrieval, and drafting, but still needs explicit states, tools, permissions, and controls.

Is an AI agent workflow the same as an agentic workflow?

The terms are often used interchangeably. “Agentic” usually emphasizes that the system can choose or sequence actions. Reliability still depends on bounded authority, observable state, and verification.

What should be included in an AI agent handoff?

Include the goal, canonical artifact, current state, evidence, authority boundary, next owner, next action, and acceptance test.

How many agents should a workflow use?

Use the fewest actors that create a meaningful specialization or latency benefit. Additional agents add coordination, reconciliation, and failure surfaces.

When should an agent ask for human approval?

Before consequential actions such as publishing, sending, deleting, spending, changing permissions, or modifying production systems, and whenever evidence or final state is materially uncertain.

How do you prevent duplicate agent actions?

Use stable identifiers, idempotency keys, compare-and-set updates, explicit state, and destination readback before retrying.

What is the final step of an agent workflow?

Verification. Read the destination, compare it with the acceptance criteria, and record proof that the intended outcome—not merely the tool call—succeeded.

Final model

A reliable AI agent workflow is:

frame → gather → draft → review → hand off → approve → deliver → verify → learn

The agent provides speed and flexible reasoning. The workflow provides continuity, authority, recoverability, and proof.

Sources