← 回到 Reading
ByteByteGo 2026-09-30

How DoorDash Built a Toolbox for AI Agents

語言模型缺乏原生存取外部系統(如 code repositories、incident reports 及 production logs)的能力,因此需要稱為 tools 的軟體整合。AI agent 則是一種利用語言模型來選擇並執行這些 tools,進而編排多步驟任務的應用程式。Tool 的輸出會迭代地回饋給模型,以引導後續的 reasoning 和 actions。Tools 同時涵蓋唯讀操作(read operations)與會變更狀態的寫入操作(write operations),讓 DoorDash 這類的企業能將 agents 連接到內部系統、技術文件以及第三方服務。Model Context Protocol (MCP) 標準化了 AI agents 與外部 tools 之間的功能探索(capability discovery)與調用(invocation),但並未解決更高層級的企業治理問題。像 DoorDash 這樣的公司必須在各種不同的 agent workflows 中管理 access control、credential handling 與 operational monitoring。為了防止工程團隊之間出現重複且零碎的整合,DoorDash 確立了三大核心需求:access、tool-surface curation 與 operations。Agent Gateway 將這些職責整合至單一平台,以可靠地治理 tool interactions。DoorDash 的 Agent Gateway 架構透過將 Model Context Protocol (MCP) requests 路由至下游的 MCP servers 來控制 agent 存取。該 gateway 仰賴兩個核心架構元件:位於 data plane 的 proxy,以及位於 control plane 的 registry。Proxy 負責處理即時流量,包括驗證 callers、強制執行 permissions 與 rate limits、注入 credentials 以及記錄 audit information。Registry 則作為 source of truth,儲存由工程團隊管理的 metadata、tool catalogs、policies 和 connection settings。為了維持明確的 trust boundaries,DoorDash 將內部與對外的 proxy planes 進行區隔,同時共享統一的治理概念與函式庫。

閱讀原文 ↗
目錄 11 段
  1. 01為什麼 AI Agent 需要 Tools
  2. 02為什麼 MCP 還不夠
  3. 03Agent Gateway 的核心元件
  4. 04驗證是誰在呼叫以及他們能做什麼
  5. 05為什麼識別 Caller 與提供 Credential 是兩回事
  6. 06使用者如何在 Tool Call 期間連結帳號
  7. 07為什麼 Agent 應該只看到精選的 Tool Catalog
  8. 08Discovery 與 Execution 階段會發生什麼事
  9. 09理解請求(Request)發出後發生的事情
  10. 10讓平台更易於被各團隊採用(Adopt)
  11. 11DoorDash 下一步計畫改進的方向

為什麼 AI Agent 需要 Tools

語言模型缺乏原生存取外部系統(如 code repositories、incident reports 及 production logs)的能力,因此需要稱為 tools 的軟體整合。AI agent 則是一種利用語言模型來選擇並執行這些 tools,進而編排多步驟任務的應用程式。Tool 的輸出會迭代地回饋給模型,以引導後續的 reasoning 和 actions。Tools 同時涵蓋唯讀操作與會變更狀態的寫入操作,讓 DoorDash 這類的企業能將 agents 連接到內部系統、技術文件以及第三方服務。

  • 語言模型本身不具備存取外部系統(如 code repositories、incident reports 或 production logs)的能力。
  • AI agent 被定義為一種使用語言模型來決定任務中應執行哪些 tools 與步驟的應用程式。
  • Host application 會執行模型所選取的 tool,並將輸出回傳以進行後續的 reasoning。
  • Tools 可以執行唯讀操作(例如搜尋文件),或是會修改外部系統的寫入操作(例如建立 pull request)。
  • DoorDash 的 agent 功能來源涵蓋內部服務、工程系統、文件平台以及第三方軟體。

為什麼 MCP 還不夠

Model Context Protocol (MCP) 將 AI agent 與外部 tool 之間的能力探索(capability discovery)與調用(invocation)標準化,但它並未解決更高層級的企業治理(enterprise governance)問題。像 DoorDash 這樣的公司必須在各個不同的 agent workflow 中管理 access control、credential handling 和 operational monitoring。為了避免各工程團隊之間出現重複且零碎的整合,DoorDash 定義了三個核心需求:access、tool-surface curation 和 operations。Agent Gateway 將這些職責整合進一個統一的平台,以可靠地治理 tool 的互動。

  • Model Context Protocol (MCP) 提供了共通介面,透過 tools/list 探索功能,並透過 tools/call 進行調用。
  • MCP 並未強制執行企業特有的規則,例如 identity、credential management、access permissions 或 operational monitoring。
  • 去中心化的 tool 整合會導致工程團隊在 secret handling、OAuth flows 與 usage logging 方面付出重複的努力。
  • DoorDash 將 agent tool 治理歸納為三個主要面向:Access、Tool-surface Curation 與 Operations。
  • Agent Gateway 將 access control、tool filtering 和 production operations 集中到一個共享的企業級平台中。

Agent Gateway 的核心元件

DoorDash 的 Agent Gateway 架構藉由將 Model Context Protocol (MCP) 請求路由至下游 MCP server 來控制 agent 的存取。此 gateway 仰賴兩個核心架構元件:位於 data plane 的 proxy,以及位於 control plane 的 registry。Proxy 負責處理即時流量,包括驗證 caller、強制執行權限與 rate limit、注入 credential 以及記錄 audit 資訊。Registry 則作為 source of truth,儲存由工程團隊管理的 metadata、tool catalog、policy 與連線設定。為了維持明確的信任邊界(trust boundaries),DoorDash 將內部與對外的 proxy plane 進行區隔,同時共享統一的治理概念與函式庫。

  • Agent Gateway 作為中介層,負責控制存取並將來自 agent 的 MCP 請求路由至下游 MCP server。
  • 該 gateway 由兩個主要元件組成:proxy (data plane) 與 registry (control plane)。
  • Proxy 負責處理即時流量任務,包括 caller 驗證、權限檢查、rate limiting、credential 附加以及 audit logging。
  • Registry 作為 source of truth,保存配置、agent 與 MCP server 詳細資訊、tool catalog 以及 access policy。
  • DoorDash 將內部 workflow 與外部 use case 切分到不同的 proxy plane,以維持獨立的 trust boundary,同時保留共享的治理概念。

驗證是誰在呼叫以及他們能做什麼

DoorDash 的工程團隊打造了仰賴 authentication(身份驗證)與 authorization(授權)來控制 agent 互動的 Agent Gateway。Authentication 確立 caller 的身份,而 authorization 則評估細粒度的 context,包括 user、agent、請求的 tool 以及 environment。該系統會區分唯讀(read-only)與管理權限(administrative capabilities),而非授予寬鬆的完整 server 存取權。透過將身份傳遞至下游並集中化 security policy,gateway 讓開發者不再需要將 authorization 規則寫入 prompt 或各別 tool 中。

  • Authentication 負責識別 caller 是 user、service,或是代表 user 行事的 agent。
  • Gateway 中的 authorization 提供細粒度的控制,而非對整個 MCP server 提供粗粒度的存取權限。
  • DoorDash 的 Agent Gateway 會考量多種 context,包括 agent、user、tool、environment 以及 read 與 write 權限的差異。
  • Caller identity 在整個 request routing 與使用記錄過程中都會被保留,以實現下游歸因(attribution)。
  • 將 access control 集中化可避免開發者在 prompt 中編寫安全檢查,或在各 tool 之間重複實作 authorization 邏輯。

為什麼識別 Caller 與提供 Credential 是兩回事

在 DoorDash 的 agent gateway 架構中,caller identification 與下游服務所需的 credential 是解耦的。Gateway 實作了 credential injection,在轉發請求前附加適當的 credential,而不是讓 agent 直接持有原始 API key 或 token。該架構支援四種 credential model:Internal Service Identity、Gateway-held Token、Per-user OAuth 以及 Service Principal。這種做法將 secret 儲存、credential rotation、auditing 與 revocation 集中在 AI agent 之外管理。

  • 進入 agent gateway 的 caller identity 在功能上與外部系統所需的下游 credential 是截然不同的。
  • Credential injection 是指 gateway 在不將 secret 暴露給 agent 的情況下,將必要的 secret 附加至外發請求(outgoing request)的過程。
  • Internal Service Identity 將 DoorDash 驗證過的 caller context 直接傳遞給內部的 microservices。
  • Gateway-held Tokens 將 vendor 和 service keys 儲存在 gateway 的 secret storage 中,防止 agent 接觸到原始 secret。
  • Per-user OAuth 讓 gateway 能夠為外部服務安全地儲存、inject 並 refresh 使用者委派的 token。
  • Service Principals 透過 gateway 管理的 identity,為軟體和團隊自動化提供短效 credentials。
  • 將 credentials 集中在 gateway 中,提供了一個單一位置來管理、rotate、audit 和 revoke access keys。

使用者如何在 Tool Call 期間連結帳號

代表特定使用者執行的 tool 需要授權,通常透過 OAuth access token 與 refresh token 處理。DoorDash 的 agent gateway 集中管理各產品團隊的使用者連線流程與加密 token 儲存。當缺少授權時,gateway 會發起 OAuth 流程,並可選用 MCP elicitation 暫停請求,同時讓使用者透過瀏覽器提示進行授權。對於不支援 elicitation 的 client,gateway 則提供帶有連線 URL 的結構化回應以進行復原。

  • OAuth 提供用於授權 API 呼叫的 access token,以及用來替換過期 token 的 refresh token。
  • DoorDash 的 agent gateway 集中管理連線流程與加密 token 儲存,取代了各產品團隊個別的實作。
  • 對於支援 MCP elicitation 的 client,gateway 會暫停 tool 請求、提示使用者在瀏覽器中授權、安全儲存 token,並恢復呼叫。
  • 在 OAuth elicitation 過程期間或之後,agent 都不會接收到原始的使用者 credentials。
  • 不支援 MCP elicitation 的 client 會收到包含授權連線 URL 的結構化錯誤回應。

為什麼 Agent 應該只看到精選的 Tool Catalog

讓 agent 面對整個 server catalog 會引入不必要的選擇與複雜描述,進而降低效能。為了改善此問題,DoorDash engineering 使用 bundle 與 filter 來公開較小且針對特定任務的 catalog。Bundle 將跨多個 Model Context Protocol (MCP) server 的 tool 整合至單一 endpoint,而 filter 則根據 agent 或環境條件選擇性地公開經過核可的能力。Gateway 還能透過標準化描述以及為重複的 tool 名稱加入 namespacing 來提升可用性。

  • 提供過於龐大的 tool surface 會產生不必要的選擇,迫使模型解析更多描述並在相似的 tool 之間做區分。
  • DoorDash engineering 僅公開針對當前執行任務量身打造、較小且高度相關的 tool catalog。
  • Bundle 將跨多個 MCP server 的 tool 整合至單一邏輯 MCP endpoint 位址。
  • Filter 會根據 bundle、agent、user group、環境或受眾,控制哪些 tool 會出現在介面中。
  • Agent gateway 可以套用 namespacing 和 alias 來解決跨多個 tool server 的名稱重複問題。

Discovery 與 Execution 階段會發生什麼事

Tool discovery 與 tool execution 發生在不同階段,且需要各自獨立的驗證與 policy 檢查。在 discovery 期間,agent 向 gateway 發出 tools/list 請求,gateway 會對下游 server 使用 fan-out 來組合、過濾並回傳聚合後的 catalog。在 execution 階段,agent 發出 tools/call 請求,促使 gateway 重新評估 policy、實施 rate limit、注入 credentials,並路由至正確的 server。此架構讓 agent 無需自行管理下游 server 的路由或特定 provider 的 credentials。

  • Discovery 控制哪些 tool 會顯示在 catalog 中,而 invocation 則控制執行是否被允許。
  • 出現在 discovery 回應中的 tool,在 execution 階段仍需要獨立的授權。
  • 在 discovery 期間,gateway 利用 fan-out 查詢多個下游 server,並將它們的 tool 統一彙整為單一 catalog。
  • 在 execution(tools/call)期間,gateway 負責管理授權、rate limit、server 路由以及 credential 注入。
  • agent 僅與 gateway 進行互動,完全無需在 client-side 進行 routing 或 credential 管理。

理解請求(Request)發出後發生的事情

Observability 讓團隊能夠監控並理解多個 agent 與各類 tool 互動的系統。Gateway 位於所有 tool call 的路徑中,能擷取包含 identity、timing、error 和 payload size 等 metadata 的 structured event。它還匯總了關於 request count、latency、authorization decision 以及 downstream failure 的 metrics。這些 telemetry 資料讓 platform、security 和 tool 團隊能夠 audit 存取、診斷問題並分析 adoption 狀況。

  • Observability 是指透過執行中系統所產生的資訊來理解該系統的能力。
  • 由於所有 tool request 都會經過 gateway,它便成為記錄 telemetry 的中心元件。
  • Gateway 會記錄包含一致 metadata 的 structured event,涵蓋 server、tool、bundle、owner、identities、status 與 timing。
  • Gateway 產生的 metrics 匯總了跨 request 的行為,包括 request count、tool response time、OAuth refresh 結果以及 rate-limit decision。
  • Observability 資料為不同的企業角色提供支援:security 團隊 audit 存取權限、platform 團隊調查 agent 行為,而 tool owner 則追蹤 adoption 與 failure 情況。

讓平台更易於被各團隊採用(Adopt)

DoorDash 透過提供 self-service 管理介面與 API,促進其 centralized agent gateway 在內部的廣泛採用。各團隊註冊 Model Context Protocol (MCP) server,讓平台能在團隊設定 approval、ownership、authentication 與 access policy 之前,透過 tools/list 探索各種 capability。打包成 bundle 的 tool 會持續受到監控,包括 latency、failure rate、authorization decision 與 cost。該 gateway 現已成為 DoorDash 工程團隊的預設存取途徑,管理著超過 200 個 MCP server 以及每週數百萬次的 tool call。

  • DoorDash 提供 self-service UI 與 API,用於在其 centralized gateway 上註冊與設定 MCP server。
  • 平台透過 tools/list 探索原始 tool catalog,且必須經過明確的 approval 與 access policy 設定後才能使用這些 tool。
  • Capability 會與 ownership metadata 綁定並打包成 bundle,以落實維運當責(operational accountability)與 policy enforcement。
  • 一旦 agent 開始使用 bundle,團隊便能監控 tool traffic、response time、execution failure、authorization decision 與 cost metrics。
  • 該 gateway 託管了超過 200 個註冊的 MCP server,並處理 DoorDash 全公司每週數百萬次的 tool call。

DoorDash 下一步計畫改進的方向

DoorDash 正在規劃未來對其 centralized AI agent-tool gateway 架構的改進。重點規劃領域包括利用 cryptographic identity 和 short-lived scoped credential 來強化 agent identity 與 user delegation。該公司也正在開發基於 task、access policy 與 usage signal 的 dynamic tool discovery,以提供與 context 相關的 capability。其他增強功能則針對 tool quality 與 security evaluation,例如偵測敏感資料、簡化 server registration 以及串流經過脫敏(redacted)的 tool-call event。

  • DoorDash 計劃使用 cryptographic identity 以及針對 user、agent、task 和 target tool 限定 scope 的 short-lived credential,來實現 agent identity 與 user delegation。
  • Dynamic tool discovery 將根據當前的 task、access policy 與 usage signal,動態微調 tool 的選擇。
  • DoorDash 打算改進 tool evaluation,以偵測有風險的 description 以及 error 中像 secret 或 PII 等敏感資訊。
  • 該平台的目標是簡化 tool server 的建立與註冊,同時提供經脫敏處理(redacted)的 tool-call event stream。