Updated · Markdown

How AI agents should hold secrets and sign in to tools

Updated 2026-11-29. Written by the team that builds Tex, so weigh it accordingly.

Short answer: don't put long-lived tokens where the agent can read them. Store them outside the sandbox and add them to each request on the way out, so a hijacked agent has nothing to copy. And give each agent a stable identity for its tools: one account, connected once, used on every run, rather than borrowing whoever happened to start it.

Two decisions

Where the secret lives. Environment variables and files inside the sandbox are easy, but anything the agent can read, a prompt injection can make it print or send. Safer is a proxy outside the sandbox that holds the secret and adds it to requests the agent makes.

Whose account the agent uses. If an agent uses the account of whoever messaged it, the same agent behaves differently depending on who asked, and it is hard to tell what it can do. A stable identity per agent is easier to reason about, audit and revoke. We wrote up how we got there in Whose account should an agent use?

How Tex does it

Questions people ask

Which services connect? Tex has run agents end to end against GitHub (gh and git) and against Notion, Linear, Sentry, Stripe, Airtable, GitLab, Vercel, Supabase and PostHog as MCP servers. Other MCP servers can be added by address.

Can the agent still misuse a tool it has? It can use the tool within what the account allows. Limit the account, hold risky tool calls for approval, and set a tool's policy to never for what it should not do.

What Tex doesn't do

Try Tex with $10 of free credit