# Gartner Expects 40% of Agent Projects to Be Canceled. I Stopped One, and Here Is What I Learned

> Source: <https://dev.to/alirezaai/gartner-expects-40-of-agent-projects-to-be-canceled-i-stopped-one-and-here-is-what-i-learned-550g>
> Published: 2026-11-27 16:37:13+00:00

**Recommendation:** Before building agent logic, verify the agent can actually reach its data; then run it as an event-driven consumer with idempotency keys and per-event tracing so duplicates and no-action outcomes are observable.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

A model, some tools, a database and a trigger make a working demo. They don't make a production system.

Gartner [predicts](https://www.gartner.com/en/newsroom/press-releases/2025-06-25-gartner-predicts-over-40-percent-of-agentic-ai-projects-will-be-canceled-by-end-of-2027) that over 40% of agentic AI projects will be canceled by the end of 2027, citing escalating costs, unclear business value and inadequate risk controls. That is a forecast, not a measured outcome. One [reconciliation of failure statistics](https://alatirok.com/ai-agent-failure-rate-2026/) notes that it is the only widely quoted figure that measures agents specifically. The scarier numbers (80%, 88%, 89%) cover broader categories such as all enterprise AI or all proofs of concept.

I recently became one of those statistics. I built a six-agent system for petroleum trading and then stopped the project. The reason had little to do with the model or the code.

This article covers the failure data, a layered architecture I would use next time, and my own case. It builds on good existing work, including [Event-Driven AI Agents: Patterns That Scale](https://dev.to/thedailyagent/event-driven-ai-agents-patterns-that-scale-39ld), [Designing Agentic AI Systems](https://dev.to/sreeni5018/designing-agentic-ai-systems-how-real-applications-combine-patterns-not-hype-1ob4), Martin Fowler's [Long-horizon agents and durable execution](https://martinfowler.com/articles/durable-execution-agents.html) and MLflow's [Event-Driven Agents](https://www.mlflow.org/articles/event-driven-agents/).

[Forbes' summary](https://www.forbes.com/sites/robertszczerba/2026/07/07/why-40-of-agentic-ai-projects-may-be-canceled-by-2027/) of the Gartner forecast points the same way: governance, data access, ownership and ROI drive cancellations more than raw model capability. Most agent failures are distributed-systems and data problems, so I treat the agent as a distributed system.

Every architecture guide I read, including the ones linked above, assumes the agent can reach the data it needs. My project shows what happens when that assumption fails. I return to it in the case study below, because it should be checked before anything else.

A request-driven agent waits for a caller. An [event-driven agent](https://www.mlflow.org/articles/event-driven-agents/) wakes because something happened, such as a webhook, a queue message or a file change. The broker buffers events when the agent is slow or down. The consumer loop is: subscribe, receive an event, enrich it with tools, reason, then act or choose to do nothing.

Plan for these failure modes:

Use orchestration when one event needs dependent steps, and choreography when several independent agents should react to the same event.

Here is an illustrative handler with an idempotency key and per-event tracing, following the tracing pattern in the MLflow guide. It is a sketch, not production code:

``` php
import hashlib
import mlflow

def idempotency_key(event: dict) -> str:
    return hashlib.sha256(f'{event["id"]}:{event["type"]}'.encode()).hexdigest()

@mlflow.trace
def handle_event(event: dict):
    mlflow.update_current_trace(
        tags={"event_id": event["id"], "event_type": event["type"]}
    )
    key = idempotency_key(event)
    if processed_store.exists(key):           # your own store (Redis, Postgres, ...)
        return {"status": "duplicate_ignored"}

    context = enrich(event)                   # tool calls appear as spans
    decision = agent.run(event, context)      # "no_action" is a valid result
    if decision.action == "no_action":
        processed_store.add(key, outcome="no_action")
        return {"status": "no_action"}

    result = act(decision, idempotency_key=key)
    processed_store.add(key, outcome=result.status)
    return {"status": result.status}
```

A duplicate delivery now shows up as two traces with the same `event_id`, and "no action" becomes something you can read instead of a gap in your logs.

Martin Fowler's article describes [durable execution](https://martinfowler.com/articles/durable-execution-agents.html) as an emerging pattern. The runtime records the result of every step that touches the outside world. After a failure, the program runs again, completed steps are skipped and state is rebuilt from the record. Temporal, Restate, Inngest, DBOS and Cloudflare Workflows implement it. It resembles a write-ahead log, event sourcing and Erlang actors. Waiting workflows hold no process, so cost tracks work done rather than the number of idle agents.

Durable does not mean correct. Fowler's practical rules include:

A sketch of such a guard:

``` php
class PlaceOrder(Tool):
    def allowed(self, state) -> bool:
        return state.approved_up_to is not None and state.order is None

    async def execute(self, state, ctx):
        price = await ctx.supplier.current_price(state.sku)    # re-check now
        if price > state.approved_up_to:                       # outside approved range
            return Result(placed=False, price=price)
        return await ctx.supplier.place_order(
            state.po, idempotency_key=state.po.number          # stable across retries
        )
```

Notice that this guard depends on `current_price` returning a real, current number. That is the point I return to below.

Treat memory as a subsystem, not a vector store. One [architecture guide](https://www.cognee.ai/ai-agent-memory-architecture) separates working memory from long-term episodic, semantic and procedural memory, with explicit write and read paths and a feedback loop. Start simple. One [source](https://theaioperator.io/p/agent-memory) argues that below roughly 50K notes, text search with a capped output can beat a vector database. The open-source [gbrain](https://github.com/garrytan/gbrain) project defaults to embedded PGLite for personal use up to about 50K pages. It moves to Postgres with pgvector for shared or large deployments.

[Bain](https://www.bain.com/insights/the-three-layers-of-an-agentic-ai-platform/) describes three layers for an agentic platform: orchestration, observability and governed data access. Its components include a central registry and policy, runtime guardrails such as prompt-injection filters, and full tracing of the execution graph. A [research reference framework](https://arxiv.org/html/2602.10479v1) adds policy enforcement on every tool call, permission separation by role, bounded execution budgets and immutable audit logs.

For event-driven agents, tracing matters more than for chat agents, because nobody is watching. For any event you must be able to say what the agent received, which model and tool calls it made, and why it acted or didn't. Build an evaluation set from real events, including "no action" cases.

I built [Hanna AI](https://github.com/modarresi1913/hanna-ai), a prototype multi-agent system for petroleum and petrochemical trading. According to its README, it has six specialized agents covering market analysis, logistics, documentation, compliance, finance and operations. A keyword-based router sends each message to the right agent, and the operations agent coordinates deals. It runs on Next.js, TypeScript and SQLite via Prisma.

The design looked complete. The problem was upstream of the design.

**What I could not get.** I could not obtain up-to-date data for the oil-related industries I was targeting, because I had no access to it. I also could not find clear, transparent data on suppliers and buyers.

**What it did to the build.** Real-time prices became mock feeds for 12 products. The company directory became a static list of about 20 companies. The agents could produce fluent answers, but not answers anyone should trade on.

**What it did to each layer:**

The durable-execution guard above fails for the same reason. It can re-check a price before an order, but only if a real price exists.

**Why I stopped.** Without current market data and without transparent information on who supplies and who buys, the system could only demonstrate its workflow, not support real decisions. I chose to stop the project rather than present mock output as if it were reliable. The project is currently on hold.

**What I would do differently:**

| Layer | Core pattern | Main risk it addresses | 
|---|---|---|
| 0. Data access | Verify sources, freshness and rights | Building on data you can't get | 
| 1. Ingress | Event bus, dedup, idempotency keys | Bursts, duplicates, missed events | 
| 2. Execution | Durable workflows, retries, compensation | Crashes, lost state, long waits | 
| 3. Memory | Layered, simple-first | Stale or oversized context | 
| 4. Governance | Central policy, audit, tracing, evaluation | Silent wrong actions, compliance | 

Add guardrails and observability before complexity ([Neo4j](https://neo4j.com/blog/agentic-ai/agentic-architecture/) makes a similar point). A sensible order:

Fowler's closing point fits my experience: the trade-offs you build into the harness decide whether an agent is useful or only a proof of concept. I would add one more rule: confirm the data exists before you build the harness.

Author: Seyed Alireza Alhosseini Almodarresieh

my site:[https://almodarresieh.github.io/](https://almodarresieh.github.io/)
