Verb
Back to blog
Identity2 min read

Can an AI agent act as the signed-in user?

Why an in-app agent should act as the signed-in user, how it gets their identity, and the shortcut to avoid.

Quick answer

Yes, and for an agent inside your product it is the safest way to run one. The agent calls your product's existing API with the signed-in user's own session or token, so your permission checks, validation and audit trail apply to every action, exactly as if the user had clicked. What to avoid is the shortcut: a shared admin key or direct database access, which lets the agent do things the user could not.

Yes. And if the agent lives inside your product and does things for your users, acting as the signed-in user is not just possible, it is the design to insist on. Everything else about safety gets easier once it is true.

What "acting as the user" means

When a user asks the agent to do something, the agent calls your product's own API, the same one your screens use, carrying that user's session or token. To your API, the request looks like the user clicked a button. So:

  • Your permission checks apply. A viewer cannot delete; a user in one account cannot see another.
  • Your validation applies. The same rules that stop a bad form submission stop a bad agent request.
  • Your audit trail applies. Every change carries the name of the person who asked for it.

Nothing new has to be built to make the agent safe at the data layer, because the agent never gets more access than the person it is helping.

The shortcut to avoid

The tempting alternative is to give the agent a service account: one admin API key, or a direct database connection, and trust the model to only do what the user is allowed to. That trust is the problem. A user can ask for another customer's records, or word a request to trick the model, and with an admin key nothing below the model says no. You would be relying on a prompt to enforce permissions your API already enforces.

How the agent learns who the user is

The page the agent runs on already has a signed-in user. Your backend vouches for that user to the agent, with a short-lived signed token, and the agent attaches the user's credentials to every call it makes. The details vary by product: a session cookie, a bearer token, an OAuth grant. The rule does not: the identity comes from your product, never from what the user types into the chat. Identifying the signed-in user in an embedded assistant covers the mechanics, and what happens at sign-out covers the case most teams miss.

Acting as the user is not doing everything the user can

Two more limits sit on top:

  • Only the actions you choose. You decide which of your product's actions the agent may use at all. A user may be allowed to close their account; the agent does not have to be.
  • Changes wait for a yes. Looking things up can run straight away. Anything that changes data should stop on a confirmation showing the real values, so the user decides, not the model. Confirming destructive actions goes deeper.

This is how Verb, which I build, works: it acts as the signed-in user through your existing API, uses only the actions you allow, and asks before anything changes.

Frequently asked questions

How does an AI agent know who the user is?

Your product tells it. The page the agent runs in already has a signed-in user; your backend passes the agent a short-lived proof of who that is, and every action the agent takes is sent to your API with that user's credentials.

Why not give the agent an admin API key?

Because then the agent can do anything, for anyone. A user could ask it for another customer's data and the API would agree. With the user's own credentials, your existing permission checks refuse that, and every change is logged under the person who asked.

Does acting as the user mean the agent can change anything they can?

Only what you allow. You choose which of your product's actions the agent may use at all, and changes to data should wait for the user to confirm the real values before they run.

Vishnu

Vishnu, founder of AskVerb @itsvishnups

Building the AI agent that lives inside a SaaS product and does the work its users ask for. Writing down what I learn along the way, including the parts I got wrong first.

More articles

Give your SaaS its own AI agent

It calls your own API as the signed-in user, confirms before it changes anything, and logs every action. Start with a free 30-day pilot, then we price it on what it actually does for your users.