Engineering · 11 min read

Published

The model is the easy part

What decides whether an AI agent holds up in production once the model has been chosen, and which questions show whether a supplier has done that work.

When an AI project is discussed, the choice of language model often gets the most attention. That is rarely what decides the project. Which models are candidates at all depends largely on what data they will see and where they are allowed to run. Among those that remain, you can try two or three against a sample of your own cases and see which one handles the task. If you have a test set in place, the model is also the easiest part to replace later.

Whether an agent works in production depends on what sits around the model. A language model does not always give the same answer to the same question, and its behaviour can change when the provider releases a new version. A large part of the work is therefore about limiting what the model can do and measuring what it actually does.

Four questions show whether a supplier has done that work. The example used throughout: a manufacturing company receives order confirmations from its suppliers as PDFs by email. An agent reads the confirmation, compares it with the purchase order in the ERP system, enters the confirmed delivery date and sends discrepancies in price or quantity to the buyer.

1. What is the worst the agent can do?

A language model cannot do anything in your systems by itself. It can respond with a request for a particular tool to be called with particular values, and it is then the code around the model that decides whether the call is made. So the worst the agent can do is determined by which tools it has and what permissions those tools have in the systems behind them.

OWASP, which publishes a list of the top security risks in applications built on language models, calls the problem Excessive Agency. The organisation points to three causes. The agent has access to functions it does not need. The functions have more permissions in the underlying systems than the task requires. And high-impact actions are carried out without anyone independently checking and approving them. The advice follows from this: as few tools as possible, preferably no open-ended tools that can run arbitrary commands, the least possible permissions, human approval for high-impact actions, and permission checks in the systems that receive the call rather than in the model's judgement.

For the order confirmations, that means one tool that reads a purchase order and one that writes the confirmed delivery date to an order line. The agent needs no tool to change prices, place new orders or email the supplier, so it should not have one.

On the same list, prompt injection is ranked first for 2025. According to OWASP, the attack can come indirectly, through content from external sources that the model reads, such as web pages or files. An order confirmation is a file written by someone outside the company. We assume that an agent can be tricked by content it reads. So an agent that has read untrusted text must not be able to trigger payments or pass data on. OWASP's advice on prompt injection points the same way and adds two things: content from untrusted sources is kept separate and clearly marked, and the system is tested as if the model were an untrusted user.

The sign-off step is an approval check, not a security control. Security lies in what the agent can do at all: least privilege and no tools it does not need.

The worst case can also be that the agent sees something it should not. Before we build, we classify the data by what it contains (business data, personal data, sensitive information, accounting records), and the class decides which model may see it. We discuss which data should leave the building at all in Before you let AI near your company data.

2. How do you know it gets it right?

Each test case is a real order confirmation where you know what should happen. After the run, two things are assessed separately. The outcome is what came out: was the right delivery date on the right order line, and did the price discrepancy go to the buyer? The path is everything the agent did to get there: which orders it looked up, which fields it read and wrote, and which tools it called in what order.

The two can diverge. The delivery date was right, but the agent read all the open orders with that supplier when it needed one, or tried to write to the price field. If you assess only the outcome, the run looks flawless. If you assess only the path, you miss that the date ended up on the wrong line.

What is assessedThe questionWhat a fail means
OutcomeWas the result right?A quality problem. Fixed with better context, rules or model.
PathDid the agent do only what it was allowed to do, in the right order?A security problem. Stops the release however good the outcome was.

If everything is merged into one score, the single case where the agent looked up another supplier's order gets lost. That is why outcome and path are reported separately, and every error in the path is listed as a separate security failure in the test report.

There are two kinds of check. The security questions are answered by ordinary code that goes through the log of the run. Did the agent write only to permitted fields? Was the price left untouched when it differed, and did the discrepancy go to the buyer? Did any call reach the supplier? The answer is yes or no, it comes out the same every time, and you can show it to an auditor.

Quality questions that are hard to write as code, such as whether the summary for the buyer was clear and correct, can be assessed by a second language model against a written rubric. That model is as fallible as the one it assesses. It may grade quality, but it must never be the only thing standing between the agent and something that cannot be undone.

The test set is built from real cases from your business: partial deliveries, changed item numbers, dates in unexpected formats and the other exceptions that actually occur. It is rerun every time something changes. A test set with only clean cases measures what would have worked anyway.

The same division between code and model applies in the workflow itself. Comparing a date or a price with the purchase order is ordinary code, and the model is needed to read a confirmation that each supplier words in its own way. Simplest solution first: ordinary code where that is enough, AI where it is needed, a human where there is ambiguity, accountability or irreversible consequences.

3. What happens when several agents share the same system?

Say the example grows. A second agent replans production when a delivery date moves, and a third notifies the customer when the customer's order is affected. Each agent can work flawlessly on its own and the whole can still go wrong.

What the agents have in common is the order lines in the ERP system. Each one reads and writes there without knowing what the others are doing at that moment, and that is where the collisions happen.

What can go wrongWhat prevents it
Two agents change the same order line.Every important piece of data has a single owner. Only the agent that reads confirmations writes the delivery date. The others read it or request a change.
Planning is based on a date that has already changed.A write only goes through if the line looks the same as when the agent read it. Otherwise it is rejected and the agent reads it again.
A call is sent again after an interruption, and the customer gets two emails about the same delay.Every call that creates or sends something carries a unique key. If the receiving system recognises the key, nothing is done a second time.
Two agents take the same case, or neither does.An agent takes a case by recording itself as the assignee, and that only works if no one else got there first. Cases left without an assignee end up in a queue that a human monitors.

None of this is new or specific to AI. It is standard practice in systems where several parties change the same data, and it should be in place before the second agent goes live. Ask a supplier who proposes several agents how they have solved each row in the table. A vague answer means the risk of duplicate or lost cases stays with you.

4. What happens when something changes?

A changed prompt can change the agent's behaviour as much as changed code, and so can a new model version. Model versions are also retired, and we describe how that works at one of the large cloud providers in AI agents: beyond the basics.

Prompts, rules and model versions are therefore handled as code changes. They are version-controlled, run against the test set from section 2 and go into production only once you have approved the release. Every action the agent takes is logged and traceable, so that afterwards it is possible to show what happened and why.

For organisations covered by the Swedish Cybersecurity Act (2025:1506), which has applied since 15 January 2026, this also touches on the Act's requirements. Under Chapter 2, Section 3, the security measures must cover at least a number of areas. Three of them are close to what a supplier does when it builds an agent for you: supply chain security, security in the acquisition, development and maintenance of network and information systems, and access control policies. The tools and permissions in section 1 can be counted as access control, and version control, the test set and approval per release as development and maintenance.

The supplier is part of the supply chain. Since 1 October 2026, the regulations on security measures (MCFFS 2026:11, Chapter 4, Section 1) require a covered organisation to ensure that the supplier meets the security requirements in the parts the supplier is responsible for, unless it operates solely in the five sectors the regulations exempt (Chapter 1, Section 1). It must then also assess whether a prospective supplier can meet the requirements for the entire term of the contract. The answers to the questions below are part of the basis for that assessment. What the contract should cover is set out in What the Swedish Cybersecurity Act requires of your suppliers.

5. Questions to ask a supplier

You do not need to be able to build an agent to scrutinise whoever is going to build it. Ask the questions and listen for whether the answers are concrete.

  1. Which tools does the agent get, and what is the most harmful thing it can do without a human approving it?
  2. Where does the permission check sit: in the prompt, in your code or in the systems that receive the calls?
  3. What can the agent do after it has read a file or an email from someone outside the company?
  4. Which of our data may the model see, and which may it not see?
  5. How do you measure that the agent gets it right, and do you report outcome and path separately?
  6. Where do the test cases come from, and how many of them are our own exceptions?
  7. Which checks are done by ordinary code, and which by a second model?
  8. If several agents work in the same workflow: who may write what, and what happens when a call is repeated after an interruption?
  9. How are prompts and model choices version-controlled, and who approves a release?
  10. What is logged, where are the logs kept, and can we read them without you?

Start with questions 1 and 5. If the supplier cannot answer those concretely, the choice of model matters little.

Sources

  1. Swedish Cybersecurity Act (Cybersäkerhetslag (2025:1506)) Chapter 2, Section 3, second paragraph, points 4, 5 and 9; transitional provisions, point 1
  2. MCFFS 2026:11, regulations and general advice on security measures and management training for essential and important entities (föreskrifter och allmänna råd om säkerhetsåtgärder och ledningens utbildning för väsentliga och viktiga verksamhetsutövare) Chapter 4, Section 1, second and third paragraphs; entry into force 1 October 2026
  3. OWASP Top 10 for LLM Applications 2025, LLM06:2025 Excessive Agency The introduction (root cause) and the sections Common Examples of Risks (Excessive Functionality, Excessive Permissions, Excessive Autonomy) and Prevention and Mitigation Strategies (Minimize extensions, Avoid open-ended extensions, Minimize extension permissions, Require user approval, Complete mediation)
  4. OWASP Top 10 for LLM Applications 2025, LLM01:2025 Prompt Injection The sections Types of Prompt Injection Vulnerabilities (Indirect Prompt Injections) and Prevention and Mitigation Strategies, points 4 to 7
  5. Anthropic, Building effective agents The section When (and when not) to use agents (simplest possible solution first) and Appendix 2: Prompt engineering your tools (the model responds with a tool call), published 19 December 2024
  6. Microsoft Learn, Foundry Models lifecycle and support policy The sections Lifecycle stages and Lifecycle timeline commitments, page updated 24 July 2026

Would you rather have someone do the maths on your own workflow than read about it?

Book 20 minutes

More articles.

See all articles
Engineering

AI agents: the basics

10 min read

What an AI agent is, what surrounds the model, where the permissions should sit and what the agent must never be able to do, whatever it reads.

Engineering

AI agents: beyond the basics

11 min read

What it takes for an agent that works in a demo to hold up in production as well, and what you should ask the supplier to show before it is allowed to run with no one watching.