Back to Notes

Security

Secure agents at work

An agent is safe to use when the things that must not go wrong are decided by fixed rules and by a named person, not by the agent. What that means for coding agents, and for agents in the rest of a company.

Nils Widal · · 7 min read

Companies now let AI agents do real work. Engineers hand them tickets. Other departments will hand them reports, records and requests. This note is about one question: when is that safe? It has two halves, coding agents and agents for the rest of a company, under one idea.

An agent is safe to use when the things that must not go wrong are decided by fixed rules and by a named person, not by the agent.

What goes wrong

In March 2026 an engineer described a practitioner who had built a patient management app with an AI coding tool and put real patient data in it. The database had no access rules. Thirty minutes in, he had full read and write access to all patient data.

This is not one unlucky case. A security company scanned more than 5,600 public apps built this way. It found more than 2,000 weaknesses, more than 400 exposed secrets and 175 exposures of personal data, medical records among them. Another team listed the usual faults: the sign-in check runs in the browser, keys sit in the page's code, the database has no access rules per row, and internal apps are open to the internet. In a test of more than 100 models on 80 coding tasks, 45 percent of the code samples had a security flaw.

The tool matters too. OpenAI's guide says its consumer plans are not eligible for patient data, and that without a signed agreement the service may not be used with it. Anthropic's agreement covers its commercial products, and has to be turned on there.

Agents add one more risk. OWASP, an open group that publishes security standards, calls it excessive agency: an agent that can do more than its task needs, so a wrong or manipulated answer turns into a damaging action. The manipulation has a name too, prompt injection: text in a document or a web page that the agent reads as an instruction.

None of these cases needed a clever attacker. In each one, something that had to be decided was left to the tool, or to nobody.

What secure has to mean for an agent

Five questions cover it. For each one we say what Widal.Factory does today, and what is planned. Widal.Factory is our product for engineering teams. It is the part that runs today.

1. Where does it run? The agent, its data and its record should be in an account the company controls, and the model should be reached under the company's own agreement. Built: the factory and the hub are installed in your own AWS account. Each engineer's agents run on a machine of their own. The hub's admin chooses how the agents reach the model: each engineer's own Claude subscription, the company's Anthropic API key, or Amazon Bedrock in the company's AWS account. Today, agents that work on tickets run on the subscription only. Ticket work with the API key and with Bedrock is being added. Planned: Google Cloud and Azure.

2. What can it reach? An agent can only misuse what it holds. Built: an agent that works on a ticket gets no GitHub token. The factory holds the token, pushes the agent's branch and opens the pull request. Planned: rules in the hub for which tools each workflow may use.

3. Who can see its work? An agent's session shows code, data and the owner's sign-ins. Built: everyone you invite sees the hub's dashboard, and each person can open only their own factory's session. A hub admin cannot open someone else's. Every opening is written to a log the hub cannot erase. People with administrator rights in your AWS account can still reach a machine through AWS. That is yours to decide.

4. What may it do without a person? OWASP's advice is to require a person's approval for actions with high impact. Built: the agent proposes a change as a pull request and cannot merge it. A person reviews and merges, and with a protected main branch nothing reaches it another way. The factory does not deploy. Planned: approval gates for changes to production, and an AI reviewer that reads each change before the person does.

5. What is written down? After a problem, the company has to see what happened. Built: the hub keeps a log of events that is only ever added to. It refuses changes and deletions. The log holds no code and no prompts. Planned: an export of this record for audits.

Engineering and the other departments

Engineering starts with an advantage. It has had fixed checks for decades: tests, builds, code review, protected branches. An agent's work is code, and code can be tested by a script. The main risks are the ones above: an app that ships without access rules, and an agent with a key to production.

In other departments the work is a document, a record or a decision. A deviation record. A section of a submission. A prior authorization packet. Three things change.

  • The checks have to be written first. There is no test suite for a deviation record. Someone has to write the rule: every required field is filled, every statement cites a controlled source, the numbers match the source system.
  • A check cannot judge the content. A script can test that a reference points to an approved document. It cannot test that a medical or scientific conclusion is right. That stays with the person who signs.
  • The data and the sign-off are stricter. The agent reads patient data and controlled documents, and your procedures say who may approve what. So where the agent runs, and who signs, matter more.

The five questions stay the same. Agents for engineering teams run today. Agents for other departments are planned on the same base, and the hub for the whole company on our home page is a design. We say so on every page.

What to ask before agents do real work

  • In whose account do the agent, its data and its record live?
  • Under which agreement does the model see our data, and who chose it?
  • Which keys does the agent hold, and which does it never see?
  • Who can open an agent's session, and is each opening recorded?
  • Which actions need a named person, and is that enforced by access or only by an instruction?
  • Which checks run on every piece of work, and can the agent change them?
  • What does the record hold, and who can change or delete it?
  • Which of this is built today, and which is planned?

This note is not legal advice. Your quality and compliance teams decide how the rules apply to you.

Read next: how it works, regulated work, least access for AI agents and Widal.Factory for engineering teams.

Sources

  1. tobru.ch, An AI vibe coding horror story (March 2026)
  2. Escape, Methodology: 2k+ vulnerabilities in vibe-coded apps (October 2025)
  3. Wiz, Common security risks in vibe-coded apps (September 2025)
  4. Veracode, AI-generated code poses major security risks in nearly half of all development tasks (July 2025)
  5. OpenAI, HIPAA implementation and configuration guide (July 2026)
  6. Anthropic, Business associate agreements (BAA) for commercial customers
  7. OWASP, LLM06:2025 Excessive Agency
  8. OWASP, LLM01:2025 Prompt Injection

Tell us which work you want to hand off first.

Book a call