Laava LogoLaava
ai-integration

Why AI Projects Die at the Integration Layer

Laava Team
Modern office workspace representing enterprise AI integration

Why AI Projects Die at the Integration Layer

A RAND Corporation study based on interviews with 65 data scientists and engineers found that more than 80 percent of AI projects fail — twice the rate of non-AI IT projects. But here is what most analyses get wrong: they focus on data quality, talent gaps, or misaligned objectives. Those are real problems. But the most common silent killer? The integration layer. The messy, unglamorous work of connecting a capable AI model to the systems that actually run a business.

We see it constantly. A team builds a brilliant prototype. GPT-4 or Claude generates impressive answers. The demo wows the stakeholders. Then someone asks: "Great, but how does this connect to our ERP system? What about our CRM? What about GDPR?" And that is where the project stalls — sometimes for months, sometimes forever.

This article dissects why integration is the graveyard of AI ambition and what architectural patterns actually survive contact with production.

The Air Gap Problem

Most AI demos exist in a vacuum. They take a prompt, call an LLM API, and return a response. Clean, elegant, and completely disconnected from reality.

In production, an AI agent does not just generate text. It needs to read from a document management system, check permissions in Active Directory, write to a ticketing system, pull pricing from an ERP, and log every interaction for compliance. Each of those integrations has its own authentication model, data format, rate limits, failure modes, and — inevitably — a dusty SOAP API that nobody wants to touch.

This is the air gap: the space between what an AI model can do and what your business systems will allow it to do. The gap is not technical in the computer science sense — it is technical in the plumbing sense. Authentication, authorization, data transformation, error handling, retry logic, circuit breakers, audit trails. None of it is intellectually difficult. All of it is time-consuming, brittle, and essential.

The RAND study specifically identified that "organizations might not have adequate infrastructure to manage their data and deploy completed AI models" as a primary cause of project failure. In practice, this means the model works but the surrounding system does not exist yet. The AI is ready; the integration is not.

The Last Mile Is the Hardest Mile

In logistics, the last mile — getting a package from the local depot to your doorstep — accounts for over half the total delivery cost. AI deployment has its own last mile problem, and it is strikingly similar.

Getting an LLM to answer questions accurately might take a few weeks. Getting that same LLM to answer questions accurately, from your data, through your systems, with proper access control, PII handling, error recovery, and audit logging — that takes months. The ratio is often 20 percent model work to 80 percent integration work. Yet budgets and timelines are usually planned the other way around.

Here is what the last mile actually looks like in a typical enterprise AI deployment:

  • Model routing — Different queries need different models. A simple FAQ lookup does not need GPT-4; a complex multi-step reasoning task does. Without intelligent routing, you either overpay or underperform.
  • PII redaction — Customer data flowing through an LLM is a GDPR lawsuit waiting to happen. You need to strip personally identifiable information before it hits the model and rehydrate it on the way back.
  • Fallback and retry logic — LLM APIs go down. OpenAI has outages. Azure throttles. Your production system cannot just throw an error; it needs to gracefully fall back to another provider.
  • Cost tracking — Token costs add up fast. Without per-project, per-team, or per-customer cost attribution, the CFO pulls the plug the moment the invoice arrives.
  • Guardrails — Output validation, content filtering, JSON schema enforcement. The model might return anything; your system needs guarantees.
  • Legacy system connectivity — Your AI agent is only as useful as the systems it can reach. And in most enterprises, the systems that matter most are the oldest ones.

Each of these is a standalone engineering problem. Together, they form the integration layer — and it is where projects go to die.

AI Gateways: The Missing Infrastructure

Traditional API gateways — the Kongs and Apigees of the world — were built for a request-response world. They handle routing, rate limiting, and authentication for REST APIs. But AI workloads are fundamentally different. Requests are non-deterministic. Responses are expensive (both in latency and cost). Payloads contain sensitive data that needs real-time transformation. And you need to swap out the underlying provider without changing a single line of application code.

This is why a new category of infrastructure has emerged: the AI gateway. An AI gateway sits between your application and the LLM providers, acting as a unified control plane for all AI traffic. Think of it as an API gateway that understands tokens, models, and prompts instead of just HTTP requests.

The landscape has matured rapidly. Several open-source and commercial solutions now address this problem:

LiteLLM and the Unified API Approach

LiteLLM translates calls to over 100 LLM providers into a single OpenAI-compatible format. Its proxy server acts as a centralized gateway with authentication, spend tracking per project and user, and router-based fallback logic across deployments. If Azure OpenAI goes down, your request automatically reroutes to a direct OpenAI endpoint or an Anthropic model — without your application knowing the difference. This is not a nice-to-have; for production systems, it is table stakes.

Portkey and the Guardrails Pattern

Portkey takes a different angle. Yes, it does routing and fallbacks. But its real strength is the guardrails-on-the-gateway pattern: verifying LLM inputs and outputs in real-time with checks ranging from regex matching and JSON schema validation to prompt injection detection. When a guardrail fails, you can deny the request, fall back to another model, retry, or log and continue. Portkey currently serves over 25 million requests daily — proof that this pattern works at scale. Their edge architecture adds only 20-40ms of latency, often recouped by their caching and routing optimizations.

Kong AI Gateway and Enterprise Governance

Kong — the veteran API gateway company — has extended its platform with AI-specific capabilities. Their AI gateway handles multi-LLM security, routing, and cost control across OpenAI, Azure AI, AWS Bedrock, and GCP Vertex. It adds semantic caching for redundant prompts, AI-specific analytics dashboards, and even automatic MCP server generation. For enterprises already running Kong for their traditional APIs, this is a natural extension. For greenfield AI projects, it offers a governance-first approach that compliance teams appreciate.

Model Routing: The Multi-Model Reality

The single-model era is over. Any production AI system worth building uses multiple models, and the reasons are pragmatic, not ideological.

Consider a customer support agent. Simple greetings and FAQ lookups can be handled by a fast, cheap model like GPT-4o-mini or Claude Haiku. Complex troubleshooting that requires deep reasoning needs Claude Opus or GPT-4. Structured data extraction from invoices might work best with a fine-tuned open-source model running on-premises. And if you are operating in Europe under GDPR, certain requests might need to stay on sovereign infrastructure entirely.

Intelligent model routing is the pattern that makes this work. Instead of hardcoding a model into your application, you define routing rules at the gateway level: route by task complexity, by data sensitivity, by cost budget, or by latency requirements. The application code stays clean. The routing logic stays centralized and auditable.

This also solves the vendor lock-in problem that keeps CTOs awake at night. When your AI gateway abstracts the provider, you can switch from OpenAI to Anthropic to a self-hosted Llama model without touching your application. You are no longer betting your production system on a single company's API stability or pricing decisions.

PII Redaction: The Compliance Bottleneck Nobody Planned For

Here is a scenario that plays out in almost every enterprise AI project: the prototype works beautifully with test data. Then legal reviews the architecture and asks where customer names, email addresses, and BSN numbers end up. The answer — "in OpenAI's API" — triggers a compliance review that can stall a project for months.

PII redaction at the gateway level solves this architecturally. Before a request reaches the LLM, the gateway identifies and replaces personally identifiable information with tokens. "Jan de Vries at jan@company.nl" becomes "[PERSON_1] at [EMAIL_1]". The model processes the sanitized input. On the way back, the gateway rehydrates the tokens with the original values. The LLM never sees the real data. Your compliance team sleeps at night.

This is not a feature you bolt on later. It needs to be part of the architecture from day one. When PII redaction is an afterthought, you end up with one of two outcomes: a production system that leaks sensitive data, or a project that never reaches production because compliance will not sign off.

Under the GDPR — and the upcoming EU AI Act — this is not optional. Organizations that send personal data to third-party AI providers without adequate safeguards face fines of up to 4 percent of annual global revenue. Gateway-level PII redaction is the most practical way to use powerful cloud-hosted models while maintaining data sovereignty.

Legacy Systems: Where Good Intentions Go to Die

The average enterprise runs hundreds of applications, many of them decades old. These systems were not built for AI integration. They were built for reliability, and they have it — they are the backbone of the business. But connecting them to modern AI capabilities requires a translation layer that understands both worlds.

We have seen AI projects fail because nobody accounted for the six weeks needed to get read access to a legacy ERP system. Or because the document management system exposes a SOAP API that cannot be called from a modern cloud function without a custom adapter. Or because the authentication flow requires a VPN tunnel that the cloud-hosted AI service cannot reach.

These are not technical challenges in the traditional sense — they are organizational and architectural debt. The solution is not to replace legacy systems (that is a multi-year, multi-million project). The solution is to build an integration layer that can mediate between the AI agent and the legacy systems, translating protocols, handling authentication, and managing the impedance mismatch between modern event-driven architectures and batch-oriented legacy systems.

The Model Context Protocol (MCP) is emerging as a standard for exactly this: giving AI models a structured way to interact with external tools and data sources. But MCP endpoints still need to be built, secured, and connected to the underlying systems. The protocol is the easy part. The integration is the hard part.

Patterns That Survive Production

After building production AI systems across multiple industries, some patterns consistently work and others consistently fail. Here is what survives:

Gateway-first architecture

Every LLM call goes through an AI gateway from day one. Not after you discover you need fallback logic. Not after the first production outage. From the start. The gateway handles provider abstraction, cost tracking, PII redaction, guardrails, and observability. Your application code calls one endpoint. Everything else is configuration.

Integration-driven planning

Before writing a single prompt, map every system the AI agent needs to touch. Get API documentation. Test authentication flows. Identify rate limits and data formats. The integration audit should happen in week one, not month three.

Layered architecture

Separate the AI brain from the integration plumbing. Your reasoning engine should not know or care whether it is talking to Salesforce or a custom PostgreSQL database. That is the job of the integration layer. Clean separation means you can swap models, add integrations, and scale components independently.

Compliance by design

PII redaction, audit logging, and data residency constraints are architectural decisions, not afterthoughts. Build them into the gateway layer and they apply to every request automatically. Try to add them later and you are retrofitting compliance into a system that was never designed for it.

How Laava Approaches the Integration Layer

At Laava, we structure every AI agent around a 3 Layer Architecture: Context (the metadata and knowledge the agent needs), Reasoning (the AI brain that makes decisions), and Action (the integration layer that connects to the real world). That third layer — Action — is where we spend most of our engineering effort, because it is where projects succeed or fail.

The Action Layer is where AI gateways, PII redaction, model routing, legacy system adapters, MCP servers, and guardrails live. It is deliberately separated from the Reasoning Layer so that the AI logic remains clean and portable while the integration complexity is managed independently.

Integration is not a second-class citizen in our team either. It is one of Laava's four equal DNA pillars — alongside AI/ML, Software Engineering, and Infrastructure. We have dedicated integration expertise because we have learned, project after project, that a great model connected to nothing is worth nothing.

If you are navigating the integration challenges of bringing AI into production — whether it is connecting to legacy systems, setting up model routing, implementing PII redaction, or designing a gateway architecture — we would be glad to talk. Visit our AI Integration & Gateways page to learn how we structure the integration layer for production AI, or reach out directly to discuss your specific challenges.

Why AI Projects Die at the Integration Layer | Laava Blog | Laava