TecnoStack
Start a projectالعربية
An agent loop sits inside a Limits frame, with one exit route that stops before a person labelled Hand-over.
AI engineering

Most business tasks do not need an AI agent that picks its own next step. Use this playbook to decide when that autonomy pays, how to limit it with tool permissions and human approval, and which results to measure before you widen access.

In this article

Silent video with on-screen text. The transcript below repeats every screen and describes what it shows.

Watch on the video page

  1. 0:00–0:06

    Supplier A • Known steps stay fixed • Invoice matching • Code decides the path

    The “Supplier A” badge stays fixed in its lane. Four blank steps appear one after another along a straight path, joined by straight arrows; a marker then runs the whole fixed route from the first step to the last. “Invoice matching” names the task, and “Code decides the path” appears under the route.

  2. 0:06–0:12

    Supplier A • Some paths depend on findings • Emails, ERP records, bank replies • Next step unknown • Payment failures • Bounded agent

    The lower row of the article’s workflow-or-agent figure enters: “Payment failures”, a branching path of blank steps inside a thin boundary, and “Bounded agent”. A cyan trace follows the chosen route one step at a time and outlines each step it reaches; it stops at the last step, still inside the boundary. A dashed bracket joins that step’s two open options and “Next step unknown” appears beside them. “Emails, ERP records, bank replies” names where the findings come from.

  3. 0:12–0:18

    Supplier A • Set limits before the loop • Steps, time, spend • Hand over when unsure

    A marker circles a loop of three blank steps. A royal-blue boundary then closes around the loop with “Steps, time, spend” on its top edge. The marker leaves through the one gap along a hand-over route that stops before a faceless person outline, and “Hand over when unsure” appears beside the person.

  4. 0:18–0:24

    Supplier A • Actions wait for approval • Permissions outside the model • Preview before approving • Action • Approval with preview

    An agent step and the “Action” lane from the article’s figure of tools sorted by effect appear, with a closed gate labelled “Approval with preview”. A highlight runs along the Action lane from the agent and stops at the arrowhead before the gate; nothing crosses it, and a dashed outline marks the gate as waiting. “Permissions outside the model” sits under the title and “Preview before approving” near the gate.

  5. 0:24–0:30

    Supplier A • End with a findings report • Owner review pending • No money moves

    A blank report sheet with no text and no mark slides towards an owner panel and stops before it. The panel’s dashed edge keeps moving slowly: the review is pending. “Owner review pending” sits in the panel, and the scene also states “No money moves”.

AI agents for business make sense when nobody can map a task's steps in advance. Elsewhere, a fixed workflow, where your code calls a model at known points, is cheaper to test and easier to approve. If you choose an agent, bound it: a few tools, human approval for actions that change data or spend money, and a measurable outcome.

This playbook walks through that decision and its guardrails. If you are still deciding which process to automate at all, start with picking the first workflow for an internal assistant or browse our AI automation use cases for Saudi SMEs, which come with approval steps built in.

An AI workflow follows a path your code defines; an AI agent chooses its own next step. Anthropic's engineering guide to building effective agents draws the line this way: workflows are "systems where LLMs and tools are orchestrated through predefined code paths", while agents are systems where models "dynamically direct their own processes and tool usage". The same guide recommends the simplest solution that works, adding complexity only when you need it.

In practice you climb a ladder. Each rung adds cost, response time, test cases and new ways to fail:

OptionWho decides the next stepGood fitWhat you must test
Single model callYour screen or formDrafting, classifying, summarising one itemOutput quality on sample inputs
Fixed workflowYour codeKnown steps such as invoice matchingEach step, plus the routing rules
Bounded agentThe model, within your limitsInvestigation across several systemsTool choice, stop conditions, hand-over
Several agentsAn orchestrating modelLarge tasks that split into independent partsAll of the above, plus coordination

Our rule at TecnoStack is to move up one rung only when you can show the lower rung failing on real cases. A higher rung that sounds more capable is no reason on its own.

Invoice matching runs on a straight fixed workflow, while Payment failures follows a branching path labelled Bounded agent inside a boundary.

Illustrative accounts-payable example from this article: matching an invoice follows known steps, so a fixed workflow fits. Finding why one supplier’s payments keep failing depends on what each step finds, which suits a bounded agent that reports to a person.

A task needs an agent only when its path depends on what each step finds and a person can still judge the result. Ask these four questions about the process in front of you:

  1. Can you write the steps down in advance? If a flowchart covers most cases, build the flowchart and use the model for judgement inside its steps.
  2. Does the next step depend on what the last one found? When each finding decides the next lookup, a fixed path breaks down. That is agent territory.
  3. What does a wrong action cost, and can you undo it? A search result or a draft gives a person the chance to catch a mistake. A payment, a customer message or an access change does not.
  4. Can someone judge whether the result was right? If nobody can define success, you cannot evaluate the agent, so do not deploy it.

An illustrative example from accounts payable shows the difference. Matching a supplier invoice to a purchase order and a goods receipt follows known steps: a workflow where the model extracts fields and code does the matching. Working out why one supplier's payments keep failing, across emails, ERP records and bank responses, has no fixed path. That second task suits a bounded agent, as long as it ends with a findings report for a person and never moves money.

The workflow version gives you a baseline, a test set and a map of where the fixed path fails. Build it even when you expect to need an agent. If the failures cluster where code cannot predict the next step, add an agent loop to that step only and keep the rest deterministic.

Set stop conditions for each agent loop before it runs. Anthropic's guide suggests stopping conditions such as a maximum number of iterations, checkpoints where the agent pauses for human feedback, and extensive testing in a sandbox. We turn that into three rules per task:

  • Limits: a maximum number of steps, a time limit and a spending limit.
  • A hand-over outcome: when the agent is stuck or unsure, it stops and passes a summary to a named person instead of retrying.
  • A narrow goal: "produce a findings report for this supplier", never "fix supplier payments".

Any tool call that sends, pays, deletes, changes access or commits a record needs explicit human approval with a preview of its effect. The tool list is the agent's job description, so sort each tool by what it can change:

Tool typeExamplesApproval rule
ReadSearch, look up an order, summarise a threadRuns without a prompt, under the requesting user's permissions or a service identity scoped to the task
DraftPrepare an email, a ticket update or a payment proposalSaved for review; nothing leaves the system
ActionSend, pay, delete, change access, commit a recordA person approves each call after seeing its effect; if you cannot show a preview, leave the tool out

Two further rules close the common gaps. First, check permissions in the system that executes the action, never by asking the model whether an action is allowed. OWASP's entry on excessive agency in its 2025 Top 10 for LLM applications recommends this, together with keeping tools and their permissions to the minimum the task needs and requiring a person to approve high-impact actions. Second, treat everything a tool returns, such as emails, web pages and documents, as untrusted data. It can inform the agent. It can never approve an action or rewrite the agent's instructions.

Record every approval: who approved what, and when. If you connect tools through the Model Context Protocol (MCP), the same rules apply. Its current specification (version 2026-07-28, as of October 2026) asks hosts to obtain explicit user consent before invoking any tool, and states that the protocol cannot enforce these principles itself. Your application has to.

Three tool lanes from one agent: Read reaches a source, Draft for review ends in a review tray, and Action stops at a closed Approval with preview gate.

Sort agent tools by what they can change. Reads run under scoped permissions, drafts are saved for review, and every action waits at a closed gate until a person has seen its effect. Permissions are checked in the system that executes the action, not by the model.

Where do NIST and OWASP guidance fit?

NIST and OWASP give you vocabulary and checklists for agent risk; neither makes a system safe by itself. NIST released its Generative AI Profile (NIST AI 600-1) in July 2024 as a companion to the AI Risk Management Framework, which is voluntary. As of October 2026, NIST says AI RMF 1.0 is being revised. OWASP published a separate Top 10 for Agentic Applications in December 2025, naming risks such as agent goal hijack, tool misuse, and identity and privilege abuse. Use them to map risks to owners and controls, then keep the approval rules above in place.

An agent is worth scaling when it beats the current process or the workflow baseline on the same tasks, at a cost you accept. Name a business owner and agree these measures before anyone writes code:

  • Accepted outputs: how often a person accepts the result without rework.
  • Time to resolution compared with the baseline.
  • Escalations and incidents, including approvals refused because the proposed action was wrong.
  • Full cost per completed task: model usage, tooling, review time and operations.

Agree in advance which results justify a wider rollout and which mean stopping. Our guide to measuring a copilot pilot shows how to set the baseline and count the total cost.

Before release, run the agent against representative tasks plus three awkward groups: cases where it should hand over, cases with misleading or injected content, and cases at the edge of its permissions. Then release to a small group, review every tool call and approval, and keep a switch that turns off action tools without taking down the whole feature.

Plan for the day something goes wrong. Decide who can pull that switch, how you notify affected users and how you replay the logged tool calls to find the cause. Our article on handling an AI incident after launch covers release gates, monitoring and rollback in detail.

Add a second agent only after one bounded agent has reached its limits on your tasks. Splitting work can help when a task divides into independent parts that run in parallel, but every extra agent adds coordination, cost and new failure modes. Our explainer on when to split work across agents covers how to make that call.

We start with one bounded task that has a named owner, then earn wider access with evidence. Our agent discovery plan starts from 4,000 SAR excluding VAT: one workshop, up to three interviews, a map of one workflow with its tools and permissions, and an evaluation plan with 20 example tasks. Discovery includes a working Arabic and English prototype answering up to 10 FAQs with a menu of up to 5 topics, on a private test link or WhatsApp test number for 30 days. It runs on our test account at no extra cost. You receive a written specification, a running-cost estimate and a build estimate; no live agent is deployed in that plan. A pilot then runs one use case on one channel, tested against 30 scenarios we agree with you. Model and API usage, hosting and subscriptions are separate, and we do not let an agent make high-risk decisions on its own.

Before you approve any agent, check that you can say yes to each of these:

  • The task's path depends on what each step finds, and a workflow has already failed on real cases.
  • Every action tool has an approval step with a preview, and permissions are checked outside the model.
  • The agent has step, time and spending limits and a named person to hand over to.
  • You agreed accepted-output, time, incident and cost measures against a baseline, with AI pilot scale and stop criteria.
  • Someone can switch off action tools in minutes.

If one of your processes passes that list and you want a second opinion on the design, read how our AI agent development work runs, from discovery to a controlled pilot.

The decision questions, approval tiers and measures in this article are TecnoStack's guidance, not requirements set by Anthropic, NIST, OWASP or the MCP project.

Discuss your website, store, app or AI project in Arabic or English. We agree the scope before work starts.

Book a free scoping callCompare services and prices