cd /news/ai-agents/stop-giving-ai-agents-your-api-keys-… Β· home β€Ί topics β€Ί ai-agents β€Ί article
[ARTICLE Β· art-90620] src=dev.to β†— pub= topic=ai-agents verified=true sentiment=Β· neutral

Stop Giving AI Agents Your API Keys: Introducing Trust Gateway (WIP)

A developer has introduced Trust Gateway, a work-in-progress security tool that decouples AI agents from the API keys they use to perform actions. The gateway evaluates proposed actions against policy and issues short-lived, cryptographically signed execution grants that executors independently verify, ensuring agents can propose but not directly execute sensitive operations.

read4 min views9 publishedAug 10, 2026

AI agents are getting increasingly capable at calling tools: issuing refunds, updating tickets, sending emails, modifying infrastructure, querying databases, and triggering deployment pipelines.

But there’s a security problem I kept coming back to:

Why should the agent itself possess the credentials needed to perform those actions?

If an agent has a Stripe key, GitHub token, cloud credential, or database password, then the security boundary is effectively inside the agent runtime.

I wanted to see if there was a cleaner way to decouple intent from execution, so I started building a small side project called Trust Gateway.

It’s very much a work in progress, and I’m sharing it early to get feedback from the community on the core design, hear how others are approaching this, and learn where it can be improved.

Trust Gateway separates proposing an action from having authority to execute it.

The model is simple:

Agents propose. Gateway decides. Executors verify.

Instead of giving an AI agent a downstream API key, the agent submits a structured ProposedAction

to the gateway.

The gateway evaluates that action against policy.

If it is allowed, the gateway issues a short-lived, cryptographically signed ExecutionGrant

bound to the exact tool and parameters that were approved.

The gateway dispatches the granted action to the appropriate executor. Before any side effect, the executor independently verifies the grant's signature, expiry, audience, tool binding, argument hash, and single-use nonce.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       ProposedAction       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  AI Agent  β”‚ ─────────────────────────▢ β”‚ Trust Gateway β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                            β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚
      No downstream credentials                 β”‚ GrantedAction
                                                β”‚ + ExecutionGrant
                                                β–Ό
                                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                        β”‚   Executor    β”‚
                                        β”‚ owns API key  β”‚
                                        β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚
                                                β–Ό
                                               API

The important part is that the executor does not trust the agent when it says:

β€œThis action was approved.”

It verifies the authorization itself.

Imagine an agent with a tool like:

stripe.refund(  
    payment_id="...",  
    amount=50000  
)

There are several possible policies you might want:

But even if you implement those policies inside your agent framework, the agent may still hold the credential that bypasses them.

Trust Gateway moves that authorization boundary outside the agent.

The agent can ask.

It cannot simply decide.

The Python SDK lets you guard a tool using a decorator:

from trust_gateway.client import TrustGatewayClient, guard_tool

client = TrustGatewayClient.dev_mode(  
    gateway_url="http://localhost:3060"
)

@guard_tool(client, "stripe_refund")  
def process_refund(amount: int, order_id: str):  
    return {  
        "status": "refunded",  
        "amount": amount  
    }

Now when an agent attempts:

process_refund(  
    amount=500,  
    order_id="ord_123"  
)

the function is not automatically executed.

Trust Gateway first evaluates the proposed action.

A policy can return something like:

require_approval

and no execution grant is issued until the required approval exists.

I wanted authorization to be independently verifiable, rather than just another HTTP response saying "approved": true

.

So Trust Gateway defines an Execution Authorization Protocol with:

ProposedAction

objects jti

nonces That means an authorization for:

{  
  "tool": "stripe_refund",  
  "amount": 500  
}

cannot simply be reused to execute:

{  
  "tool": "stripe_refund",  
  "amount": 50000  
}

The parameters are part of what is authorized.

I also wanted HITL to be a policy decision rather than the architecture itself.

Not every tool call should trigger a Slack message asking someone to click Approve.

For example:

search_docs β†’ allow

read_customer β†’ allow

send_email β†’ require approval

stripe_refund < $20 β†’ allow

stripe_refund >= $20 β†’ require approval

delete_database β†’ deny

The gateway can distinguish between routine actions and high-impact mutations.

You can run it locally with Docker:

git clone https://github.com/fcn06/trust_gateway.git
cd trust_gateway
docker compose -f deploy/docker-compose.yml up -d

Then install the Python SDK:

pip install -e sdks/python

There’s also a standalone Docker demo if you don’t want to install Rust.

Trust Gateway isn't intended to make an LLM itself trustworthy.

It also isn't a replacement for:

Instead, it addresses a narrower problem:

How do we let an autonomous or semi-autonomous agent request privileged actions without giving that agent unrestricted possession of the authority required to perform them?

That is the security boundary I'm exploring.

The project is still evolving, and I’m especially interested in feedback from people building:

I’d particularly love opinions on the protocol design and threat model.

GitHub:

https://github.com/fcn06/trust_gateway

If you're building agents that can do more than just generate text, I'd be curious:

Where do you currently put the authorization boundary between the model and the systems it can modify?

#ai #mcp #opensource #python

── more in #ai-agents 4 stories Β· sorted by recency
── more on @trust gateway 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/stop-giving-ai-agent…] indexed:0 read:4min 2026-08-10 Β· β€”