DEV Community

Cover image for Failure Should Be a State, Not a Dead End
László Szabó
László Szabó

Posted on

Failure Should Be a State, Not a Dead End

AI agents fail.

That part is inevitable.

What matters is what your workflow does next.

In many agentic systems, failure effectively means:

  • stop the execution
  • lose useful context
  • restart the task
  • rediscover what went wrong
  • repeat work that already happened

That feels less like recovery and more like starting over.

Failure should be part of the workflow

In vincent, I wanted failure to be something the workflow can represent explicitly.

A failed attempt still has valuable information:

  • the agent transcript
  • produced output
  • timing information
  • the failure reason
  • the branch and worktree
  • everything that happened before the failure

That state should not disappear just because one step failed.

Instead, the workflow can decide what happens next.

Recovery can take different forms

Depending on the situation, you might want to:

  • 🔄 Retry the same task
  • ✏️ Change something and retry
  • 🛠️ Run a repair agent in the existing worktree
  • ⏭️ Skip the failed task
  • 🛑 Cancel the workflow
  • 👤 Ask a human to decide what happens next

The important part is that none of these require pretending the previous attempt never happened.

Restarting an agent is not the same as recovering a workload.

Why this matters

As agent workflows become longer and more complex, failures become normal operational events.

A workflow with ten, twenty, or fifty dependent tasks cannot realistically treat every failure as:

Something failed.
Start again.
Enter fullscreen mode Exit fullscreen mode

The orchestration layer needs to understand failure as a first-class state.

That makes workflows easier to debug, easier to recover, and much safer to run when agents are touching real codebases.

This is especially important for autonomous agents

The more autonomy we give agents, the more important recovery becomes.

Retries alone are not enough.

Sometimes the right response is another agent.

Sometimes it is a human.

Sometimes the task should simply remain blocked until somebody understands what happened.

The orchestration system should preserve enough context to make that decision intelligently.


I wrote more about how I approach this in vincent, my open-source AI SDLC workflow tool:

👉 https://lezli01.is-a.dev/vincent/docs/why/failure-should-be-a-state-not-a-dead-end.html

I’m curious how others are handling this in agent orchestration systems.

Do you treat agent failure mostly as a retry problem, or as workflow state?

Top comments (0)