---
topic: system-design
author: Crashtech Editorial
published: Sep 30, 2026 · read: 4 min
---

Inside DoorDash's Unified AI Agent Tool Gateway: Security, Credential Injection, and Curation

How enterprise platform engineering teams build a centralized tool gateway that manages agent identity, per-user OAuth tokens, rate limits, and audit logs.

– –

When software engineers first experiment with AI agents, tool integration is trivial: the developer hardcodes an internal API key into the script, defines a JSON schema for two functions, and passes them to the LLM.

In a massive enterprise with thousands of engineers, hundreds of microservices, and dozens of internal AI agents, this ad-hoc approach creates an operational disaster. If every agent harness connects directly to internal services with static API keys, security teams lose visibility into who authorized what action. An agent running on behalf of an intern might inadvertently call an endpoint that modifies customer financial balances.

To solve this, enterprise teams at companies like DoorDash, Uber, and Salesforce deploy a Unified Tool Gateway. The gateway acts as an intelligent API proxy, decoupling tool discovery and invocation from underlying credential management, authentication, and execution policies.

The Triad of Enterprise Tool Management

Building a production agent platform requires resolving three distinct engineering concerns:

+-----------------------------------------------------------------------------+
|                      THE ENTERPRISE TOOL PROBLEM TRIAD                      |
+-----------------------------------------------------------------------------+

 1. Identity & Access Control
    - Who is the human principal? What are the agent's delegated rights?
    - How do we inject credentials without exposing raw secrets to the LLM?

 2. Catalog Curation & Discovery
    - An enterprise has 10,000 APIs. Feeding all schemas into an LLM exhausts 
      context windows and triggers tool-selection confusion.
    - How does an agent find only the 5 tools relevant to its specific goal?

 3. Traffic Operations & Resilience
    - What happens when an agent enters a loop and hammers an API 500 times?
    - How do we enforce rate limits, circuit breakers, and immutable audit logs?

Protocols like Anthropic’s Model Context Protocol (MCP) standardize the client-to-server wire format (tools/list and tools/call). However, MCP alone does not solve corporate security policies, per-user OAuth token refresh cycles, or multi-tenant network firewalls. That is the responsibility of the gateway.

The Dual-Plane Architecture: Data Plane vs Control Plane

A resilient tool gateway splits operational concerns into a high-throughput Data Plane and a centralized Control Plane:

+-----------------------------------------------------------------------------+
|                        UNIFIED TOOL GATEWAY TOPOLOGY                        |
+-----------------------------------------------------------------------------+

 [Agent Harness / Model Run]
             |
             | 1. POST /v1/tools/call (Payload + Session JWT)
             v
 +---------------------------------------------------------------------------+
 |                              DATA PLANE PROXY                             |
 |                                                                           |
 |  [Caller Identity & Policy Check] ---> Rejects unauthorized tool calls    |
 |                |                                                          |
 |  [Credential Vault Injector]     ---> Swaps Session JWT for Target Secret |
 |                |                                                          |
 |  [Circuit Breaker & Rate Limiter] ---> Throttles recursive loop spam      |
 |                |                                                          |
 |  [Audit Log Emitter]             ---> Writes immutable event to Kafka     |
 +---------------------------------------------------------------------------+
             |
             | 2. Forward Authorized Request (mTLS + Injected Service Token)
             v
 +---------------------------------------------------------------------------+
 |                        INTERNAL ENTERPRISE SERVICES                       |
 |                                                                           |
 |  [Order Service]      [Inventory Database]      [Driver Logistics API]   |
 +---------------------------------------------------------------------------+
             ^
             | Synchronizes Tool Catalogs & RBAC Policies
 +---------------------------------------------------------------------------+
 |                            CONTROL PLANE REGISTRY                         |
 |  - Service Ownership Directory      - Dynamic Tool Discovery Index        |
 |  - OAuth Token Exchange Service     - Policy & Quota Configuration        |
 +---------------------------------------------------------------------------+

The Data Plane Proxy

The data plane is an ultra-low-latency reverse proxy (built in Go, Rust, or Envoy) that intercepts every tool call:

  1. Context Validation: Reads the incoming authorization header to identify both the invoking agent and the human user who triggered the session.
  2. Policy Evaluation: Checks the enterprise Policy Decision Point (e.g., Open Policy Agent) to verify that the caller is authorized to invoke update_delivery_address.
  3. Secret Injection: The LLM never sees internal credentials. The proxy dynamically retrieves the target service’s secret or OAuth access token from HashiCorp Vault or an in-memory token cache and injects it into the outbound request header.
  4. mTLS Forwarding: Forwards the request across the internal VPC network via mutual TLS.

The Control Plane

The control plane manages metadata and lifecycle:

  • Semantic Tool Indexing: Indexes all available enterprise APIs using vector embeddings. When an agent starts a task (“Resolve customer complaint regarding missing order items”), the agent queries the control plane, which retrieves only the top 6 most relevant tool definitions, preventing context window pollution.
  • Service Registration: Microservice teams publish new tools by submitting an OpenAPI or MCP spec to the registry, defining required permissions, SLAs, and ownership tags.

Handling Per-User OAuth Delegation

One of the thorniest challenges in agent tool architectures is executing actions on services that require end-user permissions rather than a broad service-to-service credential (e.g., modifying a user’s personal Google Calendar or private Slack channel).

The gateway orchestrates the OAuth On-Behalf-Of Flow:

[Agent] ---> Request: create_calendar_event
                 |
                 v
[Tool Gateway] ---> Checks token cache for User #441
                 |
                 +---> (Token Missing or Expired)
                 |
                 v
[Gateway Emits Structured Elicitation Response]
HTTP 401 Unauthorized
{
  "status": "AUTH_REQUIRED",
  "auth_url": "https://auth.company.com/oauth/authorize?client_id=...",
  "session_token": "sess_88921a"
}

When an agent receives this structured challenge, it halts execution and renders an authorization link to the human user. Once the user authenticates in their browser, the gateway stores the encrypted refresh token and notifies the agent harness to resume its tool call.

Observability and Loop Prevention

Autonomous agents are prone to infinite loops when encountering unexpected API errors (e.g., calling get_order_status 40 times in 10 seconds because the response was empty).

The tool gateway provides operational defense:

  • Token Bucket Rate Limiting: Caps tool invocations per agent session, per user, and per microservice.
  • Cycle Detection: Analyzes the hash of incoming tool calls. If an agent calls the exact same tool with identical parameters three times in a row without making progress, the gateway trips a circuit breaker and returns a synthetic error instructing the model to revise its plan.
  • Comprehensive Audit Trails: Every request payload, response status, execution duration, and injected credential ID is published to an immutable Kafka audit stream for compliance and security auditing.

Architectural Takeaway

Do not allow AI agents to connect directly to internal microservices with hardcoded credentials. Scalable enterprise AI infrastructure requires:

  • Centralizing all tool discovery, authentication, and execution behind a dedicated Data Plane Tool Gateway.
  • Ensuring the LLM never touches raw corporate credentials by using dynamic proxy-level secret injection.
  • Dynamically curating tool catalogs using semantic search to prevent context window bloat.
  • Implementing cycle detection, session rate limits, and immutable audit logs to protect downstream infrastructure from errant agent loops.
Advertisement

/* Comments */