Asana 集成
让你的代理通过 Asana 管理任务、项目和团队协作。借助 AI 驱动的自动化,创建任务、更新项目状态、管理分配,并简化团队工作流程。
在使用 Asana 集成前,请确保你已经具备:
- 一个拥有有效订阅的 CrewAI AMP 账号
- 一个具有相应权限的 Asana 账号
- 已通过 集成页面 连接你的 Asana 账号
配置 Asana 集成
Section titled “配置 Asana 集成”1. 连接你的 Asana 账号
Section titled “1. 连接你的 Asana 账号”- 进入 CrewAI AMP Integrations
- 在身份验证集成部分找到 Asana
- 点击 Connect 并完成 OAuth 流程
- 授予任务和项目管理所需的权限
- 从 Integration Settings 复制你的 Enterprise Token
2. 安装所需包
Section titled “2. 安装所需包”uv add crewai-tools3. 环境变量设置
Section titled “3. 环境变量设置”export CREWAI_PLATFORM_INTEGRATION_TOKEN="your_enterprise_token"或者将其添加到你的 .env 文件中:
CREWAI_PLATFORM_INTEGRATION_TOKEN=your_enterprise_tokenasana/create_comment
描述: 在 Asana 中创建评论。
参数:
task(string, required): 任务 ID - 要将评论添加到的任务 ID。评论将由当前已认证用户发布。text(string, required): 文本(示例:"This is a comment.")。
asana/create_project
描述: 在 Asana 中创建项目。
参数:
name(string, required): 名称(示例:"Stuff to buy")。workspace(string, required): 工作区 - 使用 Connect Portal Workflow Settings 让用户选择创建项目的工作区。如果留空,则默认为用户的第一个工作区。team(string, optional): 团队 - 使用 Connect Portal Workflow Settings 让用户选择与该项目共享的团队。如果留空,则默认为用户的第一个团队。notes(string, optional): 备注(示例:"These are things we need to purchase.")。
asana/get_projects
描述: 获取 Asana 中的项目列表。
参数:
archived(string, optional): 已归档 - 选择"true"显示已归档项目,"false"仅显示活动项目,或"default"同时显示已归档和活动项目。- 可选项:
default,true,false
- 可选项:
asana/get_project_by_id
描述: 通过 ID 获取 Asana 中的项目。
参数:
projectFilterId(string, required): 项目 ID。
asana/create_task
描述: 在 Asana 中创建任务。
参数:
name(string, required): 名称(示例:"Task Name")。workspace(string, optional): 工作区 - 使用 Connect Portal Workflow Settings 让用户选择创建任务的工作区。如果留空,则默认为用户的第一个工作区。。project(string, optional): 项目 - 使用 Connect Portal Workflow Settings 让用户选择要在其中创建此任务的项目。notes(string, optional): 备注。dueOnDate(string, optional): 截止日期 - 该任务的到期日期。不能与截止时间同时使用。(示例:"YYYY-MM-DD")。dueAtDate(string, optional): 截止时间 - 该任务的到期日期和时间(ISO 时间戳)。不能与截止日期同时使用。(示例:"2019-09-15T02:06:58.147Z")。assignee(string, optional): 负责人 - 该任务将被分配到的 Asana 用户 ID。使用 Connect Portal Workflow Settings 让用户选择负责人。gid(string, optional): 外部 ID - 你应用中的一个 ID,用于关联此任务。之后你可以使用该 ID 同步此任务的更新。
asana/update_task
描述: 在 Asana 中更新任务。
参数:
taskId(string, required): 任务 ID - 将要更新的任务 ID。completeStatus(string, optional): 完成状态。- 可选项:
true,false
- 可选项:
name(string, optional): 名称(示例:"Task Name")。notes(string, optional): 备注。dueOnDate(string, optional): 截止日期 - 该任务的到期日期。不能与截止时间同时使用。(示例:"YYYY-MM-DD")。dueAtDate(string, optional): 截止时间 - 该任务的到期日期和时间(ISO 时间戳)。不能与截止日期同时使用。(示例:"2019-09-15T02:06:58.147Z")。assignee(string, optional): 负责人 - 该任务将被分配到的 Asana 用户 ID。使用 Connect Portal Workflow Settings 让用户选择负责人。gid(string, optional): 外部 ID - 你应用中的一个 ID,用于关联此任务。之后你可以使用该 ID 同步此任务的更新。
asana/get_tasks
描述: 获取 Asana 中的任务列表。
参数:
workspace(string, optional): 工作区 - 用于筛选任务的工作区 ID。使用 Connect Portal Workflow Settings 让用户选择一个工作区。project(string, optional): 项目 - 用于筛选任务的项目 ID。使用 Connect Portal Workflow Settings 让用户选择一个项目。assignee(string, optional): 负责人 - 用于筛选任务的负责人 ID。使用 Connect Portal Workflow Settings 让用户选择一个负责人。completedSince(string, optional): 自此完成 - 仅返回尚未完成,或自此时间之后完成的任务(ISO 或 Unix 时间戳)。(示例:"2014-04-25T16:15:47-04:00")。
asana/get_tasks_by_id
描述: 通过 ID 获取 Asana 中的任务列表。
参数:
taskId(string, required): 任务 ID。
asana/get_task_by_external_id
描述: 通过外部 ID 获取 Asana 中的任务。
参数:
gid(string, required): 外部 ID - 该任务与你的应用关联或同步所使用的 ID。
asana/add_task_to_section
描述: 将任务添加到 Asana 的某个分区。
参数:
sectionId(string, required): 分区 ID - 要将此任务添加到的分区 ID。taskId(string, required): 任务 ID - 任务的 ID。(示例:"1204619611402340")。beforeTaskId(string, optional): 之前的任务 ID - 此任务将在该分区中插入到其前面的任务 ID。不能与 After Task ID 同时使用。(示例:"1204619611402340")。afterTaskId(string, optional): 之后的任务 ID - 此任务将在该分区中插入到其后面的任务 ID。不能与 Before Task ID 同时使用。(示例:"1204619611402340")。
asana/get_teams
描述: 获取 Asana 中的团队列表。
参数:
workspace(string, required): 工作区 - 返回该工作区中对已授权用户可见的团队。
asana/get_workspaces
描述: 获取 Asana 中的工作区列表。
参数: 不需要。
基础 Asana 代理设置
Section titled “基础 Asana 代理设置”from crewai import Agent, Task, Crew
# Create an agent with Asana capabilitiesasana_agent = Agent( role="Project Manager", goal="Manage tasks and projects in Asana efficiently", backstory="An AI assistant specialized in project management and task coordination.", apps=['asana'] # All Asana actions will be available)
# Task to create a new projectcreate_project_task = Task( description="Create a new project called 'Q1 Marketing Campaign' in the Marketing workspace", agent=asana_agent, expected_output="Confirmation that the project was created successfully with project ID")
# Run the taskcrew = Crew( agents=[asana_agent], tasks=[create_project_task])
crew.kickoff()筛选特定 Asana 工具
Section titled “筛选特定 Asana 工具”from crewai import Agent, Task, Crew
# Create agent with specific Asana actions onlytask_manager_agent = Agent( role="Task Manager", goal="Create and manage tasks efficiently", backstory="An AI assistant that focuses on task creation and management.", apps=[ 'asana/create_task', 'asana/update_task', 'asana/get_tasks' ] # Specific Asana actions)
# Task to create and assign a tasktask_management = Task( description="Create a task called 'Review quarterly reports' and assign it to the appropriate team member", agent=task_manager_agent, expected_output="Task created and assigned successfully")
crew = Crew( agents=[task_manager_agent], tasks=[task_management])
crew.kickoff()高级项目管理
Section titled “高级项目管理”from crewai import Agent, Task, Crew
project_coordinator = Agent( role="Project Coordinator", goal="Coordinate project activities and track progress", backstory="An experienced project coordinator who ensures projects run smoothly.", apps=['asana'])
# Complex task involving multiple Asana operationscoordination_task = Task( description=""" 1. Get all active projects in the workspace 2. For each project, get the list of incomplete tasks 3. Create a summary report task in the 'Management Reports' project 4. Add comments to overdue tasks to request status updates """, agent=project_coordinator, expected_output="Summary report created and status update requests sent for overdue tasks")
crew = Crew( agents=[project_coordinator], tasks=[coordination_task])
crew.kickoff()