
Retrofitting Your SaaS With AI Agents Without a Rewrite
Gartner projects more than 40% of agentic AI projects will be canceled by the end of 2027, with cost overruns and inadequate risk controls high on the failure list. For a SaaS with paying tenants, a schema, and an RBAC model, that number says the model is not the hard part of a retrofit.
The goal is not a new product. It is agent features that plug into the schema you already have, inherit the permissions you already enforce, and roll out without destabilizing customers you already bill.
The constraints are the event bus, the tenancy model, and the flag system. Where those three are solid, a retrofit ships in months. Where any one is weak, the retrofit exposes it first.
Start at the Event Bus, Not the UI
The temptation with a retrofit is to bolt an agent onto a page: a sidebar, a chat panel, a button labeled "ask." The useful work lives behind the event bus. Significant tenant events — invoice created, ticket escalated, deal stage moved — already publish to a topic that existing handlers subscribe to. Agents belong on those topics, reading context from the same stream and publishing proposed actions back as new events your current handlers accept.
Anthropic's 2026 agent report found that 46% of organizations cite system integration as the top barrier to agent deployment, with 57% already running multi-stage workflows. The integration pain shrinks when agents consume and emit the same schema the rest of the services pass around. No new RPC surface, no parallel orchestration layer, no bespoke queue. A planner subscribes, a tool worker subscribes, a reviewer subscribes. Each one is a service in a shape the platform already knows how to deploy, with the same blast-radius controls as anything else on the bus.
Rollback stays cheap. Shut off the subscription and the surface disappears without touching the write path.
Agents Inherit RBAC, They Do Not Invent It
Permissions are the retrofit's first real test. Agents must not become privileged robots that read across tenants because they are "AI." Every agent action should be a request on behalf of a specific user in a specific tenant, with that user's existing role, scope, and row-level policies. If the schema uses tenant_id and RLS in Postgres, the agent connects through the same pool, under the same JWT, with the same claims.
That means an agent runs as a principal, not a daemon. Give it a service user per tenant, or a delegated token minted by the same auth server your API uses. The same patterns that govern multi-tenant data isolation apply unchanged here: scope by claim, enforce in the database, log the principal on every action. An agent that cannot pass an existing audit does not belong in the retrofit.
SCIM provisioning deserves attention early. If the agent exists as a workspace principal, it needs the same lifecycle as a human user: created on tenant signup, scoped to its role, deprovisioned on offboarding. Skip that and agent identities outlive the humans who created them, which is how unauthorized agents end up in production.

Scope the Blast Radius Per Tenant
Tenant isolation is only half the problem. The other half is throttling what one agent can do to one tenant before a human notices. The usual controls are per-tenant rate limits on tool calls, write caps per action class, and a kill switch keyed on the agent identity rather than the whole feature.
Most risk-control failures look the same in review: no circuit breaker, no quota, no audit trail scoped to tenant. Outbound actions should flow through an allowlisted tool layer, not direct database or integration calls. The same layer is where approval and audit controls live, so an action that mutates billing, exports data, or sends a customer email can route through a review path your existing admins already use.
Keep the cost controls at the same granularity. Token spend is a tenant-level budget, not a product-level one, and runaway loops happen one tenant at a time. Cap tokens, log every tool call with the tenant and principal, alert on anomalies against last week's baseline. None of this is exotic. It is the same shape as the per-tenant quotas you already enforce on API calls and exports.
Shadow Mode Comes Before Shipping
Before an agent action reaches a tenant's data, it should spend time in shadow mode: full context, full planning, full proposed action, but the final write is suppressed and compared against what a human or the existing system did. LangChain's 2025 practitioner survey found that 89% of teams have observability but only 52% run evaluations, which is the missing evaluation layer shadow mode supplies. Observability shows what the agent did. Evaluation tells you whether it was right.
Keep a shadow log per tenant with the proposed diff, the actual diff, the human verdict, and a replayable trace. When agreement rates hold and the tails have been inspected, promote the agent to assisted mode: it proposes, a human approves, the write executes. Only once assisted mode is calm does unattended write access ship, and even then only on actions with bounded downside — a refund under $50, a status change, a tag.
Shadow mode also produces the number a CFO can read. "We shadowed 12,000 invoice-matching proposals, 94% agreement, 73 disagreements reviewed, 61 agent-correct" is an argument. A demo is not.
A Strangler-Fig Rollout for Agent Features
The strangler-fig pattern applies cleanly to agent features. Pick one workflow, route a small percent of tenants to the agent path behind a feature flag, and route the rest through the existing handler. Measure, widen, retire the old path only when the new one is boring. The flag system is doing the real work, which is why a retrofit without flag infrastructure is a bad idea regardless of model quality.
Scope the flag to tenant cohorts, not global on-off. Internal tenants first, then design partners, then free-tier accounts, then the long tail. Each cohort can be rolled back independently, and a misbehaving agent never reaches a tenant that never opted in.
Gartner projects that 75% of API gateway vendors will integrate MCP features by end of 2026, which matters to teams planning to expose internal tools to agents through a standardized layer. Whatever the transport, keep the agent-facing tool surface small, versioned, and owned by the team that owns the underlying API. The AI engineering teams we embed see these retrofits land cleanly when flags, event schemas, and RBAC already exist, and stall when any one is missing.
Where Retrofits Actually Stall
Three situations, three next steps.
Where the platform already has a mature event bus, strong RBAC, and tenant-scoped flags, start a retrofit in shadow mode on one workflow with bounded blast radius, and give it eight to twelve weeks before promoting anything to assisted writes. Expect the hard part to be evaluation, not models.
Where one of those three is missing, fix that first. Retrofitting agents onto a system without row-level tenant enforcement, or without feature flags scoped to tenant cohorts, exports the agent's bugs directly to every customer. A short sandbox project ahead of the retrofit is usually cheaper than cleaning up after the first incident.
Where you cannot tell today whether agents are already calling your APIs, start with inventory. The 82% unknown-agent figure from the Cloud Security Alliance, plotted above, is the version of this retrofit nobody plans for and everybody eventually inherits. Catalogue what is already running under which service accounts before adding anything new.
