返回文章列表

AI

Strands Agents Tool Executor:工具執行與並行行為研究

Ting Zhang3 min read

從 Multi-Agent Chatbot 的實作需求出發,研究 Strands Agents 的 Tool Executor 如何執行工具,比較同步、非同步與並行方式的行為和效能。

Strands Agents Tool Executor:工具執行與並行行為研究

前言

寫 Chatbot POC 的時候有個功能需求是提供”串並行 Call 小腦 Agent “的功能 因為使用的 Multi agent framework 是 Strands Agents,這樣就有很多方法可以實現了。

方法ConceptConcern
Graph Multi-Agent Pattern類似 LangGraph如何“幫agent決定他要用哪個Tools?”

Conditional Edge 如何實現?Performance如何?
Swarm Multi-Agent Pattern不負責任的 Graph Pattern,想怎麼連 Edge 全靠 LLM 決定
Agents as tools解釋如下圖
  • Agent as tool Strands Agents 號稱可以透過Prompts來自動處理 Tools 的呼叫。 strands-agents-tool-executor-agent-loop.png

對於 Tool Execution 有分成

  • Concurrent executor (Default)
  • Sequential executor 其實官方文檔也沒有說得很清楚Concurrent / Sequential 到底差在哪?ex: 是否會繼承上下文?什麼情況應該用哪個的指引,所以直接上實驗結果:

測試 1: Concurrent Executor

strands-agents-tool-executor-concurrent-result.png

測試 2: Sequential Executor

strands-agents-tool-executor-sequential-result.png

結論

沒有經過 Agent loop Reasoning 的話,就不會重新整理上下文提供給 agent tool,是獨立事件,跟你的executor選哪個沒關係.

Lab 實作程式放在 https://github.com/GoingCloud/Alpha-Lab/tree/main/strands-agents-lab/lab-1Connect your Github account

Refs

Strands agentshttps://strandsagents.com/latest/documentation/docs/user-guide/concepts/tools/executors/?h=tool+executor