Von Jason Lagare
Case study

The model can't file anything

Enterprise support intake as one conversation — designed so the model is never the thing that creates the record.

Status of the work

Built to production standard and currently in user acceptance testing. Not yet in production.

Everything below is architecture, measured engineering cost, and findings from pre-production testing. There are no customer outcome numbers, because there are none yet — and I would rather say that than invent one.


Context

A self-service portal used by business customers of a large telecommunications provider to manage their accounts and raise support requests.

Support intake was spread across more than twenty separate forms, split by category — technical faults, account care, service requests of many kinds, internal helpdesk. To file a case correctly, a customer had to already know three things: which form applied to their problem, which product and issue code to pick from a controlled list, and what format the service identifier took.

Getting any of them wrong meant the case landed in the wrong queue. The wrong queue means delay, and delay on a business line is the thing the customer is calling about in the first place.

I designed and led the build of an assistant that collapses all of it into a single conversation that ends in a correctly routed case in the CRM.


The design problem

An agent that can only read is a search box. An agent that can write is a liability — because the thing it writes to is a system of record, owned by another team, holding other companies’ data, and a wrong action costs a customer their operations rather than costing us an inconvenience.

So the question that shaped the whole system:

How do you let a language model drive a workflow that ends in a real, routed, auditable record in a system you do not own — without ever letting the model be the thing that creates it?

The answer the architecture settles on: the model proposes, code disposes. Every other decision below follows from that one.


How a case actually gets filed

1. The portal forwards the message. A signed-in user types something like “my mobile data is down on 09XXXXXXXXX.” The portal’s backend-for-frontend attaches the verified session and forwards it to the agent over a fixed list of allowed paths.

2. Access is checked before anything else. The agent’s first call asks the authorization service whether this login may view cases, whether it may create them, and whether the account is linked to a CRM record. If filing is blocked, the user is told why in one sentence and the flow stops — before any questions are asked. Nobody is walked through a five-turn conversation only to be refused at the end.

3. The real catalog is fetched. The live product and issue list, pulled from the CRM’s own controlled values for that service type. Not a copy, not a prompt-embedded list — the catalog as it exists right now.

4. The model picks and asks. It selects the product and issue code from that catalog, works out what information is still missing, and asks for all of it in one message rather than interrogating the user turn by turn. Then it proposes a draft.

5. Code checks the draft. Access is re-checked. Codes are validated against the catalog fetched in that same conversation. The identifier format is validated. And every phone number in the draft must actually appear in what the user typed — the model cannot introduce a number of its own.

If a check fails, the model receives the list of problems, fixes what it can, and asks the user only for what remains. The draft is never silently corrected.

6. The user confirms. A valid draft is saved as pending and shown as a review card. The user replies yes — and that yes is handled in code, before the model is involved at all. The model plays no part in filing.

7. Code creates the case, with an idempotency key tied to the conversation, through the case management layer, the CRM adapter, and finally the CRM itself, routed to the correct queue by account tier.

8. It ends cleanly either way. On success, the case number. On a duplicate open case for the same line, nothing new is filed — the user is offered a comment on the existing case instead, which needs its own separate yes. On any other refusal, the user gets the real reason in plain words and keeps the draft so they can fix it.


The guardrails, specifically

Three, and what each does when it trips.

1. The model holds no write capability at all

It is given read tools and exactly one proposal tool, which saves a draft and calls nothing upstream. If the model names a write tool, the call is not executed and it is told the tool does not exist. On the tool server, write operations are additionally disabled unless explicitly enabled by configuration, and every write re-runs the authorization check independently.

When it trips: fail closed. Nothing is filed.

2. Identity can never come from the model

The user’s email and account come only from the verified session. Any tool argument that looks like an identity field is stripped before the call is made. Lookups are scoped to the session’s own account, so one company cannot read another’s case by guessing a number.

When it trips: refused with no upstream call at all.

3. Everything the model asserts is checked against something it didn’t produce

  • Product and issue codes must match the catalog fetched in that conversation.
  • Identifiers and callback numbers must appear in the user’s own typed text.
  • Access hours must come from the user’s words or their saved preference.
  • Troubleshooting steps may only be copied from curated guides.
  • If the model’s reply claims a case was filed when it was not, the reply is replaced with fixed text before the user ever sees it.

When it trips: the model gets a list of fixes and asks the user only for what’s missing.

Underneath all three

Every write and every denial goes to a dedicated audit stream, with customer fields redacted per tool — descriptions, numbers and emails removed, case references kept. And the idempotency key is tied to the conversation thread, so a retried confirmation after a timeout cannot file twice.

The failure policy in one line: writes fail closed, reads explain themselves and keep the draft, and an empty or garbled model turn is retried once before the user is asked to repeat.


Reaching systems of record from inside a perimeter

This is the part that doesn’t come up when agents call public APIs over the open internet.

The path runs through five layers: the portal’s backend-for-frontend, which validates the session and permits only a fixed set of paths; the agent itself, running in a private cluster with no public address and holding no upstream credentials; a separate tool server reached over an open tool protocol inside the cluster, which holds the credential and re-checks authorization on every call; the case management layer; and finally a cluster-only CRM adapter using short-lived JWT-based authentication. Other back-office systems sit behind their own adapters and leave through an enterprise gateway. The model is an outbound call authenticated by short-lived workload identity, so no long-lived key sits on the pod.

Four things we had to build ourselves, because nothing off the shelf worked through that network:

  • The split between the agent and the tool server, so the process that talks to the model never holds a credential.
  • A tool-server template with per-tool permissions, a write-enable switch, an audit stream, and session forwarding — so the tool layer runs as the signed-in user, not as whoever started the service.
  • A confirmation step in code rather than the framework’s built-in human-in-the-loop interrupt, so the model is structurally incapable of filing.
  • Typed response blocks that the portal renders, so the portal never fills in a value or a link on its own.

The perimeter details are small but real: base images come from an internal registry rather than public ones, the development gateway uses a certificate from an internal authority, and the CRM routes are deliberately kept off the public gateway so a browser can never reach them.

The short version of the edge:

An agent that acts as the customer, with the customer’s permissions, against systems of record it doesn’t own.


What it costs to run

Forecast from the implementation at list prices, not measured production traffic:

  • ~$0.017 in model spend per case filed, across seven model calls.
  • $0 for the confirmation that actually files the case, because that runs in code.
  • ~$290/month at a thousand users a day, with an honest range of $180–$400.
  • $0.036 is the hard ceiling for a single message — a cap of fifteen model calls per message bounds any runaway tool loop.

Rigor, for what it’s worth as a proxy: 98 tests on the tool server and 63 on the agent.


What broke in pre-production testing

All of these came from development, staging, and the end-to-end acceptance sweep.

The model returned nothing, silently. It would end a turn with a malformed tool call and no text, so the user got a blank reply and lost what they had typed. In one case a single apostrophe inside a tool argument was enough to make it drop the turn. Fixed by retrying once in text-only mode, storing the user’s description in code rather than trusting the model to carry it between turns, and never sending an empty reply.

The model claimed things it hadn’t done. It announced that a request had been sent before the user had confirmed, and referred to template downloads that didn’t exist. Fixed by checking the reply for those claims and replacing them, and by sourcing links only from real data.

A stale offer trapped users in a loop. After a duplicate was detected, the “add a comment to the existing case?” offer outlived the draft it belonged to. Every subsequent yes retried a comment that kept failing. Fixed by clearing any pending offer whenever a new draft is proposed.

Dates were wrong until the model was given the current date in the user’s own timezone.

The agent and the portal disagreed about shape. Review cards vanished silently when a value exceeded the portal’s display limit, and a navigation link pointed at a page that didn’t exist — sixteen documented mismatches in all.


What I’d do differently

Set the agent-to-portal response contract and the model-failure tests up front, and start from the assumption that the model will sometimes return nothing and sometimes claim success it hasn’t earned.

Every single bug on that list came from one of two places: trusting model output, or trusting the boundary between the agent and the portal. The guardrails that protect the systems of record were designed in from the start and held. The ones protecting the user’s experience were retrofitted, and that’s exactly where the failures clustered.


Delivery context

The platform this sits in went to its first release 108 days after the first line of product code, built by around 10 engineers, shipping 243 APIs across 20 services, with 1,100+ merge requests, 90% of them merged within a day.

Working on the same thing?

Happy to go deeper on this one — get in touch.