BM
Bashar ModallalSOFTWARE · AI · SYSTEMS
← All field notes

AI

AI Workflows or Autonomous Agents? Choosing the Right Architecture

A practical guide to choosing a fixed AI workflow, a bounded autonomous agent, or a hybrid architecture using uncertainty, risk, observable results and concrete examples.

Workflow stages and a bounded AI agent meet at a human decision point

AI Workflows or Autonomous Agents? Choosing the Right Architecture

Estimated reading time: 9 minutes

Also available in Arabic.

A team automates a support process. One proposal is a fixed sequence: classify the request, retrieve the relevant policy, draft an answer, and validate the result. Another proposal gives an AI agent a goal, tools, and permission to decide what to do next. Both can work. The engineering question is not whether agents are more advanced. It is whether the task benefits from letting a model choose actions during execution.

A workflow encodes the control path in application code. The model may interpret a step, but the surrounding program determines what happens next. An agent uses a model-driven loop: observe the task and environment, select an action, inspect the result, and continue until a stop condition is reached. Between them lies a useful hybrid: a workflow owns the important boundaries while an agent handles a small, genuinely uncertain section.

This distinction matters because each additional autonomous decision creates another place where the system can make an incorrect choice. Conversely, a rigid sequence can fail when the task has unpredictable branches. Architecture should follow the shape of uncertainty, the cost of mistakes, and the evidence available to decide whether a step succeeded.

The control path is the decision

A workflow can be pictured as a graph whose transitions are chosen in advance. A model may fill a field or summarize evidence, but a program decides which node runs next. In an agent, the model selects among tools in response to observations. The environment’s result then becomes the next input.

flowchart LR
  I["Request"] --> W["Fixed workflow"]
  I --> A["Bounded agent loop"]
  W --> G["Program checks"]
  A --> O["Observe tool result"]
  O --> D["Choose next action"]
  D --> S["Stop or continue"]
  G --> H["Human or policy gate"]
  S --> H

The diagram shows two paths from the same request. The workflow advances through predefined steps and checks; the agent repeats observe–decide–act until it reaches a stop condition. Both can end at a human or policy gate. The distinction is who selects the next control transition, not whether a model appears somewhere in the system.

Anthropic describes prompt chaining, routing, parallelization, evaluator–optimizer patterns, and agents as different ways to arrange model calls. Its practical guidance is to start with the simplest pattern that meets the task. OpenAI’s agent guide likewise recommends expanding a capable single-agent design before adding multi-agent orchestration, because extra agents add coordination, testing, and maintenance work. These are architectural heuristics, not universal performance guarantees.

When a workflow is the better default

Choose a workflow when the task has a stable sequence, its branches can be expressed as rules, and important outcomes can be checked with deterministic code. Examples include producing a report from a known schema, translating an approved document, or processing a transaction that must pass the same controls every time.

A workflow makes control visible. A payment task might validate an account, calculate an amount, request approval above a threshold, and then send a payment through a narrow API. The model can extract a vendor name from a document, but code can verify that the account exists and reject a negative amount. The path is auditable because the program owns the transitions.

A fixed path also makes retries easier to reason about. If document extraction fails, retry extraction. If the policy check fails, stop or route to a human. A retry does not need to ask a model to reconstruct which irreversible action may already have happened. Store state and operation identifiers so the program can tell whether a step completed before attempting it again.

Workflows do not eliminate model errors. A model can still misclassify a request or extract the wrong date. They do, however, give the application a natural place to validate outputs, constrain tool arguments, record provenance, and prevent the model from skipping a mandatory check. Where the task’s next step is known, encoding it directly is usually clearer than asking a model to rediscover it each run.

When an agent earns its extra freedom

An agent is useful when the number or order of actions cannot be specified reliably in advance. A troubleshooting assistant may need to inspect a log, query a deployment API, compare a configuration, and choose a different diagnostic based on each result. The correct next action depends on observations that do not exist until the system runs.

The ReAct research pattern interleaves reasoning and actions so that an agent can gather information and update its plan from observations. In production systems, the important part is the feedback loop: a tool call returns ground truth from the environment. The model should not mark a deployment fixed because it generated a plausible explanation; it should inspect the deployment state after taking an action.

Give that loop explicit boundaries. Define allowed tools, data scopes, maximum steps, time and spend limits, and an exit condition. Separate reversible actions from changes that affect users or external systems. A read-only diagnostic may proceed automatically; deleting data, changing access, sending money, or publishing a statement may require a human check. The NIST AI Risk Management Framework highlights the need to define human roles and responsibilities across different human–AI configurations. That is an operational design input, not a checkbox at the end.

A practical selection test

Before choosing an architecture, answer four questions:

  1. Can the next step be specified before the run? If yes, prefer a workflow for that part.
  2. Does the system need new observations to choose what to do next? If yes, a bounded agent loop may help.
  3. Can success be checked independently? If not, add observable outcome checks or keep a human in the loop.
  4. What happens if the model is wrong or stops? The answer should include a safe stopping state and a recovery path.

These questions often produce a hybrid. The system can use deterministic code for authentication, policy, state transitions, and irreversible actions, while a model handles ambiguous classification or proposes the next diagnostic. The application then validates the proposal before execution.

Worked example 1: invoice intake

Suppose a finance team receives invoices as PDFs. The task is to capture vendor, invoice number, currency, due date, and line items, then create a draft payable record.

A fixed workflow fits if every invoice follows a known process. The model extracts fields; a schema validator checks types; a vendor service confirms the supplier; code compares the total with the sum of line items; a human approves exceptions. If the vendor is unknown or the totals disagree, the record is held. The model never gets a direct “pay” capability.

For example, an invoice says “Total: AED 1,260” while three lines sum to AED 1,200 before tax. The program compares extracted and calculated values, detects a 60-dirham difference, and returns the record for review. The model may explain the discrepancy, but it cannot waive the check. If a second invoice arrives with a familiar layout and matching total, the same path creates a draft record and stops before payment. Inputs, checks, and outcome are repeatable.

An agent would add little if there are only a few known exception categories. It may be useful if the intake task must gather missing context from multiple approved systems—for example, locating a purchase order and checking whether a delivery receipt exists. Even then, give it read access to those sources and let deterministic code own the final payable state.

Worked example 2: deployment diagnosis

Now consider a service that reports elevated error rates after a release. The diagnostic path is not fixed: the agent might inspect deployment history, compare error logs, check a dependency, or ask an operator for context. This is a better candidate for a bounded agent.

The agent receives read-only tools first. It sees that errors began shortly after a new release, then compares the affected route with the previous version. It can propose rollback, but a policy gate checks the service tier and requires an operator’s approval before the deployment tool is allowed to change production. After approval, the agent can trigger the permitted action and must read health status again. If health does not recover, it stops and hands over evidence rather than repeating rollback attempts.

A concrete run might start with service name catalog-api, a time window of 20 minutes, and a read-only error-rate query. The result identifies one endpoint with a sharp increase. The agent then requests the release diff and finds a changed timeout. That observation narrows the next query. It still does not prove the timeout caused the incident; the agent records the evidence and requests a human decision before rollback. The example illustrates a control design, not a claim that this diagnostic has been tested in production.

Build a hybrid with explicit boundaries

A reliable hybrid separates the decision surface from the authority surface. The model can recommend an action; application code checks whether it is allowed, validates parameters, and records the result.

A useful implementation has five components:

  • State store: current task, completed steps, operation IDs, and evidence references.
  • Tool gateway: a small allowlist with typed arguments and scoped credentials.
  • Policy layer: validates permissions, budgets, and approval requirements.
  • Outcome observer: reads the external state after each consequential action.
  • Stop controller: enforces maximum steps, timeouts, and safe handoff.

Do not let natural-language “stop” instructions carry the entire safety burden. Enforce limits in code. If a run reaches eight tool calls, loses access to a required source, or cannot confirm a write, it should return a partial result rather than keep improvising. Idempotency keys and durable checkpoints help retries continue from known state instead of duplicating side effects.

Keep logs useful but restrained. Record the selected tool, validated arguments, result status, policy decision, and a reference to evidence. Avoid storing secrets or unnecessarily copying private records into model context. The agent should receive the minimum information needed for its current decision, and a human reviewer should be able to understand why an action was proposed.

Evaluate the architecture, not its novelty

A prototype that completes a few demonstrations does not establish that an agent is the right production design. Build a representative evaluation set with ordinary cases, ambiguous cases, missing data, tool failures, denied permissions, and tasks that should stop. Measure task completion and also unwanted side effects, policy violations, recovery behavior, latency, and cost.

For a workflow, test every branch and its invariants: can a failed validation ever reach a payment step? For an agent, test action selection under altered observations: does a timeout lead to a bounded retry, and does an untrusted tool result override the system’s policy? Compare architectures on the same task set and keep the evaluation grounded in observable outcomes. A multi-agent design should justify its handoffs with a measurable need, such as independent parallel work or a specialization that improves a defined outcome.

The right architecture is often mixed and may change as the task becomes better understood. Start with a workflow for known, high-consequence steps. Add a bounded agent where new evidence genuinely determines the next useful action. Preserve deterministic checks around permissions and external effects. This keeps flexibility where it helps and predictable control where it matters.

References

  1. Anthropic, Building effective AI agents
  2. OpenAI, A practical guide to building AI agents
  3. OpenAI Agents SDK, Running agents
  4. Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models
  5. NIST AI RMF, Appendix C: Human–AI Interaction

YOUR TAKE

What did you think?

Choose one reaction for this article.

Was this useful?

A cookie helps limit repeat responses. Your feedback is private.

Share this noteLinkedIn ↗X ↗Email ↗

Keep exploring.