Skip to content

Build an agent that acts as the user

An agent with one service account can see more than the person asking. Run the calls that should be personal on the asking user's own credentials.

Last reviewed November 2026

App, built with Tray Helix

The short answer

On Tray Helix, an agent acts as the user through Agent Gateway. Its tools run as governed MCP tools in Agent Gateway, and each tool's Dynamic Authentication can be set to user-provided, so the call runs on the asking user's own credentials when it should. Tools that don't need it keep the app's service credentials. The activity log shows which credentials each call used.

sales-assistant.helix-app.ai

Sales Assistant

Tool call Runs through Credentials used Result
search_my_files Agent Gateway Maya Lin (user-provided) 4 files Maya can open
get_price_book App tool App service credentials Current price book
update_opportunity Agent Gateway Maya Lin (user-provided) Waiting for approval
A sketch of one run's activity log. Each call shows whose credentials it used, so the personal calls and the app's calls are easy to tell apart.

What matters here

  • A Tray Helix agent acts as the user through Agent Gateway, with each tool's Dynamic Authentication set to user-provided.
  • A user-provided tool runs on the asking user's own credentials, so the agent sees and changes only what that person can.
  • Not every call needs to be personal: tools that read shared reference data can keep the app's service credentials.
  • The activity log shows which credentials each call used, so an audit can tell the user's actions from the app's.
  • Writes still wait for approval, even when they run as the user.

Who this is for

You are building an agent for a team whose systems have per-person permissions, such as a CRM, a file store or a ticketing tool. You need the agent to respect those permissions, not flatten them into one service account.

How it works in practice

One request, and the credentials each call uses.

  1. 1

    A user asks the agent

    "Find the latest proposal for Northwind and move the opportunity to negotiation."

  2. 2

    Personal reads run as them

    search_my_files runs through Agent Gateway with user-provided auth, so it finds only files this user can open.

  3. 3

    Shared reads use the app

    get_price_book reads reference data everyone may see, on the app's service credentials.

  4. 4

    The write waits for approval

    update_opportunity is marked for approval. After approval it runs as the user, so the CRM records them as the editor.

  5. 5

    The log tells them apart

    The activity log shows each call, where it ran and whose credentials it used.

What this agent is made of

Two kinds of tool, chosen one by one.

User-provided tools

Governed MCP tools in Agent Gateway with Dynamic Authentication set to user-provided. They run on the asking user's own credentials.

App tools

Tools in the app's code that use the app's service credentials, for data everyone may see.

Approval on writes

Every tool that changes data is marked for approval, whichever credentials it runs on.

An activity log

Each call, the route it took and the credentials it used, under the request that started the run.

The prompts

Paste these into Claude Code, Codex or Cursor in order. Each one leaves you with something that runs, so you can stop after any step.

These prompts start from a Helix project, which is what handles sign-in, credentials and hosting. Start with Helix.

1

The assistant app

Where people ask and approve.

Claude Code, Codex or Cursor

Create a Helix app: a sales assistant agent for account executives.

People ask in plain language about their accounts and opportunities. Store each conversation per user, and show a list of actions waiting for approval.

On each run, show an activity list: each tool call, whether it ran through Agent Gateway or in the app, and which credentials it used.

2

Two kinds of tool

Personal where it should be, shared where it can be.

Claude Code, Codex or Cursor

Add an agent to the app with these tools.

These call our Agent Gateway MCP server and run as the asking user:

- search_my_files: search Google Drive for files.

- get_my_opportunities: read the user's opportunities in Salesforce.

- update_opportunity: change stage, amount or close date.

This one is an app tool on the app's service credentials:

- get_price_book: read the current price book.

Mark update_opportunity as needing approval every time.

Which tools run as the user is set per tool in Agent Gateway, with Dynamic Authentication set to user-provided. Choose it for anything with per-person permissions.
3

Connect it to real systems

Agent Gateway for the personal calls.

Claude Code, Codex or Cursor

Now connect it to the systems we actually run.

Anything in angle brackets is a placeholder. Swap it for whatever we use.

<Agent Gateway>. Our MCP server with the Salesforce and Google Drive tools.

<Snowflake>. Read the price book on the app's service credentials.

Only write through update_opportunity. Everything else is read only.

In Agent Gateway, set Dynamic Authentication on the Salesforce and Google Drive tools to user-provided. The app's own credentials are held by Tray as workspace authentications.
4

Ship it

A URL, and the team on it.

Claude Code, Codex or Cursor

Deploy my app.

Your assistant runs helix deploy and the app comes back as a URL. Put SSO in front of it, so the app knows who is asking.

What it connects to

The tools that should be personal run through Agent Gateway. The rest stay in the app.

Named systems are the ones most teams actually run, not a list of the only ones that work. Swap in whatever you use.

Running it for real

The build gets you a working agent. Running it means each call uses the right credentials and the log proves it.

  1. 1

    Deploy the app and its agent together

    One command, or Deploy from CI on every merge, takes the app to a live URL. The agent ships with its app, so you can roll back any deployment.

  2. 2

    Calls on the user's credentials, when they should

    Tools set to user-provided in Agent Gateway run as the asking user. Tools that don't need it use the app's service credentials.

  3. 3

    Approval on every write

    update_opportunity waits for a person, even though it runs as the user. The approver sees the tool and the exact input.

  4. 4

    A log that shows whose credentials

    The activity log shows which credentials each call used. Agent, workflow and audit logs stream to your SIEM.

  5. 5

    Know what the assistant costs

    AI usage shows per app, so the agent's cost sits next to the work it did.

Questions people ask

Can a Tray Helix agent act as the user who asked?

Yes, when the call should. Route the tool through Agent Gateway and set its Dynamic Authentication to user-provided, and the call runs on the asking user's own credentials. Tools that don't need it use the app's service credentials, and the activity log shows which.

Does every call run as the user?

No, and it shouldn't have to. You choose per tool. Personal data, such as a user's files or opportunities, runs as the user. Shared reference data, such as a price book, can run on the app's credentials.

Why does this matter for security?

An agent on one service account can see everything that account can, which is often more than the person asking. Running personal calls as the user keeps the agent inside that person's permissions in the source system.

Do writes still need approval?

Yes. Approval is separate from credentials. A write marked for approval pauses the run whoever it runs as.

Build it, then run it properly

Helix is the governed runtime for AI-built apps and agents. Deploy what you build, put SSO in front of it, connect it to your systems with managed credentials, and give it a named owner.