# Agent Flow 人工智慧工作流程代理 ___“An Agent is a language model powered software, which has the capability to reason, access tools provided to it and can perform an action based on a natural language instruction.”___ ## Agentic Flow 方法論 :::success HackMD: [方法論:生成式 AI 技術方法探討](https://hackmd.io/@yuhsintsao/BJg7P__gJl) GitHub: [LLM Agents Papers](https://github.com/zjunlp/LLMAgentPapers) GitHub: [Multi-Agent Reinforcement Learning (MARL)](https://github.com/LantaoYu/MARL-Papers) ::: ## NVIDIA's Agents :::success 01 NVIDIA blog: [Introduction to LLM Agents](https://developer.nvidia.com/blog/introduction-to-llm-agents/) 更新時間:2023-11-30 02 NVIDIA blog: [Building Your First LLM Agent Application](https://developer.nvidia.com/blog/building-your-first-llm-agent-application/) 更新時間:2023-11-30 03 NVIDIA blog: [Build an LLM-Powered API Agent for Task Execution](https://developer.nvidia.com/blog/build-an-llm-powered-api-agent-for-task-execution/) 更新時間:2024-02-21 04 NVIDIA blog: [Build an LLM-Powered Data Agent for Data Analysis](https://developer.nvidia.com/blog/build-an-llm-powered-data-agent-for-data-analysis/) 更新時間:2024-02-20 ::: ### Agents Modules Source: 01 NVIDIA blog (Figure👇)  Source: 04 NVIDIA blog (Figure👇)  Planning module: [ADaPT](https://allenai.github.io/adaptllm/) (Figure👇)  ### Agentic Workflow :::success 05 NVIDIA blog: [Build an Agentic RAG Pipeline with Llama 3.1 and NVIDIA NeMo Retriever NIMs](https://developer.nvidia.com/blog/build-an-agentic-rag-pipeline-with-llama-3-1-and-nvidia-nemo-retriever-nims/) 更新時間:2024-07-23 06 NVIDIA blog: [Multi-Agent AI and GPU-Powered Innovation in Sound-to-Text Technology](https://developer.nvidia.com/blog/multi-agent-ai-and-gpu-powered-innovation-in-sound-to-text-technology/) 更新時間:2024-10-22 ::: Source: 05 NVIDIA blog (Figure👇)  Source: 06 NVIDIA blog (Figure👇)  ### Agents Framework [LLMCompiler](https://github.com/SqueezeAILab/LLMCompiler?tab=readme-ov-file) ## Amazon Bedrock Agents ### Amazon Bedrock Agents 服務功能 Deep Dive :::info AWS Official: [Create and configure agent using conversational builder](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-create-cb.html) ::: #### Conversational Builder 會話式建構器 使用會話式建構器時,您可以用自然語言描述代理的用途,從而建立一個可完全測試的代理來實現該目的。會話式建構器會與您互動,以獲取建立或更新代理所需的所有必要信息。 會話式建構器可執行以下操作: 更新代理的名稱和描述 根據您用自然語言提供的指示生成代理指令摘要 創建操作組 更新操作組的名稱和描述 根據操作組摘要定義操作組功能 關聯、列出和解除關聯知識庫 列出或刪除操作組 ### Agents 定義和最佳實踐 :::success AWS blog: [Best practices for building robust generative AI applications with Amazon Bedrock Agents – Part 1](https://aws.amazon.com/blogs/machine-learning/best-practices-for-building-robust-generative-ai-applications-with-amazon-bedrock-agents-part-1/) | [Part 2](https://aws.amazon.com/blogs/machine-learning/best-practices-for-building-robust-generative-ai-applications-with-amazon-bedrock-agents-part-2/) 更新時間:2024-10-02 | 2024-10-21 Anthropic blog: [Building effective agents](https://www.anthropic.com/research/building-effective-agents) 更新時間:2024-12-20 Anthropic code: [Building Effective Agents Cookbook](https://github.com/anthropics/anthropic-cookbook/tree/main/patterns/agents) ::: #### Bedrock 代理定義 代理是一個由語言模型驅動的軟體,具有推理能力,可以存取提供給它的工具,並能根據自然語言指令執行行動。 代理可以被創建來執行兩個主要功能: - 通過 API 調用執行預先創建的 lambda 函數 - 使用知識庫來確保回應基於特定的信息來源 參考資料:Medium: [AWS Bedrock Agents overview](https://medium.com/@rajib76.gcp/aws-bedrock-agents-overview-5c1028c05a70 ) #### 使用 Bedrock Agents 建立穩健的生成式 AI 應用程式的最佳實踐 基礎事實數據收集 Laying the groundwork 強調在建置前收集高品質的基礎事實的資料 資料應涵蓋各種使用者意圖和場景 應包含簡單和複雜互動的輸入/輸出範例 範圍定義 Defining scope 明確定義代理程式的主要功能和能力 識別超出範圍的任務 (out-of-scope) 指定預期輸入和期望輸出 代理程式架構 Architecting 建議建立小型、專注的代理程式相互協作 (divide and conquer) 避免單一龐大的代理程式結構 改善模組化、可維護性和測試  使用者體驗設計 Planning agent tone and greetings 規劃代理程式語氣和問候語的重要性 維持一致的品牌形象和個性 考慮目標受眾偏好和文化敏感性 清晰指令 Maintaining clarity 強調明確的遣詞用句 詳細的函式功能定義和參數描述 清楚的知識庫指令 知識庫整合 Using organizational knowledge 與企業的知識庫整合 定期更新以維持資訊時效性 善用知識庫的進階設定 knowledgeBaseConfigurations 評估標準 Establishing evaluation criteria 關鍵指標包括: - 回應準確性 - 任務完成率 - 延遲/回應時間 - 收集資訊的對話效率 - 參與度 (back-and-forth conversational flow) - 對話連貫性 (logical progression and continuity between the responses) 測試和改進 持續測試和迭代 使用代理程式追蹤以利後續批量的模型表現評估 實施 A/B 測試 結合自動化指標進行人工評估 #### 架構和開發生命週期實踐 日誌記錄和可觀察性 Enable comprehensive logging and observability 啟用全面的日誌記錄 使用 Amazon Bedrock 模型調用日誌 實施監控工作流程 * AWS Bedrock samples: [Bedrock-ICYM (I See You Monitoring) 監控工具](https://github.com/aws-samples/amazon-bedrock-samples/tree/main/evaluation-observe/Custom-Observability-Solution) 基礎設施最佳實踐 Use infrastructure as code 使用基礎設施即代碼(IaC) 利用 AWS CloudFormation、CDK 或 Terraform 建構可重複使用的組件 開發考量 使用 SessionState 提供額外上下文 * 優化模型選擇以達到成本和性能平衡 建構測試框架 * 使用 LLMs 生成測試案例 :::spoiler 使用 SessionState 和 SessionPromptAttribute 使用 SessionState 為代理程式提供額外的上下文。SessionAttribute 提供只在動作群組中 Lambda 函數可用的資訊,並使用 SessionPromptAttribute 提供在提示中可用的資訊。 例如,如果您想提供 user authentication token,最好放在 SessionAttribute 中。如果您想提供大型語言模型(LLM)需要的推理資訊,例如當前日期和時間戳記,建議放在 SessionPromptAttribute 中。 :::  AWS Labs: [Agent Evaluation 評測工具](https://github.com/awslabs/agent-evaluation) AWS Bedrock samples: [test-agent kit](https://github.com/aws-samples/amazon-bedrock-samples/tree/main/agents-and-function-calling/bedrock-agents/test-agent) 安全性和負責任的 AI Design robust confirmation and security mechanisms 建構確認機制 * 使用靈活的授權和加密 * 實踐負責任 AI 使用 Amazon Bedrock Guardrails * :::spoiler 使用 x-requireConfirmation [x-requireConfirmation](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-api-schema.html) 可以在創建新動作時使用函數架構定義中的 requireConfirmation 欄位或 API 架構定義中的 x-requireConfirmation 欄位,以啟用 Amazon Bedrock Agents 內建的功能,在動作群組中調用動作之前請求使用者確認該動作。 ::: :::spoiler 如何授權代理程式的存取建議 在實施動作群組時,利用 sessionState 的 sessionAttributes 參數提供有關使用者角色和權限的資訊,以便您的動作可以實施細粒度的權限。 另一個最佳實踐是使用 sessionState 的 knowledgeBaseConfigurations 參數為您的知識庫提供額外的配置,例如通過知識庫元數據過濾定義使用者可以存取的文件的使用者群組。 ::: AWS Bedrock samples: [Creating Agent with Guardrails for Amazon Bedrock integration](https://github.com/aws-samples/amazon-bedrock-samples/tree/main/agents-and-function-calling/bedrock-agents/features-examples/08-create-agent-with-guardrails) 擴展方法論 遵循爬行-行走-奔跑方法 從內部應用開始 逐步擴展到外部用戶 最終實施多代理程式協作 (multi-agent collaboration) ### Agents 架構及應用 #### Speak Up, AI: Voicing Your Agents with Amazon Connect, Lex, and Bedrock  Source: [AWS community](https://community.aws/content/2mt7CFG7xg4yw6GRHwH9akhg0oD/speak-up-ai-voicing-your-agents-with-amazon-connect-lex-and-bedrock) | [YouTube demo](https://www.youtube.com/watch?v=kGnu2bhaq3g) ### Agents 效能  ### Agents 權限 :::success AWS blog: [Design secure generative AI application workflows with Amazon Verified Permissions and Amazon Bedrock Agents](https://aws.amazon.com/blogs/machine-learning/design-secure-generative-ai-application-workflows-with-amazon-verified-permissions-and-amazon-bedrock-agents/) | [GitHub](https://github.com/aws-samples/amazon-bedrock-samples/tree/main/agents-and-function-calling/bedrock-agents/use-case-examples/fine-grained-access-permissions-agent) 更新時間:2024-10-14 ::: ### Agents 評測 :::success AWS Labs: [Agent Evaluation 評測工具](https://github.com/awslabs/agent-evaluation) Agent Evaluation 使用方式請參閱: AWS blog: [Evaluate conversational AI agents with Amazon Bedrock](https://aws.amazon.com/blogs/machine-learning/evaluate-conversational-ai-agents-with-amazon-bedrock/) 更新時間:2024-07-25 ::: ## Model Context Protocol (MCP) ⭐⭐⭐ :::info YouTube: [Will Anthropic's MCP work with other LLMs? - YES, with Amazon Bedrock.](https://www.youtube.com/watch?v=u6444EjemKo) Anthropic's blog: [Introducing the Model Context Protocol](https://www.anthropic.com/news/model-context-protocol) ::: Anthropic推出了Model Context Protocol (MCP),這是一個開源協議,用於連接AI客戶端與各種工具。 MCP架構包含: 主機/客戶端應用 MCP伺服器 資源/工具 大語言模型(LLM) 上述影片示範了如何使用Amazon Bedrock的Converse API來創建MCP客戶端,可以與不同的LLM模型配合使用,包括: Claude 3.5 Mistral Large Meta的Llama模型 主要優勢: 標準化工具連接方式 工具定義存在於MCP伺服器中 可以靈活切換不同的語言模型 完全開源 示範包含: 創建基本的SQL資料庫查詢 創建天氣觀測表 使用不同模型執行相同任務 工具使用的實際操作流程 技術細節: 使用非同步程式設計 通過標準輸入輸出連接 需要配置伺服器參數 包含工具註冊和調用機制 這個協議的主要目標是標準化AI助手與各種工具之間的連接方式,使開發更加便捷和靈活。 ## 開源工具 [LangChain Plan-and-Execute Agents](https://blog.langchain.dev/planning-agents/ ) [TextGrad](https://textgrad.com/) ## 動手實作 AWS Labs: [Multi-Agent Orchestrator framework](https://awslabs.github.io/multi-agent-orchestrator/) AWS Bedrock samples: [Amazon Bedrock Agents](https://github.com/aws-samples/amazon-bedrock-samples/tree/main/agents-and-function-calling/bedrock-agents) AWS Bedrock Agents samples: [Amazon Bedrock Agent Samples](https://github.com/awslabs/amazon-bedrock-agent-samples/tree/main) Workshop Studio: [LangGraph agents with Amazon Bedrock](https://catalog.us-east-1.prod.workshops.aws/workshops/9bc28f51-d7c3-468b-ba41-72667f3273f1/en-US) Workshop Studio: [Amazon Bedrock Agents Workshop](https://catalog.workshops.aws/agents-for-amazon-bedrock/en-US) DeepLearning.AI: [Serverless Agentic Workflows with Amazon Bedrock](https://www.deeplearning.ai/short-courses/serverless-agentic-workflows-with-amazon-bedrock/) [ChatDev](https://github.com/OpenBMB/ChatDev?utm_campaign=The%20Batch&utm_source=hs_email&utm_medium=email&_hsenc=p2ANqtz-8TZzur2df1qdnGx09b-Fg94DTsc3-xXao4StKvKNU2HR51el3n8yOm0CPSw6GiAoLQNKua)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up