← 回到 Reading
ByteByteGo 2026-10-26

A Deep Dive into Salesforce’s Agent Tech Stack

使用單一 large prompt 來建構 AI agent 是一種常見的 naive design,它將 business rules、tool descriptions 與 context 混雜在一起,期望模型能遵守它們。這種做法期望語言模型能同時強制執行規則、檢索身分資訊、整合資料並約束行為。在實務上,隨著 instruction 數量增加,模型會顯得力不從心;例如,Salesforce 的 Agentforce 初版在超過 8 條 instruction 後,instruction adherence 就開始劣化。像 IFScale 這樣的研究基準印證了這項限制,顯示模型僅將 instruction 視為文字而非 hard constraints,因此在 prompt engineering 之外需要外部架構支援。Salesforce 透過將任務從 large language model prompts 卸載到其四層 platform stack 的專屬系統中,來提升系統可靠度。該架構包含 data layer (Data 360)、application layer (Customer 360)、agent layer (Agentforce) 以及 surface layer。專門的系統負責處理獨立任務,例如 Agent Script 強制執行商業邏輯,而 Agent Context Engine 則在資料送達模型前進行過濾。此設計將例行運作交給 deterministic 系統,讓模型只處理需要 reasoning 的任務。Agent Script 是 Salesforce 開發的開源、類似 Python 的 domain-specific language,用於在 LLM prompts 之外強制執行 deterministic agent 行為。透過將 agent 定義編譯為由 Atlas Reasoning Engine 執行的 Agent Graph,系統透過像 before_reasoning 和 after_reasoning 這樣的結構化區塊來保證規則的執行。這種架構將資料庫查詢等 deterministic 任務與語言模型的 reasoning 分離,大幅提升可靠度並避開 prompt instruction 的上限限制。

閱讀原文 ↗
目錄 8 段
  1. 01Naive design:單一 large prompt
  2. 02Agentforce 的構建方式
  3. 031. 透過 Agent Script 實現 Deterministic instructions
  4. 042. 透過 Data 360 打造 Unified profile
  5. 053. 透過 Agent Context Engine 獲取相關 context
  6. 064. 透過 Agent Identity 進行權限管理
  7. 07Agent 在何處運行
  8. 08未來展望

Naive design:單一 large prompt

使用單一 large prompt 來建構 AI agent 是一種常見的 naive design,它將 business rules、tool descriptions 與 context 混雜在一起,期望模型能遵守它們。這種做法期望語言模型能同時強制執行規則、檢索身分資訊、整合資料並約束行為。在實務上,隨著 instruction 數量增加,模型會顯得力不從心;例如,Salesforce 的 Agentforce 初版在超過 8 條 instruction 後,instruction adherence 就開始劣化。像 IFScale 這樣的研究基準印證了這項限制,顯示模型僅將 instruction 視為文字而非 hard constraints,因此在 prompt engineering 之外需要外部架構支援。

  • 單一 large prompt 期望模型同時強制執行規則、解析身分、管理 context 資料並約束執行行為。
  • Agentforce 的第一個版本採用 single-prompt 作法,並觀察到當 instruction 超過八個時效能會下降。
  • Model 不會將自然語言 instruction 視為嚴格規則,而僅僅當成沒有執行保證的 context token。
  • 隨著 prompt 複雜度與 instruction 數量增加,instruction-following 的效能會下降。
  • IFScale benchmark 顯示,即使是表現頂尖的 model,在單一 prompt 中放入 500 個簡單 instruction 時,也僅能遵循其中的 68%。

Agentforce 的構建方式

Salesforce 透過將 task 從 large language model prompt 卸載到其四層 platform stack 中的專屬系統,以提升系統可靠性。該架構由 data layer (Data 360)、application layer (Customer 360)、agent layer (Agentforce) 與 surface layer 組成。專門系統負責處理離散 task,例如由 Agent Script 強制執行 business logic,以及由 Agent Context Engine 在資料進入 model 前進行過濾。這種設計將常規操作委派給 deterministic 系統,使 model 只需處理需要 reasoning 的 task。

  • Salesforce 將其 platform 分為四個獨立層:data (Data 360)、application (Customer 360)、agent (Agentforce) 和 surface。
  • 與其依賴 monolithic prompt,不如由整個 stack 中的專屬系統處理離散 task,以提高整體可靠性。
  • Agent Script 是一種運行於 Agentforce layer 的 scripting language,旨在強制執行規則。
  • Agent Context Engine 是一個獨立系統,負責決定哪些 data 該傳遞給 model。
  • 核心 AI model 專門保留用於 reasoning 步驟,而非 operational execution 或 data retrieval。

1. 透過 Agent Script 實現 Deterministic instructions

Agent Script 是 Salesforce 開發的一款 open-source、類似 Python 的 domain-specific language,用於在 LLM prompt 之外強制執行 deterministic agent 行為。透過將 agent 定義編譯成由 Atlas Reasoning Engine 執行的 Agent Graph,系統能藉由 before_reasoning 和 after_reasoning 等結構化 block 來確保規則執行。此架構將 deterministic task(如 database lookup)與 language model reasoning 解耦,大幅提升可靠性並避開 prompt instruction 的上限限制。

  • 在 Agentforce 遇到 instruction 限制後,Salesforce 開發了 Agent Script,以便在 LLM prompt 之外以 deterministic 方式強制執行規則。
  • Agent Script 為 open source,且具備類似 Python 的語法。
  • Agent Script 檔案會編譯為由 Atlas Reasoning Engine 執行的 Agent Graph 規格。
  • Runtime 透過 before_reasoning 和 after_reasoning block 在呼叫 LLM 前後執行 deterministic code,藉此模擬 trigger 機制。
  • 將 deterministic code task 與 model reasoning 分離可確保可預測性,同時讓 LLM 能完全專注於在準備好的 context 上進行 reasoning。

2. 透過 Data 360 打造 Unified profile

Data 360 藉由可靠的三步驟 data layer 取代基於 model 的 record matching,從而解決 customer identity resolution 問題。首先,它直接連接異質 data source(例如 CRM 及 Snowflake 等 cloud data warehouse),以確保即時可見性。其次,它會自動將數千個 source 中不一致的 schema 調和為共享的 data model。最後,它套用可配置的 matching rule 將身分識別解析為 unified profile,且不會更動底層的 source record。

  • 要求 AI model 推論 record 是否屬於同一個人,會為 agent workflow 帶來不可靠性。
  • Data layer 執行三步驟流程來管理 customer identity:直接存取 data、調和 data format 以及解析 identity。
  • Data 360 會自動將來自數千個 source 的資料 mapping 至包含 person、lead 和 account 等標準 entity 的通用 model。
  • Data 360 中的 identity resolution 使用可配置的 rule,包含 exact match、fuzzy matching,以及用於清理後比對的 normalized rule。
  • Source record 保持不變,同時被連結至一個中心化的 unified profile。

3. 透過 Agent Context Engine 獲取相關 context

Agent Context Engine (ACE) 是 Data 360 中的一套 context management 系統,負責決定哪些相關資料該被注入 prompt 中,而不是用所有可用資料灌爆 prompt。ACE 透過由 Resolve、Plan、Reconcile、Govern、Compile 與 Learn 組成的六步驟 pipeline 來處理請求。在一項保險支援 benchmark 中,相較於沒有 context management 的 naive 設計,ACE 大幅降低了 multi-turn 查詢的 token 消耗。該引擎透過 in-memory profile graphs、用於文件過濾的 GraphRAG 索引以及 staged memory promotion 來最佳化 context。

  • Agent Context Engine (ACE) 是 Data 360 內全新的 context management 組件,旨在介於原始資料與 LLM prompt 之間運作。
  • ACE 透過六步驟 workflow 執行查詢:Resolve、Plan、Reconcile、Govern、Compile 與 Learn。
  • 使用 ACE 讓一筆保險查詢的 prompt token 數量從 124,000 降至 9,000,並將 multi-turn session 從 300,000 降至 65,000 tokens。
  • Context retrieval 可以依賴 GraphRAG,它結合了 exact-word matching、semantic search 與 linked entity indexing 來過濾文件。
  • ACE 會區分 transient memory 與核可的事實(approved facts),僅將經過驗證的 action 提升至 persistent long-term memory。

4. 透過 Agent Identity 進行權限管理

在典型的 AI agent 部署中,agent 會繼承使用者的完整憑證與權限,這會帶來極大風險,因為 agent 可能會迅速複製並放大錯誤。為了解決這個問題,Salesforce 推出了 Agent Identity,賦予 agent 獨立的身分與權限,與其所代表的使用者分開。在此系統下,authentication 期間會使用 dual token 同時代表 agent 與使用者。只有在同時符合使用者權限、agent 權限以及適用的 data policy 時,才允許執行操作。

  • 目前大多數 AI agent 配置都會將使用者的完整憑證指派給 agent,當自動化錯誤迅速擴散時會產生風險。
  • 客戶需要 agent 代表使用者操作,但不能繼承該使用者的完整權限集。
  • Agent Identity 為 AI agent 提供獨立的唯一身分,以及由管理員設定的權限。
  • Agent Identity 中的 authentication 同時使用兩個 token:一個代表使用者,另一個代表 agent。
  • Salesforce 只有在操作通過 agent 權限、使用者權限與 data policy 的多重檢查後才會執行。

Agent 在何處運行

Salesforce 採用 headless 架構,透過對外暴露 API、skill 與 protocol,而非要求使用其原生介面,讓外部 AI agent 和平台能夠存取其功能。為了支援這點,Salesforce 打造了 AIforce 與 Headless Toolkit,並利用 Model Context Protocol (MCP) 連接如 Claude 或 Slack 等外部 agent。由於暴露數百個獨立的 tool definition 會膨脹 context window 的消耗與成本,Salesforce MCP Server 將 tool retrieval 最佳化為四個核心 tool:discover、describe 與 dispatch。透過這種 indexing 方法,agent 可以在執行 API 呼叫之前,先搜尋相符的 skill 並動態檢查參數。

  • Headless 軟體架構將底層平台與其使用者介面解耦,透過 API 開放功能,以便與 Slack 或 Claude 等外部介面整合。
  • Salesforce 打造了 AIforce 與 Headless Toolkit,利用 API、skill 與 MCP 將平台資料、workflow 和邏輯傳遞至外部環境。
  • Salesforce API 目前每天處理 96 億次呼叫,其 skill 則發布在名為 sf-skills 的開源 GitHub repository 中。
  • 直接將數百個 tool definition 載入 agent 的 context window 會消耗大量容量,並增加每次 prompt 的 inference 成本。
  • Salesforce MCP Server 透過實作僅使用四個 tool(discover、describe 與 dispatch)的 index-based workflow,來解決 tool 數量膨脹的問題。

未來展望

目前的 AI scaffolding 組件分散在各個零散的產品中,需要一套統一的架構。根據 MK 和 Khushwant 的說法,下一個演進方向是 Enterprise AI Harness——一個企業可以插入資料與 agent 的統一系統。無論 agent 是運行在 Agentforce 還是外部平台上,這套 harness 都能為所有連線的 agent 提供 evaluation、tracing 以及各項輔助功能。

  • Model scaffolding 工具目前散落在不同且獨立的產品中。
  • MK 與 Khushwant 提議將這些 scaffolding 組件整合為名為 Enterprise AI Harness 的單一系統。
  • Enterprise AI Harness 讓企業組織能夠接入 agents 與資料,以使用集中式的 evaluation 與 tracing。
  • 該 harness 支援在 Agentforce 以及第三方 runtimes 上運作的 agents。