Serviciile noastre

Dacă poți să-ți imaginezi, noi putem să-l construim.

What agentic AI workflows are, and where they break

Written By: BrainSoft In AI & Research

Most teams that ask us about agentic AI have already tried a chain of prompts and hit a wall. The chain worked on the demo, then quietly fell apart on real inputs: a tool returned an error, the model looped, or it confidently reported success while doing nothing. The gap between a prompt chain and an agent is exactly where these projects break.

An agentic workflow is one where a language model decides what to do next, calls tools, observes results, and repeats until a stop condition is met. This post covers what that loop actually looks like in code, and the concrete places it fails in production, so you can decide whether you need one.

What separates an agent from a prompt chain

A prompt chain is fixed. You know the steps before you run it: extract fields, call the CRM, format the reply. An agent is a loop with a model choosing the next tool call at runtime. That is the whole difference, and it changes everything about how you test and operate the thing.

The minimal shape is a while loop with a hard cap. The model gets a task and a list of tools, returns a tool call or a final answer, and you feed the result back in:

for step in range(MAX_STEPS):
    out = model.complete(messages, tools=TOOLS)
    if out.final:
        return out.text
    result = run_tool(out.tool_name, out.arguments)
    messages.append({"role": "tool", "content": result})
raise StepLimitExceeded()

That is genuinely it. Everything hard about agentic workflows lives in the details around this loop: what tools you expose, how tool errors come back, how you cap cost, and how you know the run did what it claimed. When it works, it handles inputs you never anticipated. When it fails, it fails in ways a fixed chain never would.

Where agentic workflows break

We have shipped a handful of these now, and the failures cluster. These are the ones that cost real time:

  • Tool errors get swallowed. A 500 from an internal API comes back to the model as a string, and the model decides to retry forever or claim it worked. Return structured errors and make the loop treat them as terminal after N tries.
  • Silent success. The agent says it updated the ticket. It did not. If an action matters, verify it with a read after the write, inside the loop.
  • Context bloat. Every tool result goes back into the prompt. Twenty steps in, the model is reading its own history and losing the original task. Summarise old turns or drop them.
  • Loops. The model calls the same search with the same query four times. A step cap is not optional. Neither is detecting repeated identical calls.
  • Prompt injection through tool output. A scraped page or a customer email contains instructions. The model follows them. Treat all tool output as untrusted data, never as instructions.

The injection one is the reason we do not give agents write access to anything sensitive without a human approval step. If the agent can send email and read untrusted content, an attacker can make it send email. That is not a hypothetical.

When you actually need one

Most of the time you do not. If you can write down the steps in advance, write them down and call the model at the two or three points where judgement is needed. That is cheaper, testable, and debuggable. A fixed pipeline with one model call in the middle beats an agent on reliability almost every time.

You need the loop when the number and order of steps genuinely depends on what the model finds. Triage where the next action depends on the error message. Research where one search result decides the next query. Those are real cases. If your task does not look like that, an agent is complexity you will pay for in production.

When you do build one, instrument it like a distributed system. Log every step with its input, output, latency and token count. Replay failed runs from the logs. Set a hard budget per run in tokens and wall-clock time. And put a human in the loop for anything irreversible. If you want a second pair of eyes on the design, get in touch and we will walk through it with you.

Frequently asked questions

Is an agentic workflow just a prompt chain with extra steps?

No. A chain has a fixed sequence you define in advance. An agent decides the sequence at runtime by choosing which tool to call next. That flexibility is the point, and it is also why agents need step caps, error handling and logging that a chain does not.

How many steps should an agent be allowed to take?

As few as the task allows. Set a hard cap per run and treat hitting it as a failure, not a retry. If your agent regularly needs more than ten steps, the task is probably too broad and should be split or handled by a fixed pipeline.

Can we trust an agent to take actions like sending email or updating records?

Only with guardrails. Verify writes with a read afterwards, keep an audit log of every action, and require human approval for anything irreversible or externally visible. Tool output can contain injected instructions, so never let untrusted content drive a write directly.


#AI & Research