通过 Merge 的 Agent Handler 平台使 CrewAI 代理能够安全地访问 Linear、GitHub、Slack 等第三方集成MergeAgentHandlerToolMergeAgentHandlerTool允许 CrewAI 代理通过 Merge 的 Agent Handler 平台安全地访问第三方集成。Agent Handler 为 Linear、GitHub、Slack、Notion 等数百种热门工具提供预构建的安全连接器所有连接器均内置身份验证、权限管理和监控功能。安装uv pip install crewai[tools]要求已配置工具包的 Merge Agent Handler 账户Agent Handler API 密钥至少一个已注册用户并关联到您的工具包在您的工具包中配置的第三方集成Agent Handler 入门在 ah.merge.dev/signup注册一个 Merge Agent Handler 账户创建一个工具包并配置您需要的集成注册用户以通过第三方服务进行身份验证从 Agent Handler 仪表板获取您的 API 密钥设置环境变量export AGENT_HANDLER_API_KEY您的密钥使用 CrewAI 中的 MergeAgentHandlerTool开始构建注意工具包 ID 和注册用户 ID 可以在您的 Agent Handler 仪表板中找到或通过 API 创建该工具使用模型上下文协议MCP与 Agent Handler 通信会话 ID 自动生成但可以自定义以保持上下文持久性所有工具调用都通过 Agent Handler 平台进行记录和审计工具参数从 Agent Handler API 动态发现并自动验证用法单一工具用法以下是使用工具包中特定工具的方法from crewai import Agent, Task, Crew from crewai_tools import MergeAgentHandlerTool # Create a tool for Linear issue creation linear_create_tool MergeAgentHandlerTool.from_tool_name( tool_namelinear__create_issue, tool_pack_id134e0111-0f67-44f6-98f0-597000290bb3, registered_user_id91b2b905-e866-40c8-8be2-efe53827a0aa ) # Create a CrewAI agent that uses the tool project_manager Agent( roleProject Manager, goalManage project tasks and issues efficiently, backstoryI am an expert at tracking project work and creating actionable tasks., tools[linear_create_tool], verboseTrue ) # Create a task for the agent create_issue_task Task( descriptionCreate a new high-priority issue in Linear titled Implement user authentication with a detailed description of the requirements., agentproject_manager, expected_outputConfirmation that the issue was created with its ID ) # Create a crew with the agent crew Crew( agents[project_manager], tasks[create_issue_task], verboseTrue ) # Run the crew result crew.kickoff() print(result)从工具包加载多个工具您可以一次性加载工具包中所有可用的工具from crewai import Agent, Task, Crew from crewai_tools import MergeAgentHandlerTool # Load all tools from the Tool Pack tools MergeAgentHandlerTool.from_tool_pack( tool_pack_id134e0111-0f67-44f6-98f0-597000290bb3, registered_user_id91b2b905-e866-40c8-8be2-efe53827a0aa ) # Create an agent with access to all tools automation_expert Agent( roleAutomation Expert, goalAutomate workflows across multiple platforms, backstoryI can work with any tool in the toolbox to get things done., toolstools, verboseTrue ) automation_task Task( descriptionCheck for any high-priority issues in Linear and post a summary to Slack., agentautomation_expert ) crew Crew( agents[automation_expert], tasks[automation_task], verboseTrue ) result crew.kickoff()仅加载特定工具仅加载您需要的工具from crewai import Agent, Task, Crew from crewai_tools import MergeAgentHandlerTool # Load specific tools from the Tool Pack selected_tools MergeAgentHandlerTool.from_tool_pack( tool_pack_id134e0111-0f67-44f6-98f0-597000290bb3, registered_user_id91b2b905-e866-40c8-8be2-efe53827a0aa, tool_names[linear__create_issue, linear__get_issues, slack__post_message] ) developer_assistant Agent( roleDeveloper Assistant, goalHelp developers track and communicate about their work, backstoryI help developers stay organized and keep the team informed., toolsselected_tools, verboseTrue ) daily_update_task Task( descriptionGet all issues assigned to the current user in Linear and post a summary to the #dev-updates Slack channel., agentdeveloper_assistant ) crew Crew( agents[developer_assistant], tasks[daily_update_task], verboseTrue ) result crew.kickoff()工具参数from_tool_name()方法参数类型必填默认值描述tool_namestr是无要使用的特定工具的名称例如“linear__create_issue”tool_pack_idstr是无您的 Agent Handler 工具包的 UUIDregistered_user_idstr是无注册用户的 UUID 或 origin_idbase_urlstr否“https://ah-api.merge.dev”Agent Handler API 的基本 URLsession_idstr否自动生成用于维护上下文的 MCP 会话 IDfrom_tool_pack()方法参数类型必填默认值描述tool_pack_idstr是无您的 Agent Handler 工具包的 UUIDregistered_user_idstr是无注册用户的 UUID 或 origin_idtool_nameslist[str]否无要加载的特定工具名称。如果为 None则加载所有可用工具base_urlstr否“https://ah-api.merge.dev”Agent Handler API 的基本 URL环境变量AGENT_HANDLER_API_KEYyour_api_key_here # Required for authentication高级用法具有不同工具访问权限的多代理工作流from crewai import Agent, Task, Crew, Process from crewai_tools import MergeAgentHandlerTool # Create specialized tools for different agents github_tools MergeAgentHandlerTool.from_tool_pack( tool_pack_id134e0111-0f67-44f6-98f0-597000290bb3, registered_user_id91b2b905-e866-40c8-8be2-efe53827a0aa, tool_names[github__create_pull_request, github__get_pull_requests] ) linear_tools MergeAgentHandlerTool.from_tool_pack( tool_pack_id134e0111-0f67-44f6-98f0-597000290bb3, registered_user_id91b2b905-e866-40c8-8be2-efe53827a0aa, tool_names[linear__create_issue, linear__update_issue] ) slack_tool MergeAgentHandlerTool.from_tool_name( tool_nameslack__post_message, tool_pack_id134e0111-0f67-44f6-98f0-597000290bb3, registered_user_id91b2b905-e866-40c8-8be2-efe53827a0aa ) # Create specialized agents code_reviewer Agent( roleCode Reviewer, goalReview pull requests and ensure code quality, backstoryI am an expert at reviewing code changes and providing constructive feedback., toolsgithub_tools ) task_manager Agent( roleTask Manager, goalTrack and update project tasks based on code changes, backstoryI keep the project board up to date with the latest development progress., toolslinear_tools ) communicator Agent( roleTeam Communicator, goalKeep the team informed about important updates, backstoryI make sure everyone knows what is happening in the project., tools[slack_tool] ) # Create sequential tasks review_task Task( descriptionReview all open pull requests in the api-service repository and identify any that need attention., agentcode_reviewer, expected_outputList of pull requests that need review or have issues ) update_task Task( descriptionUpdate Linear issues based on the pull request review findings. Mark completed PRs as done., agenttask_manager, expected_outputSummary of updated Linear issues ) notify_task Task( descriptionPost a summary of todays code review and task updates to the #engineering Slack channel., agentcommunicator, expected_outputConfirmation that the message was posted ) # Create a crew with sequential processing crew Crew( agents[code_reviewer, task_manager, communicator], tasks[review_task, update_task, notify_task], processProcess.sequential, verboseTrue ) result crew.kickoff()自定义会话管理使用会话 ID 在多个工具调用之间保持上下文from crewai import Agent, Task, Crew from crewai_tools import MergeAgentHandlerTool # Create tools with the same session ID to maintain context session_id project-sprint-planning-2024 create_tool MergeAgentHandlerTool( namelinear_create_issue, descriptionCreates a new issue in Linear, tool_namelinear__create_issue, tool_pack_id134e0111-0f67-44f6-98f0-597000290bb3, registered_user_id91b2b905-e866-40c8-8be2-efe53827a0aa, session_idsession_id ) update_tool MergeAgentHandlerTool( namelinear_update_issue, descriptionUpdates an existing issue in Linear, tool_namelinear__update_issue, tool_pack_id134e0111-0f67-44f6-98f0-597000290bb3, registered_user_id91b2b905-e866-40c8-8be2-efe53827a0aa, session_idsession_id ) sprint_planner Agent( roleSprint Planner, goalPlan and organize sprint tasks, backstoryI help teams plan effective sprints with well-defined tasks., tools[create_tool, update_tool], verboseTrue ) planning_task Task( descriptionCreate 5 sprint tasks for the authentication feature and set their priorities based on dependencies., agentsprint_planner ) crew Crew( agents[sprint_planner], tasks[planning_task], verboseTrue ) result crew.kickoff()用例统一集成访问通过单一统一 API 访问数百种第三方工具无需管理多个 SDK使代理能够通过一个集成点与 Linear、GitHub、Slack、Notion、Jira、Asana 等工具协同工作通过让 Agent Handler 管理身份验证和 API 版本控制来降低集成复杂性安全的企业工作流利用所有第三方集成的内置身份验证和权限管理通过集中式访问控制和审计日志维护企业安全标准使代理能够访问公司工具而无需在代码中暴露 API 密钥或凭据跨平台自动化构建跨多个平台的工作流例如从 Linear 任务创建 GitHub 问题将 Notion 页面同步到 Slack实现技术栈中不同工具之间的无缝数据流创建理解不同平台上下文的智能自动化动态工具发现在运行时加载所有可用工具无需硬编码集成逻辑使代理能够发现并使用添加到工具包中的新工具构建能够适应工具可用性变化的灵活代理用户特定工具访问不同的用户可以拥有不同的工具权限和访问级别实现多租户工作流其中代理代表特定用户执行操作为所有工具操作维护适当的归属和权限可用集成Merge Agent Handler 支持数百种不同类别的集成项目管理Linear、Jira、Asana、Monday.com、ClickUp代码管理GitHub、GitLab、Bitbucket通信Slack、Microsoft Teams、Discord文档Notion、Confluence、Google DocsCRMSalesforce、HubSpot、Pipedrive还有更多……访问 Merge Agent Handler 文档 以获取可用集成的完整列表。错误处理该工具提供全面的错误处理身份验证错误无效或缺失的 API 密钥权限错误用户缺乏所需操作的权限API 错误与 Agent Handler 或第三方服务通信问题验证错误传递给工具方法的参数无效所有错误都封装在MergeAgentHandlerToolError中以实现一致的错误处理。《AI提示工程必知必会》为读者提供了丰富的AI提示工程知识与实战技能。《AI提示工程必知必会》主要内容包括各类提示词的应用如问答式、指令式、状态类、建议式、安全类和感谢类提示词以及如何通过实战演练掌握提示词的使用技巧使用提示词进行文本摘要、改写重述、语法纠错、机器翻译等语言处理任务以及在数据挖掘、程序开发等领域的应用AI在绘画创作上的应用百度文心一言和阿里通义大模型这两大智能平台的特性与功能以及市场调研中提示词的实战应用。通过阅读《AI提示工程必知必会》读者可掌握如何有效利用AI提示工程提升工作效率创新工作流程并在职场中脱颖而出。