Spaces:
Runtime error
Runtime error
Commit ·
2bfbe32
1
Parent(s): 490ec28
Refactor demo.py to use environment variable for Notion embed URL and adjust iframe attributes; remove obsolete test files.
Browse files- agency_ai_demo/demo.ipynb +0 -533
- agency_ai_demo/tests/test_clickup_agent.py +0 -94
- agency_ai_demo/tests/test_clickup_tool_conversion.py +0 -145
- agency_ai_demo/tests/test_clickup_tools.py +0 -170
- agency_ai_demo/tests/test_list_tasks.py +0 -47
- agency_ai_demo/tests/test_tool_directly.py +0 -90
- {agency_ai_demo → app}/agents/NotionProjectAgent/NotionProjectAgent.py +0 -0
- {agency_ai_demo → app}/agents/NotionProjectAgent/__init__.py +0 -0
- {agency_ai_demo → app}/agents/NotionProjectAgent/instructions.md +0 -0
- {agency_ai_demo → app}/agents/NotionProjectAgent/tools/CreateTask.py +0 -0
- {agency_ai_demo → app}/agents/NotionProjectAgent/tools/DeleteTask.py +0 -0
- {agency_ai_demo → app}/agents/NotionProjectAgent/tools/GetTask.py +0 -0
- {agency_ai_demo → app}/agents/NotionProjectAgent/tools/GetTasks.py +0 -0
- {agency_ai_demo → app}/agents/NotionProjectAgent/tools/UpdateTask.py +0 -0
- {agency_ai_demo → app}/agents/ResearchAndReportAgent/ResearchAndReportAgent.py +0 -0
- {agency_ai_demo → app}/agents/ResearchAndReportAgent/__init__.py +0 -0
- {agency_ai_demo → app}/agents/ResearchAndReportAgent/instructions.md +0 -0
- {agency_ai_demo → app}/agents/ResearchAndReportAgent/tools/ExampleTool.py +0 -0
- {agency_ai_demo → app}/agents/TechnicalProjectManager/TechnicalProjectManager.py +0 -0
- {agency_ai_demo → app}/agents/TechnicalProjectManager/__init__.py +0 -0
- {agency_ai_demo → app}/agents/TechnicalProjectManager/instructions.md +0 -0
- {agency_ai_demo → app}/agents/TechnicalProjectManager/tools/ExampleTool.py +0 -0
- {agency_ai_demo → app}/agents/TechnicalProjectManager/tools/SendWhatsAppText.py +0 -0
- {agency_ai_demo → app}/agents/__init__.py +0 -0
- {agency_ai_demo → app}/demo.py +2 -2
- {agency_ai_demo → app}/shared_files/agency_manifesto.md +0 -0
agency_ai_demo/demo.ipynb
DELETED
|
@@ -1,533 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "code",
|
| 5 |
-
"execution_count": 1,
|
| 6 |
-
"metadata": {},
|
| 7 |
-
"outputs": [
|
| 8 |
-
{
|
| 9 |
-
"data": {
|
| 10 |
-
"text/plain": [
|
| 11 |
-
"True"
|
| 12 |
-
]
|
| 13 |
-
},
|
| 14 |
-
"execution_count": 1,
|
| 15 |
-
"metadata": {},
|
| 16 |
-
"output_type": "execute_result"
|
| 17 |
-
}
|
| 18 |
-
],
|
| 19 |
-
"source": [
|
| 20 |
-
"import os\n",
|
| 21 |
-
"import requests\n",
|
| 22 |
-
"from dotenv import load_dotenv\n",
|
| 23 |
-
"# from langchain.tools import StructuredTool, BaseTool, tool\n",
|
| 24 |
-
"from langchain_core.pydantic_v1 import BaseModel, Field\n",
|
| 25 |
-
"from langchain_core.tools import ToolException\n",
|
| 26 |
-
"from pydantic import ValidationError\n",
|
| 27 |
-
"from typing import Any, Type, List, Dict\n",
|
| 28 |
-
"import datetime\n",
|
| 29 |
-
"\n",
|
| 30 |
-
"from openai import AzureOpenAI\n",
|
| 31 |
-
"from agency_swarm import set_openai_client\n",
|
| 32 |
-
"from agency_swarm import Agent, Agency\n",
|
| 33 |
-
"\n",
|
| 34 |
-
"\n",
|
| 35 |
-
"from composio.tools.local.clickup.actions.base import OpenAPIAction\n",
|
| 36 |
-
"from composio.tools.local.clickup.actions.create_task import CreateTask, CreateTaskResponse\n",
|
| 37 |
-
"\n",
|
| 38 |
-
"from agents.ClickUpAgent.tools.ClickUpTools import initialize_clickup_tools\n",
|
| 39 |
-
"\n",
|
| 40 |
-
"\n",
|
| 41 |
-
"load_dotenv()"
|
| 42 |
-
]
|
| 43 |
-
},
|
| 44 |
-
{
|
| 45 |
-
"cell_type": "code",
|
| 46 |
-
"execution_count": 2,
|
| 47 |
-
"metadata": {},
|
| 48 |
-
"outputs": [],
|
| 49 |
-
"source": [
|
| 50 |
-
"client = AzureOpenAI(\n",
|
| 51 |
-
" api_key=os.getenv(\"AZURE_OPENAI_API_KEY\"),\n",
|
| 52 |
-
" api_version=os.getenv(\"OPENAI_API_VERSION\"),\n",
|
| 53 |
-
" azure_endpoint=os.getenv(\"AZURE_OPENAI_ENDPOINT\"),\n",
|
| 54 |
-
" timeout=5,\n",
|
| 55 |
-
" max_retries=5,\n",
|
| 56 |
-
")\n",
|
| 57 |
-
"\n",
|
| 58 |
-
"set_openai_client(client)"
|
| 59 |
-
]
|
| 60 |
-
},
|
| 61 |
-
{
|
| 62 |
-
"cell_type": "code",
|
| 63 |
-
"execution_count": 3,
|
| 64 |
-
"metadata": {},
|
| 65 |
-
"outputs": [],
|
| 66 |
-
"source": [
|
| 67 |
-
"project_manager = Agent(\n",
|
| 68 |
-
" name=\"project_manager\",\n",
|
| 69 |
-
" description=\"I am the Project Manager\",\n",
|
| 70 |
-
" model=\"gpt-4o\",\n",
|
| 71 |
-
" )"
|
| 72 |
-
]
|
| 73 |
-
},
|
| 74 |
-
{
|
| 75 |
-
"cell_type": "code",
|
| 76 |
-
"execution_count": 4,
|
| 77 |
-
"metadata": {},
|
| 78 |
-
"outputs": [],
|
| 79 |
-
"source": [
|
| 80 |
-
"clickup_agent_instructions = f\"\"\"# PROJECT_MANAGEMENT\n",
|
| 81 |
-
"Your team uses ClickUp to manage projects and tasks.\n",
|
| 82 |
-
"Users often refer to lists and tasks by name, and sometimes there may not be an exact match, so you should look for the closest ones.\n",
|
| 83 |
-
"If in doubt, provide the user with valid options to choose from or ask for more information if necessary.\n",
|
| 84 |
-
"\n",
|
| 85 |
-
"## CLICKUP_STRUCTURE\n",
|
| 86 |
-
"-> Workspace: The highest level of organization in ClickUp. Contains all your Spaces.\n",
|
| 87 |
-
"--> Space: A collection of Folders and Lists. It is a way to group related work.\n",
|
| 88 |
-
"---> Folder: Used to group Lists.\n",
|
| 89 |
-
"----> List: Used to group tasks. Lists can be in a Folder or directly in a Space.\n",
|
| 90 |
-
"-----> Task: The basic unit of work in ClickUp, assignable with due dates.\n",
|
| 91 |
-
"------> Subtask: A child task of a parent Task, assignable to different people.\n",
|
| 92 |
-
"\n",
|
| 93 |
-
"## DEFAULT_CLICKUP_IDS\n",
|
| 94 |
-
"Use these IDs unless specified otherwise\n",
|
| 95 |
-
"- Team ID: {os.getenv(\"CLICKUP_TEAM_ID\")}\n",
|
| 96 |
-
"- List ID 'test_clickup_tool': {os.getenv(\"CLICKUP_LIST_ID\")}\n",
|
| 97 |
-
"\n",
|
| 98 |
-
"## CLICKUP_USERS\n",
|
| 99 |
-
"- Your id: {os.getenv(\"CLICKUP_AGENT_USER_ID\")}\n",
|
| 100 |
-
"- Main user id: {os.getenv(\"CLICKUP_USER_ID\")}\n",
|
| 101 |
-
"\"\"\""
|
| 102 |
-
]
|
| 103 |
-
},
|
| 104 |
-
{
|
| 105 |
-
"cell_type": "code",
|
| 106 |
-
"execution_count": 5,
|
| 107 |
-
"metadata": {},
|
| 108 |
-
"outputs": [
|
| 109 |
-
{
|
| 110 |
-
"name": "stdout",
|
| 111 |
-
"output_type": "stream",
|
| 112 |
-
"text": [
|
| 113 |
-
"[<class 'utils.tool_wrapper._convert_function_tool.<locals>.ConvertedFunctionTool'>, <class 'utils.tool_wrapper._convert_function_tool.<locals>.ConvertedFunctionTool'>, <class 'utils.tool_wrapper._convert_function_tool.<locals>.ConvertedFunctionTool'>, <class 'utils.tool_wrapper._convert_function_tool.<locals>.ConvertedFunctionTool'>, <class 'utils.tool_wrapper._convert_function_tool.<locals>.ConvertedFunctionTool'>, <class 'utils.tool_wrapper._convert_function_tool.<locals>.ConvertedFunctionTool'>, <class 'utils.tool_wrapper._convert_function_tool.<locals>.ConvertedFunctionTool'>, <class 'utils.tool_wrapper._convert_function_tool.<locals>.ConvertedFunctionTool'>]\n"
|
| 114 |
-
]
|
| 115 |
-
}
|
| 116 |
-
],
|
| 117 |
-
"source": [
|
| 118 |
-
"# clickup_tools = initialize_clickup_tools()\n",
|
| 119 |
-
"# print(clickup_tools)"
|
| 120 |
-
]
|
| 121 |
-
},
|
| 122 |
-
{
|
| 123 |
-
"cell_type": "code",
|
| 124 |
-
"execution_count": null,
|
| 125 |
-
"metadata": {},
|
| 126 |
-
"outputs": [],
|
| 127 |
-
"source": [
|
| 128 |
-
"from agents.ClickUpAgent.tools.GetTaskTool import GetTaskTool\n",
|
| 129 |
-
"from utils.tool_wrapper import convert_langchain_tools\n",
|
| 130 |
-
"get_task_tool = GetTaskTool()\n",
|
| 131 |
-
"clickup_tools = convert_langchain_tools([get_task_tool])"
|
| 132 |
-
]
|
| 133 |
-
},
|
| 134 |
-
{
|
| 135 |
-
"cell_type": "code",
|
| 136 |
-
"execution_count": 6,
|
| 137 |
-
"metadata": {},
|
| 138 |
-
"outputs": [
|
| 139 |
-
{
|
| 140 |
-
"data": {
|
| 141 |
-
"text/plain": [
|
| 142 |
-
"'Create_task_toolTool'"
|
| 143 |
-
]
|
| 144 |
-
},
|
| 145 |
-
"execution_count": 6,
|
| 146 |
-
"metadata": {},
|
| 147 |
-
"output_type": "execute_result"
|
| 148 |
-
}
|
| 149 |
-
],
|
| 150 |
-
"source": [
|
| 151 |
-
"clickup_tools[0].__name__"
|
| 152 |
-
]
|
| 153 |
-
},
|
| 154 |
-
{
|
| 155 |
-
"cell_type": "code",
|
| 156 |
-
"execution_count": 7,
|
| 157 |
-
"metadata": {},
|
| 158 |
-
"outputs": [],
|
| 159 |
-
"source": [
|
| 160 |
-
"\n",
|
| 161 |
-
"clickup_agent = Agent(\n",
|
| 162 |
-
" name=\"clickup_agent\",\n",
|
| 163 |
-
" description=\"I am a simple agent\",\n",
|
| 164 |
-
" instructions=clickup_agent_instructions,\n",
|
| 165 |
-
" model=\"gpt-4o\",\n",
|
| 166 |
-
" tools=clickup_tools,\n",
|
| 167 |
-
" )"
|
| 168 |
-
]
|
| 169 |
-
},
|
| 170 |
-
{
|
| 171 |
-
"cell_type": "code",
|
| 172 |
-
"execution_count": 8,
|
| 173 |
-
"metadata": {},
|
| 174 |
-
"outputs": [
|
| 175 |
-
{
|
| 176 |
-
"name": "stdout",
|
| 177 |
-
"output_type": "stream",
|
| 178 |
-
"text": [
|
| 179 |
-
"Updating agent... clickup_agent\n"
|
| 180 |
-
]
|
| 181 |
-
}
|
| 182 |
-
],
|
| 183 |
-
"source": [
|
| 184 |
-
"agency = Agency(\n",
|
| 185 |
-
" agency_chart=[\n",
|
| 186 |
-
" project_manager,\n",
|
| 187 |
-
" [project_manager, clickup_agent],\n",
|
| 188 |
-
"],\n",
|
| 189 |
-
" # shared_instructions=\"agency_manifesto.md\"\n",
|
| 190 |
-
")"
|
| 191 |
-
]
|
| 192 |
-
},
|
| 193 |
-
{
|
| 194 |
-
"cell_type": "code",
|
| 195 |
-
"execution_count": 9,
|
| 196 |
-
"metadata": {},
|
| 197 |
-
"outputs": [
|
| 198 |
-
{
|
| 199 |
-
"name": "stderr",
|
| 200 |
-
"output_type": "stream",
|
| 201 |
-
"text": [
|
| 202 |
-
"/Users/morossini/Projects/professional_demos/agency_swarm_demo/.venv/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
| 203 |
-
" from .autonotebook import tqdm as notebook_tqdm\n",
|
| 204 |
-
"/Users/morossini/Projects/professional_demos/agency_swarm_demo/.venv/lib/python3.11/site-packages/gradio/components/chatbot.py:285: UserWarning: You have not specified a value for the `type` parameter. Defaulting to the 'tuples' format for chatbot messages, but this is deprecated and will be removed in a future version of Gradio. Please set type='messages' instead, which uses openai-style dictionaries with 'role' and 'content' keys.\n",
|
| 205 |
-
" warnings.warn(\n"
|
| 206 |
-
]
|
| 207 |
-
},
|
| 208 |
-
{
|
| 209 |
-
"name": "stdout",
|
| 210 |
-
"output_type": "stream",
|
| 211 |
-
"text": [
|
| 212 |
-
"* Running on local URL: http://127.0.0.1:7860\n",
|
| 213 |
-
"\n",
|
| 214 |
-
"To create a public link, set `share=True` in `launch()`.\n"
|
| 215 |
-
]
|
| 216 |
-
},
|
| 217 |
-
{
|
| 218 |
-
"data": {
|
| 219 |
-
"text/html": [
|
| 220 |
-
"<div><iframe src=\"http://127.0.0.1:7860/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
| 221 |
-
],
|
| 222 |
-
"text/plain": [
|
| 223 |
-
"<IPython.core.display.HTML object>"
|
| 224 |
-
]
|
| 225 |
-
},
|
| 226 |
-
"metadata": {},
|
| 227 |
-
"output_type": "display_data"
|
| 228 |
-
},
|
| 229 |
-
{
|
| 230 |
-
"data": {
|
| 231 |
-
"text/plain": [
|
| 232 |
-
"Gradio Blocks instance: 6 backend functions\n",
|
| 233 |
-
"-------------------------------------------\n",
|
| 234 |
-
"fn_index=0\n",
|
| 235 |
-
" inputs:\n",
|
| 236 |
-
" |-<gradio.components.textbox.Textbox object at 0x11f7e8c50>\n",
|
| 237 |
-
" |-<gradio.components.chatbot.Chatbot object at 0x11f2cd950>\n",
|
| 238 |
-
" outputs:\n",
|
| 239 |
-
" |-<gradio.components.textbox.Textbox object at 0x11f7e8c50>\n",
|
| 240 |
-
" |-<gradio.components.chatbot.Chatbot object at 0x11f2cd950>\n",
|
| 241 |
-
"fn_index=1\n",
|
| 242 |
-
" inputs:\n",
|
| 243 |
-
" |-<gradio.components.textbox.Textbox object at 0x11f7e8c50>\n",
|
| 244 |
-
" |-<gradio.components.chatbot.Chatbot object at 0x11f2cd950>\n",
|
| 245 |
-
" |-<gradio.components.dropdown.Dropdown object at 0x123608550>\n",
|
| 246 |
-
" outputs:\n",
|
| 247 |
-
" |-<gradio.components.textbox.Textbox object at 0x11f7e8c50>\n",
|
| 248 |
-
" |-<gradio.components.chatbot.Chatbot object at 0x11f2cd950>\n",
|
| 249 |
-
" |-<gradio.components.dropdown.Dropdown object at 0x123608550>\n",
|
| 250 |
-
"fn_index=2\n",
|
| 251 |
-
" inputs:\n",
|
| 252 |
-
" |-<gradio.components.dropdown.Dropdown object at 0x123608550>\n",
|
| 253 |
-
" outputs:\n",
|
| 254 |
-
"fn_index=3\n",
|
| 255 |
-
" inputs:\n",
|
| 256 |
-
" |-<gradio.templates.Files object at 0x122a95b50>\n",
|
| 257 |
-
" outputs:\n",
|
| 258 |
-
"fn_index=4\n",
|
| 259 |
-
" inputs:\n",
|
| 260 |
-
" |-<gradio.components.textbox.Textbox object at 0x11f7e8c50>\n",
|
| 261 |
-
" |-<gradio.components.chatbot.Chatbot object at 0x11f2cd950>\n",
|
| 262 |
-
" outputs:\n",
|
| 263 |
-
" |-<gradio.components.textbox.Textbox object at 0x11f7e8c50>\n",
|
| 264 |
-
" |-<gradio.components.chatbot.Chatbot object at 0x11f2cd950>\n",
|
| 265 |
-
"fn_index=5\n",
|
| 266 |
-
" inputs:\n",
|
| 267 |
-
" |-<gradio.components.textbox.Textbox object at 0x11f7e8c50>\n",
|
| 268 |
-
" |-<gradio.components.chatbot.Chatbot object at 0x11f2cd950>\n",
|
| 269 |
-
" |-<gradio.components.dropdown.Dropdown object at 0x123608550>\n",
|
| 270 |
-
" outputs:\n",
|
| 271 |
-
" |-<gradio.components.textbox.Textbox object at 0x11f7e8c50>\n",
|
| 272 |
-
" |-<gradio.components.chatbot.Chatbot object at 0x11f2cd950>\n",
|
| 273 |
-
" |-<gradio.components.dropdown.Dropdown object at 0x123608550>"
|
| 274 |
-
]
|
| 275 |
-
},
|
| 276 |
-
"execution_count": 9,
|
| 277 |
-
"metadata": {},
|
| 278 |
-
"output_type": "execute_result"
|
| 279 |
-
},
|
| 280 |
-
{
|
| 281 |
-
"name": "stdout",
|
| 282 |
-
"output_type": "stream",
|
| 283 |
-
"text": [
|
| 284 |
-
"Message files: []\n",
|
| 285 |
-
"Images: []\n",
|
| 286 |
-
"THREAD:[ user -> project_manager ]: URL https://platform.openai.com/playground/assistants?assistant=asst_q3bAPsDDQmwfijHqK7v8Z655&mode=assistant&thread=thread_awYwQAYJsii7m4eCHOOtpQtX\n",
|
| 287 |
-
"THREAD:[ project_manager -> clickup_agent ]: URL https://platform.openai.com/playground/assistants?assistant=asst_NQWCwFwP37B8T5rATBm6Fi6E&mode=assistant&thread=thread_tT4NsmS9eZuM0FmYLzwfwHMl\n"
|
| 288 |
-
]
|
| 289 |
-
},
|
| 290 |
-
{
|
| 291 |
-
"name": "stderr",
|
| 292 |
-
"output_type": "stream",
|
| 293 |
-
"text": [
|
| 294 |
-
"[2025-02-27 18:56:41,742][ERROR] Tool execution failed: list_id is required for getting list information\n",
|
| 295 |
-
"Traceback (most recent call last):\n",
|
| 296 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/utils/tool_wrapper.py\", line 409, in run\n",
|
| 297 |
-
" result = tool_func._run(**kwargs)\n",
|
| 298 |
-
" ^^^^^^^^^^^^^^^^^^^^^^^^\n",
|
| 299 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/agents/ClickUpAgent/tools/ClickUpTools.py\", line 1055, in _run\n",
|
| 300 |
-
" raise ToolException(\"list_id is required for getting list information\")\n",
|
| 301 |
-
"langchain_core.tools.base.ToolException: list_id is required for getting list information\n"
|
| 302 |
-
]
|
| 303 |
-
},
|
| 304 |
-
{
|
| 305 |
-
"name": "stdout",
|
| 306 |
-
"output_type": "stream",
|
| 307 |
-
"text": [
|
| 308 |
-
"\n",
|
| 309 |
-
"==== GetListTool._run received parameters: ====\n",
|
| 310 |
-
"kwargs: {'kwargs': FieldInfo(annotation=NoneType, required=False, default=None, description='Parameter: kwargs')}\n",
|
| 311 |
-
"\n",
|
| 312 |
-
"==== GetTasksTool._run received parameters: ====\n",
|
| 313 |
-
"kwargs: {'kwargs': FieldInfo(annotation=NoneType, required=False, default=None, description='Parameter: kwargs')}\n",
|
| 314 |
-
"No list_id found in parameters, using hardcoded value 901307715461\n",
|
| 315 |
-
"list_id being used: 901307715461\n",
|
| 316 |
-
"==== End parameters ====\n",
|
| 317 |
-
"\n",
|
| 318 |
-
"URL being used: https://api.clickup.com/api/v2/list/901307715461/task\n",
|
| 319 |
-
"Response status code: 200\n",
|
| 320 |
-
"Returning filtered response with 1 items\n"
|
| 321 |
-
]
|
| 322 |
-
},
|
| 323 |
-
{
|
| 324 |
-
"name": "stderr",
|
| 325 |
-
"output_type": "stream",
|
| 326 |
-
"text": [
|
| 327 |
-
"[2025-02-27 18:56:46,276][ERROR] Tool execution failed: task_id is required for getting a task\n",
|
| 328 |
-
"Traceback (most recent call last):\n",
|
| 329 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/utils/tool_wrapper.py\", line 409, in run\n",
|
| 330 |
-
" result = tool_func._run(**kwargs)\n",
|
| 331 |
-
" ^^^^^^^^^^^^^^^^^^^^^^^^\n",
|
| 332 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/agents/ClickUpAgent/tools/ClickUpTools.py\", line 1299, in _run\n",
|
| 333 |
-
" raise ToolException(\"task_id is required for getting a task\")\n",
|
| 334 |
-
"langchain_core.tools.base.ToolException: task_id is required for getting a task\n"
|
| 335 |
-
]
|
| 336 |
-
},
|
| 337 |
-
{
|
| 338 |
-
"name": "stdout",
|
| 339 |
-
"output_type": "stream",
|
| 340 |
-
"text": [
|
| 341 |
-
"\n",
|
| 342 |
-
"==== GetTaskTool._run received parameters: ====\n",
|
| 343 |
-
"kwargs: {'kwargs': FieldInfo(annotation=NoneType, required=False, default=None, description='Parameter: kwargs')}\n"
|
| 344 |
-
]
|
| 345 |
-
},
|
| 346 |
-
{
|
| 347 |
-
"name": "stderr",
|
| 348 |
-
"output_type": "stream",
|
| 349 |
-
"text": [
|
| 350 |
-
"[2025-02-27 18:56:47,808][ERROR] Tool execution failed: task_id is required for getting a task\n",
|
| 351 |
-
"Traceback (most recent call last):\n",
|
| 352 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/utils/tool_wrapper.py\", line 409, in run\n",
|
| 353 |
-
" result = tool_func._run(**kwargs)\n",
|
| 354 |
-
" ^^^^^^^^^^^^^^^^^^^^^^^^\n",
|
| 355 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/agents/ClickUpAgent/tools/ClickUpTools.py\", line 1299, in _run\n",
|
| 356 |
-
" raise ToolException(\"task_id is required for getting a task\")\n",
|
| 357 |
-
"langchain_core.tools.base.ToolException: task_id is required for getting a task\n"
|
| 358 |
-
]
|
| 359 |
-
},
|
| 360 |
-
{
|
| 361 |
-
"name": "stdout",
|
| 362 |
-
"output_type": "stream",
|
| 363 |
-
"text": [
|
| 364 |
-
"\n",
|
| 365 |
-
"==== GetTaskTool._run received parameters: ====\n",
|
| 366 |
-
"kwargs: {'kwargs': FieldInfo(annotation=NoneType, required=False, default=None, description='Parameter: kwargs')}\n",
|
| 367 |
-
"Message files: []\n",
|
| 368 |
-
"Images: []\n",
|
| 369 |
-
"THREAD:[ user -> project_manager ]: URL https://platform.openai.com/playground/assistants?assistant=asst_q3bAPsDDQmwfijHqK7v8Z655&mode=assistant&thread=thread_awYwQAYJsii7m4eCHOOtpQtX\n",
|
| 370 |
-
"THREAD:[ project_manager -> clickup_agent ]: URL https://platform.openai.com/playground/assistants?assistant=asst_NQWCwFwP37B8T5rATBm6Fi6E&mode=assistant&thread=thread_tT4NsmS9eZuM0FmYLzwfwHMl\n"
|
| 371 |
-
]
|
| 372 |
-
},
|
| 373 |
-
{
|
| 374 |
-
"name": "stderr",
|
| 375 |
-
"output_type": "stream",
|
| 376 |
-
"text": [
|
| 377 |
-
"[2025-02-27 18:58:01,081][ERROR] Tool execution failed: task_id is required for getting a task\n",
|
| 378 |
-
"Traceback (most recent call last):\n",
|
| 379 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/utils/tool_wrapper.py\", line 409, in run\n",
|
| 380 |
-
" result = tool_func._run(**kwargs)\n",
|
| 381 |
-
" ^^^^^^^^^^^^^^^^^^^^^^^^\n",
|
| 382 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/agents/ClickUpAgent/tools/ClickUpTools.py\", line 1299, in _run\n",
|
| 383 |
-
" raise ToolException(\"task_id is required for getting a task\")\n",
|
| 384 |
-
"langchain_core.tools.base.ToolException: task_id is required for getting a task\n"
|
| 385 |
-
]
|
| 386 |
-
},
|
| 387 |
-
{
|
| 388 |
-
"name": "stdout",
|
| 389 |
-
"output_type": "stream",
|
| 390 |
-
"text": [
|
| 391 |
-
"\n",
|
| 392 |
-
"==== GetTaskTool._run received parameters: ====\n",
|
| 393 |
-
"kwargs: {'kwargs': FieldInfo(annotation=NoneType, required=False, default=None, description='Parameter: kwargs')}\n"
|
| 394 |
-
]
|
| 395 |
-
},
|
| 396 |
-
{
|
| 397 |
-
"name": "stderr",
|
| 398 |
-
"output_type": "stream",
|
| 399 |
-
"text": [
|
| 400 |
-
"[2025-02-27 18:58:04,314][ERROR] Tool execution failed: task_id is required for getting a task\n",
|
| 401 |
-
"Traceback (most recent call last):\n",
|
| 402 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/utils/tool_wrapper.py\", line 409, in run\n",
|
| 403 |
-
" result = tool_func._run(**kwargs)\n",
|
| 404 |
-
" ^^^^^^^^^^^^^^^^^^^^^^^^\n",
|
| 405 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/agents/ClickUpAgent/tools/ClickUpTools.py\", line 1299, in _run\n",
|
| 406 |
-
" raise ToolException(\"task_id is required for getting a task\")\n",
|
| 407 |
-
"langchain_core.tools.base.ToolException: task_id is required for getting a task\n"
|
| 408 |
-
]
|
| 409 |
-
},
|
| 410 |
-
{
|
| 411 |
-
"name": "stdout",
|
| 412 |
-
"output_type": "stream",
|
| 413 |
-
"text": [
|
| 414 |
-
"\n",
|
| 415 |
-
"==== GetTaskTool._run received parameters: ====\n",
|
| 416 |
-
"kwargs: {'kwargs': FieldInfo(annotation=NoneType, required=False, default=None, description='Parameter: kwargs')}\n"
|
| 417 |
-
]
|
| 418 |
-
},
|
| 419 |
-
{
|
| 420 |
-
"name": "stderr",
|
| 421 |
-
"output_type": "stream",
|
| 422 |
-
"text": [
|
| 423 |
-
"[2025-02-27 18:58:08,100][ERROR] Tool execution failed: task_id is required for getting a task\n",
|
| 424 |
-
"Traceback (most recent call last):\n",
|
| 425 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/utils/tool_wrapper.py\", line 409, in run\n",
|
| 426 |
-
" result = tool_func._run(**kwargs)\n",
|
| 427 |
-
" ^^^^^^^^^^^^^^^^^^^^^^^^\n",
|
| 428 |
-
" File \"/Users/morossini/Projects/professional_demos/agency_swarm_demo/agency_ai_demo/agents/ClickUpAgent/tools/ClickUpTools.py\", line 1299, in _run\n",
|
| 429 |
-
" raise ToolException(\"task_id is required for getting a task\")\n",
|
| 430 |
-
"langchain_core.tools.base.ToolException: task_id is required for getting a task\n"
|
| 431 |
-
]
|
| 432 |
-
},
|
| 433 |
-
{
|
| 434 |
-
"name": "stdout",
|
| 435 |
-
"output_type": "stream",
|
| 436 |
-
"text": [
|
| 437 |
-
"\n",
|
| 438 |
-
"==== GetTaskTool._run received parameters: ====\n",
|
| 439 |
-
"kwargs: {'kwargs': FieldInfo(annotation=NoneType, required=False, default=None, description='Parameter: kwargs')}\n",
|
| 440 |
-
"Message files: []\n",
|
| 441 |
-
"Images: []\n",
|
| 442 |
-
"THREAD:[ user -> project_manager ]: URL https://platform.openai.com/playground/assistants?assistant=asst_q3bAPsDDQmwfijHqK7v8Z655&mode=assistant&thread=thread_awYwQAYJsii7m4eCHOOtpQtX\n",
|
| 443 |
-
"THREAD:[ project_manager -> clickup_agent ]: URL https://platform.openai.com/playground/assistants?assistant=asst_NQWCwFwP37B8T5rATBm6Fi6E&mode=assistant&thread=thread_tT4NsmS9eZuM0FmYLzwfwHMl\n",
|
| 444 |
-
"\n",
|
| 445 |
-
"==== CreateTaskTool._run received parameters: ====\n",
|
| 446 |
-
"kwargs: {'kwargs': FieldInfo(annotation=NoneType, required=False, default=None, description='Parameter: kwargs')}\n",
|
| 447 |
-
"No list_id found in parameters, using hardcoded value 901307715461\n",
|
| 448 |
-
"list_id being used: 901307715461\n",
|
| 449 |
-
"==== End parameters ====\n",
|
| 450 |
-
"\n",
|
| 451 |
-
"URL being used: https://api.clickup.com/api/v2/list/901307715461/task\n",
|
| 452 |
-
"Request parameters: {'name': 'API TEST TASK', 'assignees': [81918955]}\n",
|
| 453 |
-
"Response status code: 200\n",
|
| 454 |
-
"Error response: {'id': '86a706rnx', 'custom_id': None, 'custom_item_id': 0, 'name': 'API TEST TASK', 'text_content': '', 'description': '', 'status': {'id': 'c90131663060_Uk5SstGY', 'status': 'backlog', 'color': '#9c09bc', 'orderindex': 0, 'type': 'open'}, 'orderindex': '120305513.00000000000000000000000000000000', 'date_created': '1740693545341', 'date_updated': '1740693545341', 'date_closed': None, 'date_done': None, 'archived': False, 'creator': {'id': 84141406, 'username': 'Ana Beatriz', 'color': '#455963', 'email': 'ti@cogmo.com.br', 'profilePicture': 'https://attachments.clickup.com/profilePictures/84141406_ZkZ.jpg'}, 'assignees': [{'id': 81918955, 'username': 'João Guilherme Silva Morossini', 'color': '#81b1ff', 'initials': 'JM', 'email': 'joaog.morossini@gmail.com', 'profilePicture': 'https://attachments.clickup.com/profilePictures/81918955_kcK.jpg'}], 'group_assignees': [], 'watchers': [{'id': 81918955, 'username': 'João Guilherme Silva Morossini', 'color': '#81b1ff', 'initials': 'JM', 'email': 'joaog.morossini@gmail.com', 'profilePicture': 'https://attachments.clickup.com/profilePictures/81918955_kcK.jpg'}, {'id': 84141406, 'username': 'Ana Beatriz', 'color': '#455963', 'initials': 'AB', 'email': 'ti@cogmo.com.br', 'profilePicture': 'https://attachments.clickup.com/profilePictures/84141406_ZkZ.jpg'}], 'checklists': [], 'tags': [], 'parent': None, 'top_level_parent': None, 'priority': None, 'due_date': None, 'start_date': None, 'points': None, 'time_estimate': None, 'time_spent': 0, 'custom_fields': [], 'dependencies': [], 'linked_tasks': [], 'locations': [], 'team_id': '12927880', 'url': 'https://app.clickup.com/t/86a706rnx', 'sharing': {'public': False, 'public_share_expires_on': None, 'public_fields': ['assignees', 'priority', 'due_date', 'content', 'comments', 'attachments', 'customFields', 'subtasks', 'tags', 'checklists', 'coverimage'], 'token': None, 'seo_optimized': False}, 'permission_level': 'create', 'list': {'id': '901307715461', 'name': 'test_clickup_tool', 'access': True}, 'project': {'id': '90131663060', 'name': 'Agentes', 'hidden': False, 'access': True}, 'folder': {'id': '90131663060', 'name': 'Agentes', 'hidden': False, 'access': True}, 'space': {'id': '54804921'}}\n",
|
| 455 |
-
"Returning filtered response: {\n",
|
| 456 |
-
" \"id\": \"86a706rnx\",\n",
|
| 457 |
-
" \"name\": \"API TEST TASK\",\n",
|
| 458 |
-
" \"status\": \"backlog\",\n",
|
| 459 |
-
" \"assignees\": [\n",
|
| 460 |
-
" {\n",
|
| 461 |
-
" \"id\": 81918955,\n",
|
| 462 |
-
" \"username\": \"Jo\\u00e3o Guilherme Silva Morossini\",\n",
|
| 463 |
-
" \"color\": \"#81b1ff\",\n",
|
| 464 |
-
" \"initials\": \"JM\",\n",
|
| 465 |
-
" \"email\": \"joaog.morossini@gmail.com\",\n",
|
| 466 |
-
" \"profilePicture\": \"https://attachments.clickup.com/profilePictures/81918955_kcK.jpg\"\n",
|
| 467 |
-
" }\n",
|
| 468 |
-
" ],\n",
|
| 469 |
-
" \"due_date\": null,\n",
|
| 470 |
-
" \"error\": null\n",
|
| 471 |
-
"}\n",
|
| 472 |
-
"Message files: []\n",
|
| 473 |
-
"Images: []\n",
|
| 474 |
-
"THREAD:[ user -> project_manager ]: URL https://platform.openai.com/playground/assistants?assistant=asst_q3bAPsDDQmwfijHqK7v8Z655&mode=assistant&thread=thread_awYwQAYJsii7m4eCHOOtpQtX\n",
|
| 475 |
-
"THREAD:[ project_manager -> clickup_agent ]: URL https://platform.openai.com/playground/assistants?assistant=asst_NQWCwFwP37B8T5rATBm6Fi6E&mode=assistant&thread=thread_tT4NsmS9eZuM0FmYLzwfwHMl\n",
|
| 476 |
-
"\n",
|
| 477 |
-
"==== CreateTaskTool._run received parameters: ====\n",
|
| 478 |
-
"kwargs: {'kwargs': FieldInfo(annotation=NoneType, required=False, default=None, description='Parameter: kwargs')}\n",
|
| 479 |
-
"No list_id found in parameters, using hardcoded value 901307715461\n",
|
| 480 |
-
"list_id being used: 901307715461\n",
|
| 481 |
-
"==== End parameters ====\n",
|
| 482 |
-
"\n",
|
| 483 |
-
"URL being used: https://api.clickup.com/api/v2/list/901307715461/task\n",
|
| 484 |
-
"Request parameters: {'name': 'API TEST TASK', 'assignees': [81918955]}\n",
|
| 485 |
-
"Response status code: 200\n",
|
| 486 |
-
"Error response: {'id': '86a706rxv', 'custom_id': None, 'custom_item_id': 0, 'name': 'API TEST TASK', 'text_content': '', 'description': '', 'status': {'id': 'c90131663060_Uk5SstGY', 'status': 'backlog', 'color': '#9c09bc', 'orderindex': 0, 'type': 'open'}, 'orderindex': '120305514.00000000000000000000000000000000', 'date_created': '1740693581177', 'date_updated': '1740693581177', 'date_closed': None, 'date_done': None, 'archived': False, 'creator': {'id': 84141406, 'username': 'Ana Beatriz', 'color': '#455963', 'email': 'ti@cogmo.com.br', 'profilePicture': 'https://attachments.clickup.com/profilePictures/84141406_ZkZ.jpg'}, 'assignees': [{'id': 81918955, 'username': 'João Guilherme Silva Morossini', 'color': '#81b1ff', 'initials': 'JM', 'email': 'joaog.morossini@gmail.com', 'profilePicture': 'https://attachments.clickup.com/profilePictures/81918955_kcK.jpg'}], 'group_assignees': [], 'watchers': [{'id': 81918955, 'username': 'João Guilherme Silva Morossini', 'color': '#81b1ff', 'initials': 'JM', 'email': 'joaog.morossini@gmail.com', 'profilePicture': 'https://attachments.clickup.com/profilePictures/81918955_kcK.jpg'}, {'id': 84141406, 'username': 'Ana Beatriz', 'color': '#455963', 'initials': 'AB', 'email': 'ti@cogmo.com.br', 'profilePicture': 'https://attachments.clickup.com/profilePictures/84141406_ZkZ.jpg'}], 'checklists': [], 'tags': [], 'parent': None, 'top_level_parent': None, 'priority': None, 'due_date': None, 'start_date': None, 'points': None, 'time_estimate': None, 'time_spent': 0, 'custom_fields': [], 'dependencies': [], 'linked_tasks': [], 'locations': [], 'team_id': '12927880', 'url': 'https://app.clickup.com/t/86a706rxv', 'sharing': {'public': False, 'public_share_expires_on': None, 'public_fields': ['assignees', 'priority', 'due_date', 'content', 'comments', 'attachments', 'customFields', 'subtasks', 'tags', 'checklists', 'coverimage'], 'token': None, 'seo_optimized': False}, 'permission_level': 'create', 'list': {'id': '901307715461', 'name': 'test_clickup_tool', 'access': True}, 'project': {'id': '90131663060', 'name': 'Agentes', 'hidden': False, 'access': True}, 'folder': {'id': '90131663060', 'name': 'Agentes', 'hidden': False, 'access': True}, 'space': {'id': '54804921'}}\n",
|
| 487 |
-
"Returning filtered response: {\n",
|
| 488 |
-
" \"id\": \"86a706rxv\",\n",
|
| 489 |
-
" \"name\": \"API TEST TASK\",\n",
|
| 490 |
-
" \"status\": \"backlog\",\n",
|
| 491 |
-
" \"assignees\": [\n",
|
| 492 |
-
" {\n",
|
| 493 |
-
" \"id\": 81918955,\n",
|
| 494 |
-
" \"username\": \"Jo\\u00e3o Guilherme Silva Morossini\",\n",
|
| 495 |
-
" \"color\": \"#81b1ff\",\n",
|
| 496 |
-
" \"initials\": \"JM\",\n",
|
| 497 |
-
" \"email\": \"joaog.morossini@gmail.com\",\n",
|
| 498 |
-
" \"profilePicture\": \"https://attachments.clickup.com/profilePictures/81918955_kcK.jpg\"\n",
|
| 499 |
-
" }\n",
|
| 500 |
-
" ],\n",
|
| 501 |
-
" \"due_date\": null,\n",
|
| 502 |
-
" \"error\": null\n",
|
| 503 |
-
"}\n"
|
| 504 |
-
]
|
| 505 |
-
}
|
| 506 |
-
],
|
| 507 |
-
"source": [
|
| 508 |
-
"agency.demo_gradio()"
|
| 509 |
-
]
|
| 510 |
-
}
|
| 511 |
-
],
|
| 512 |
-
"metadata": {
|
| 513 |
-
"kernelspec": {
|
| 514 |
-
"display_name": ".venv",
|
| 515 |
-
"language": "python",
|
| 516 |
-
"name": "python3"
|
| 517 |
-
},
|
| 518 |
-
"language_info": {
|
| 519 |
-
"codemirror_mode": {
|
| 520 |
-
"name": "ipython",
|
| 521 |
-
"version": 3
|
| 522 |
-
},
|
| 523 |
-
"file_extension": ".py",
|
| 524 |
-
"mimetype": "text/x-python",
|
| 525 |
-
"name": "python",
|
| 526 |
-
"nbconvert_exporter": "python",
|
| 527 |
-
"pygments_lexer": "ipython3",
|
| 528 |
-
"version": "3.11.3"
|
| 529 |
-
}
|
| 530 |
-
},
|
| 531 |
-
"nbformat": 4,
|
| 532 |
-
"nbformat_minor": 2
|
| 533 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
agency_ai_demo/tests/test_clickup_agent.py
DELETED
|
@@ -1,94 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import traceback
|
| 4 |
-
from dotenv import load_dotenv
|
| 5 |
-
from openai import AzureOpenAI
|
| 6 |
-
from agency_swarm import set_openai_client, Agent, Agency
|
| 7 |
-
|
| 8 |
-
from agents.ClickUpAgent.tools.ClickUpTools import initialize_clickup_tools
|
| 9 |
-
|
| 10 |
-
load_dotenv()
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
def main():
|
| 14 |
-
try:
|
| 15 |
-
# Accept query from command line arguments if provided
|
| 16 |
-
if len(sys.argv) > 1:
|
| 17 |
-
query = sys.argv[1]
|
| 18 |
-
else:
|
| 19 |
-
# Default query if no argument provided
|
| 20 |
-
query = 'Use the create_task_tool to create a new task in list_id 901307715461 with name "API TEST TASK" and assignees [81918955]. Make sure to pass the list_id parameter correctly.'
|
| 21 |
-
|
| 22 |
-
print("Initializing OpenAI client...")
|
| 23 |
-
client = AzureOpenAI(
|
| 24 |
-
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
|
| 25 |
-
api_version=os.getenv("OPENAI_API_VERSION"),
|
| 26 |
-
azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
|
| 27 |
-
timeout=10,
|
| 28 |
-
max_retries=5,
|
| 29 |
-
)
|
| 30 |
-
|
| 31 |
-
set_openai_client(client)
|
| 32 |
-
|
| 33 |
-
print("Converting ClickUp tools...")
|
| 34 |
-
clickup_tools = initialize_clickup_tools()
|
| 35 |
-
|
| 36 |
-
# Instructions similar to what's in the notebook
|
| 37 |
-
clickup_instructions = """
|
| 38 |
-
1. GERENCIAMENTO_DE_PROJETOS:
|
| 39 |
-
A equipe usa o ClickUp para gerenciar projetos e tarefas.
|
| 40 |
-
|
| 41 |
-
1.1 ESTRUTURA_DO_CLICKUP
|
| 42 |
-
-> Workspace: O nível mais alto de organização no ClickUp. Contém todos os seus Espaços.
|
| 43 |
-
--> Space: Uma coleção de Pastas e Listas. É uma maneira de agrupar trabalhos relacionados.
|
| 44 |
-
---> Folder: Usado para agrupar Listas.
|
| 45 |
-
----> List: Usado para agrupar tarefas. As listas podem estar em uma Pasta ou diretamente em um Espaço.
|
| 46 |
-
-----> Task: A unidade básica de trabalho no ClickUp, atribuível com datas de vencimento.
|
| 47 |
-
------> Subtask: Uma tarefa filha de uma Tarefa pai, atribuível a diferentes pessoas.
|
| 48 |
-
|
| 49 |
-
1.1.1 IDS_PADRÃO_DO_CLICKUP
|
| 50 |
-
Use esses IDs, a menos que especificado de outra forma
|
| 51 |
-
- 'Workspace' (também conhecido como "team_id"): 12927880
|
| 52 |
-
- ID do espaço 'Projetos': 54804921
|
| 53 |
-
- ID da pasta 'Agentes': 90131663060
|
| 54 |
-
- ID da lista 'test_clickup_tool': 901307715461
|
| 55 |
-
|
| 56 |
-
1.1.2 USUÁRIOS_ATIVOS_DO_CLICKUP (id, nome de usuário, email)
|
| 57 |
-
- 81918955, João Guilherme Silva Morossini, joaog.morossini@gmail.com
|
| 58 |
-
"""
|
| 59 |
-
|
| 60 |
-
print("Creating ClickUp agent...")
|
| 61 |
-
clickup_agent = Agent(
|
| 62 |
-
name="clickup_agent",
|
| 63 |
-
description="I am a ClickUp agent that helps manage tasks and projects",
|
| 64 |
-
instructions=clickup_instructions,
|
| 65 |
-
model="gpt-4o",
|
| 66 |
-
tools=clickup_tools,
|
| 67 |
-
)
|
| 68 |
-
|
| 69 |
-
# Create the agency with a single agent
|
| 70 |
-
print("Creating agency...")
|
| 71 |
-
agency = Agency(
|
| 72 |
-
agency_chart=[
|
| 73 |
-
clickup_agent, # Just the clickup agent
|
| 74 |
-
]
|
| 75 |
-
)
|
| 76 |
-
|
| 77 |
-
# Send the query to the agent
|
| 78 |
-
print("Sending query to agent...")
|
| 79 |
-
print(f"Query: '{query}'")
|
| 80 |
-
print("Using agency.get_completion() method...")
|
| 81 |
-
response = agency.get_completion(query)
|
| 82 |
-
|
| 83 |
-
print(f"\nAgent response: {response}")
|
| 84 |
-
|
| 85 |
-
print("\nDone!")
|
| 86 |
-
|
| 87 |
-
except Exception as e:
|
| 88 |
-
print(f"\nAn error occurred: {e}")
|
| 89 |
-
print("\nTraceback:")
|
| 90 |
-
traceback.print_exception(*sys.exc_info())
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
if __name__ == "__main__":
|
| 94 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
agency_ai_demo/tests/test_clickup_tool_conversion.py
DELETED
|
@@ -1,145 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import inspect
|
| 4 |
-
import logging
|
| 5 |
-
from typing import List, Type, Any, Callable, Dict, Tuple
|
| 6 |
-
|
| 7 |
-
# Setup logging
|
| 8 |
-
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
|
| 9 |
-
logger = logging.getLogger(__name__)
|
| 10 |
-
|
| 11 |
-
# Add the parent directory to sys.path to enable imports
|
| 12 |
-
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 13 |
-
|
| 14 |
-
# Import the tool wrapper
|
| 15 |
-
from utils.tool_wrapper import convert_langchain_tool, LangChainBaseTool
|
| 16 |
-
|
| 17 |
-
# Import all tools from the clickup_tools module
|
| 18 |
-
from agents.ClickUpAgent.tools.ClickUpTools import (
|
| 19 |
-
CreateTaskTool,
|
| 20 |
-
DeleteTaskTool,
|
| 21 |
-
UpdateTaskTool,
|
| 22 |
-
CreateTaskCommentTool,
|
| 23 |
-
GetTaskCommentsTool,
|
| 24 |
-
AddTaskToListTool,
|
| 25 |
-
RemoveTaskFromListTool,
|
| 26 |
-
CreateFolderlessListTool,
|
| 27 |
-
GetListsTool,
|
| 28 |
-
AddDependencyTool,
|
| 29 |
-
GetAuthorizedTeamsWorkspacesTool,
|
| 30 |
-
GetAuthorizedUserTool,
|
| 31 |
-
GetFolderTool,
|
| 32 |
-
GetFoldersTool,
|
| 33 |
-
GetListTool,
|
| 34 |
-
GetListMembersTool,
|
| 35 |
-
GetTaskMembersTool,
|
| 36 |
-
GetSpaceTool,
|
| 37 |
-
GetSpacesTool,
|
| 38 |
-
GetFilteredTeamTasksTool,
|
| 39 |
-
GetTasksTool,
|
| 40 |
-
GetTaskTool,
|
| 41 |
-
GetWorkspaceSeatsTool,
|
| 42 |
-
date_to_timestamp,
|
| 43 |
-
)
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
def test_tool_conversion():
|
| 47 |
-
"""
|
| 48 |
-
Test the conversion of all ClickUp tools to agency-swarm compatible tools.
|
| 49 |
-
"""
|
| 50 |
-
# Define all tools to test explicitly
|
| 51 |
-
class_tools = [
|
| 52 |
-
CreateTaskTool,
|
| 53 |
-
DeleteTaskTool,
|
| 54 |
-
UpdateTaskTool,
|
| 55 |
-
CreateTaskCommentTool,
|
| 56 |
-
GetTaskCommentsTool,
|
| 57 |
-
AddTaskToListTool,
|
| 58 |
-
RemoveTaskFromListTool,
|
| 59 |
-
CreateFolderlessListTool,
|
| 60 |
-
GetListsTool,
|
| 61 |
-
AddDependencyTool,
|
| 62 |
-
GetAuthorizedTeamsWorkspacesTool,
|
| 63 |
-
GetAuthorizedUserTool,
|
| 64 |
-
GetFolderTool,
|
| 65 |
-
GetFoldersTool,
|
| 66 |
-
GetListTool,
|
| 67 |
-
GetListMembersTool,
|
| 68 |
-
GetTaskMembersTool,
|
| 69 |
-
GetSpaceTool,
|
| 70 |
-
GetSpacesTool,
|
| 71 |
-
GetFilteredTeamTasksTool,
|
| 72 |
-
GetTasksTool,
|
| 73 |
-
GetTaskTool,
|
| 74 |
-
GetWorkspaceSeatsTool,
|
| 75 |
-
]
|
| 76 |
-
|
| 77 |
-
function_tools = [date_to_timestamp]
|
| 78 |
-
|
| 79 |
-
logger.info(
|
| 80 |
-
f"Testing {len(class_tools)} class-based tools and {len(function_tools)} function-based tools"
|
| 81 |
-
)
|
| 82 |
-
|
| 83 |
-
# Test conversion of class-based tools
|
| 84 |
-
successful_conversions = []
|
| 85 |
-
failed_conversions = []
|
| 86 |
-
|
| 87 |
-
# Convert and test each class-based tool
|
| 88 |
-
for tool_cls in class_tools:
|
| 89 |
-
tool_name = tool_cls.__name__
|
| 90 |
-
try:
|
| 91 |
-
logger.info(f"Converting {tool_name}...")
|
| 92 |
-
converted_tool = convert_langchain_tool(tool_cls)
|
| 93 |
-
successful_conversions.append((tool_name, converted_tool))
|
| 94 |
-
logger.info(f"✅ Successfully converted {tool_name}")
|
| 95 |
-
except Exception as e:
|
| 96 |
-
logger.error(f"❌ Failed to convert {tool_name}: {e}")
|
| 97 |
-
failed_conversions.append((tool_name, str(e)))
|
| 98 |
-
|
| 99 |
-
# Convert and test each function-based tool
|
| 100 |
-
for tool_func in function_tools:
|
| 101 |
-
# For function tools, use the function's name directly
|
| 102 |
-
if hasattr(tool_func, "__name__"):
|
| 103 |
-
tool_name = tool_func.__name__
|
| 104 |
-
else:
|
| 105 |
-
tool_name = "function_tool"
|
| 106 |
-
|
| 107 |
-
try:
|
| 108 |
-
logger.info(f"Converting {tool_name}...")
|
| 109 |
-
converted_tool = convert_langchain_tool(tool_func)
|
| 110 |
-
successful_conversions.append((tool_name, converted_tool))
|
| 111 |
-
logger.info(f"✅ Successfully converted {tool_name}")
|
| 112 |
-
except Exception as e:
|
| 113 |
-
logger.error(f"❌ Failed to convert {tool_name}: {e}")
|
| 114 |
-
failed_conversions.append((tool_name, str(e)))
|
| 115 |
-
|
| 116 |
-
# Print summary report
|
| 117 |
-
print("\n" + "=" * 50)
|
| 118 |
-
print("CONVERSION SUMMARY REPORT")
|
| 119 |
-
print("=" * 50)
|
| 120 |
-
print(f"Total tools tested: {len(class_tools) + len(function_tools)}")
|
| 121 |
-
print(f"Successfully converted: {len(successful_conversions)}")
|
| 122 |
-
print(f"Failed conversions: {len(failed_conversions)}")
|
| 123 |
-
|
| 124 |
-
if successful_conversions:
|
| 125 |
-
print("\n" + "-" * 25)
|
| 126 |
-
print("SUCCESSFULLY CONVERTED TOOLS:")
|
| 127 |
-
print("-" * 25)
|
| 128 |
-
for name, _ in successful_conversions:
|
| 129 |
-
print(f"✅ {name}")
|
| 130 |
-
|
| 131 |
-
if failed_conversions:
|
| 132 |
-
print("\n" + "-" * 25)
|
| 133 |
-
print("FAILED CONVERSIONS:")
|
| 134 |
-
print("-" * 25)
|
| 135 |
-
for name, error in failed_conversions:
|
| 136 |
-
print(f"❌ {name}: {error}")
|
| 137 |
-
|
| 138 |
-
return successful_conversions, failed_conversions
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
if __name__ == "__main__":
|
| 142 |
-
successful_tools, failed_tools = test_tool_conversion()
|
| 143 |
-
|
| 144 |
-
# Exit with non-zero code if any conversions failed
|
| 145 |
-
sys.exit(1 if failed_tools else 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
agency_ai_demo/tests/test_clickup_tools.py
DELETED
|
@@ -1,170 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
from dotenv import load_dotenv
|
| 4 |
-
import json
|
| 5 |
-
|
| 6 |
-
# Add the parent directory to sys.path to import modules
|
| 7 |
-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
| 8 |
-
|
| 9 |
-
from agents.ClickUpAgent.tools.ClickUpTools import (
|
| 10 |
-
CreateTaskTool,
|
| 11 |
-
DeleteTaskTool,
|
| 12 |
-
UpdateTaskTool,
|
| 13 |
-
AddDependencyTool,
|
| 14 |
-
GetListTool,
|
| 15 |
-
GetTasksTool,
|
| 16 |
-
GetTaskTool,
|
| 17 |
-
)
|
| 18 |
-
|
| 19 |
-
# Load environment variables
|
| 20 |
-
load_dotenv()
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
def test_create_task():
|
| 24 |
-
print("\n===== Testing CreateTaskTool =====")
|
| 25 |
-
tool = CreateTaskTool()
|
| 26 |
-
result = tool._run(
|
| 27 |
-
list_id="901307715461",
|
| 28 |
-
name="TEST TASK FROM DIRECT TOOL",
|
| 29 |
-
description="This is a test task created using the CreateTaskTool directly",
|
| 30 |
-
assignees=[81918955],
|
| 31 |
-
)
|
| 32 |
-
print("Result:", result)
|
| 33 |
-
return result
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
def test_get_tasks():
|
| 37 |
-
print("\n===== Testing GetTasksTool =====")
|
| 38 |
-
tool = GetTasksTool()
|
| 39 |
-
result = tool._run(list_id="901307715461")
|
| 40 |
-
print("Tasks found:", len(result))
|
| 41 |
-
|
| 42 |
-
# Print the first task details as an example
|
| 43 |
-
if result and len(result) > 0:
|
| 44 |
-
print("Example task:")
|
| 45 |
-
task = result[0]
|
| 46 |
-
print(f"ID: {task.get('id')}")
|
| 47 |
-
print(f"Name: {task.get('name')}")
|
| 48 |
-
print(f"Status: {task.get('status')}")
|
| 49 |
-
print(f"Assignees: {task.get('assignees')}")
|
| 50 |
-
|
| 51 |
-
return result
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
def test_get_task(task_id=None):
|
| 55 |
-
print("\n===== Testing GetTaskTool =====")
|
| 56 |
-
# If no task_id is provided, get the first task from the list
|
| 57 |
-
if not task_id:
|
| 58 |
-
tasks = test_get_tasks()
|
| 59 |
-
if tasks and len(tasks) > 0:
|
| 60 |
-
task_id = tasks[0].get("id")
|
| 61 |
-
print(f"Using first task ID: {task_id}")
|
| 62 |
-
|
| 63 |
-
tool = GetTaskTool()
|
| 64 |
-
result = tool._run(task_id=task_id)
|
| 65 |
-
print("Result:", json.dumps(result, indent=2))
|
| 66 |
-
return result
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
def test_update_task(task_id=None):
|
| 70 |
-
print("\n===== Testing UpdateTaskTool =====")
|
| 71 |
-
# If no task_id is provided, get the first task from the list
|
| 72 |
-
if not task_id:
|
| 73 |
-
tasks = test_get_tasks()
|
| 74 |
-
if tasks and len(tasks) > 0:
|
| 75 |
-
task_id = tasks[0].get("id")
|
| 76 |
-
print(f"Using first task ID: {task_id}")
|
| 77 |
-
|
| 78 |
-
tool = UpdateTaskTool()
|
| 79 |
-
result = tool._run(
|
| 80 |
-
task_id=task_id,
|
| 81 |
-
name="UPDATED TASK NAME",
|
| 82 |
-
description="This task was updated using the UpdateTaskTool directly",
|
| 83 |
-
)
|
| 84 |
-
print("Result:", result)
|
| 85 |
-
return result
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
def test_add_dependency(task_id=None, depends_on=None):
|
| 89 |
-
print("\n===== Testing AddDependencyTool =====")
|
| 90 |
-
# If no task_ids are provided, get the first two tasks from the list
|
| 91 |
-
if not task_id or not depends_on:
|
| 92 |
-
tasks = test_get_tasks()
|
| 93 |
-
if tasks and len(tasks) >= 2:
|
| 94 |
-
task_id = tasks[0].get("id")
|
| 95 |
-
depends_on = tasks[1].get("id")
|
| 96 |
-
print(f"Using task ID: {task_id}")
|
| 97 |
-
print(f"Using depends_on ID: {depends_on}")
|
| 98 |
-
|
| 99 |
-
tool = AddDependencyTool()
|
| 100 |
-
result = tool._run(task_id=task_id, depends_on=depends_on)
|
| 101 |
-
print("Result:", result)
|
| 102 |
-
return result
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
def test_delete_task(task_id=None):
|
| 106 |
-
print("\n===== Testing DeleteTaskTool =====")
|
| 107 |
-
# If no task_id is provided, create a new task to delete
|
| 108 |
-
if not task_id:
|
| 109 |
-
created_task = test_create_task()
|
| 110 |
-
if isinstance(created_task, dict) and "id" in created_task:
|
| 111 |
-
task_id = created_task["id"]
|
| 112 |
-
print(f"Using newly created task ID: {task_id}")
|
| 113 |
-
|
| 114 |
-
tool = DeleteTaskTool()
|
| 115 |
-
result = tool._run(task_id=task_id)
|
| 116 |
-
print("Result:", result)
|
| 117 |
-
return result
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
def test_get_list():
|
| 121 |
-
print("\n===== Testing GetListTool =====")
|
| 122 |
-
tool = GetListTool()
|
| 123 |
-
result = tool._run(list_id="901307715461")
|
| 124 |
-
print("Result:", json.dumps(result, indent=2))
|
| 125 |
-
return result
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
def test_all_tools():
|
| 129 |
-
print("Starting ClickUp tools tests...")
|
| 130 |
-
|
| 131 |
-
# Step 1: Get all tasks to see what's already there
|
| 132 |
-
tasks = test_get_tasks()
|
| 133 |
-
|
| 134 |
-
# Step 2: Create a new task
|
| 135 |
-
created_task = test_create_task()
|
| 136 |
-
if isinstance(created_task, dict) and "id" in created_task:
|
| 137 |
-
new_task_id = created_task.get("id")
|
| 138 |
-
print(f"Created new task with ID: {new_task_id}")
|
| 139 |
-
|
| 140 |
-
# Step 3: Get the task details
|
| 141 |
-
test_get_task(new_task_id)
|
| 142 |
-
|
| 143 |
-
# Step 4: Update the task
|
| 144 |
-
test_update_task(new_task_id)
|
| 145 |
-
|
| 146 |
-
# Step 5: Create another task for dependency testing
|
| 147 |
-
second_task = test_create_task()
|
| 148 |
-
if isinstance(second_task, dict) and "id" in second_task:
|
| 149 |
-
second_task_id = second_task.get("id")
|
| 150 |
-
print(f"Created second task with ID: {second_task_id}")
|
| 151 |
-
|
| 152 |
-
# Step 6: Add dependency between tasks
|
| 153 |
-
test_add_dependency(new_task_id, second_task_id)
|
| 154 |
-
|
| 155 |
-
# Step 7: Get list details
|
| 156 |
-
test_get_list()
|
| 157 |
-
|
| 158 |
-
# Step 8: Delete the tasks we created (cleanup)
|
| 159 |
-
test_delete_task(new_task_id)
|
| 160 |
-
test_delete_task(second_task_id)
|
| 161 |
-
else:
|
| 162 |
-
print("Failed to create second task, skipping dependency test")
|
| 163 |
-
else:
|
| 164 |
-
print("Failed to create task, skipping remaining tests")
|
| 165 |
-
|
| 166 |
-
print("\nAll tests completed!")
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
if __name__ == "__main__":
|
| 170 |
-
test_all_tools()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
agency_ai_demo/tests/test_list_tasks.py
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
from dotenv import load_dotenv
|
| 3 |
-
from openai import AzureOpenAI
|
| 4 |
-
from agency_swarm import set_openai_client
|
| 5 |
-
from agency_swarm import Agent
|
| 6 |
-
|
| 7 |
-
from agents.ClickUpAgent.tools.ClickUpTools import initialize_clickup_tools
|
| 8 |
-
|
| 9 |
-
load_dotenv()
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
def main():
|
| 13 |
-
print("Initializing OpenAI client...")
|
| 14 |
-
client = AzureOpenAI(
|
| 15 |
-
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
|
| 16 |
-
api_version=os.getenv("OPENAI_API_VERSION"),
|
| 17 |
-
azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
|
| 18 |
-
timeout=5,
|
| 19 |
-
max_retries=5,
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
set_openai_client(client)
|
| 23 |
-
|
| 24 |
-
print("Converting ClickUp tools...")
|
| 25 |
-
clickup_tools = initialize_clickup_tools()
|
| 26 |
-
|
| 27 |
-
print("Creating test agent...")
|
| 28 |
-
clickup_agent = Agent(
|
| 29 |
-
name="clickup_agent",
|
| 30 |
-
description="I am a simple agent for testing tools",
|
| 31 |
-
model="gpt-4o",
|
| 32 |
-
tools=clickup_tools,
|
| 33 |
-
)
|
| 34 |
-
|
| 35 |
-
print("\nTesting get_tasks_tool...")
|
| 36 |
-
# Test GetTasksTool directly without using the agent
|
| 37 |
-
from agents.ClickUpAgent.tools.ClickUpTools import GetTasksTool
|
| 38 |
-
|
| 39 |
-
tool = GetTasksTool()
|
| 40 |
-
result = tool._run(list_id=901307715461)
|
| 41 |
-
print(f"Result from GetTasksTool: {result}")
|
| 42 |
-
|
| 43 |
-
print("\nDone!")
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
if __name__ == "__main__":
|
| 47 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
agency_ai_demo/tests/test_tool_directly.py
DELETED
|
@@ -1,90 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import json
|
| 4 |
-
import traceback
|
| 5 |
-
from dotenv import load_dotenv
|
| 6 |
-
from openai import AzureOpenAI
|
| 7 |
-
from agency_swarm import set_openai_client, Agent, Agency
|
| 8 |
-
|
| 9 |
-
from agents.ClickUpAgent.tools.ClickUpTools import (
|
| 10 |
-
initialize_clickup_tools,
|
| 11 |
-
GetTasksTool,
|
| 12 |
-
GetTaskTool,
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
load_dotenv()
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
def main():
|
| 19 |
-
try:
|
| 20 |
-
print("Initializing OpenAI client...")
|
| 21 |
-
client = AzureOpenAI(
|
| 22 |
-
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
|
| 23 |
-
api_version=os.getenv("OPENAI_API_VERSION"),
|
| 24 |
-
azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
|
| 25 |
-
timeout=10,
|
| 26 |
-
max_retries=5,
|
| 27 |
-
)
|
| 28 |
-
|
| 29 |
-
set_openai_client(client)
|
| 30 |
-
|
| 31 |
-
# First test the tool directly
|
| 32 |
-
print("\n==== Testing GetTasksTool directly ====")
|
| 33 |
-
tool = GetTasksTool()
|
| 34 |
-
result = tool._run(list_id=901307715461)
|
| 35 |
-
print(f"Direct result: {json.dumps(result, indent=2)}")
|
| 36 |
-
|
| 37 |
-
print("\n==== Testing GetTaskTool directly ====")
|
| 38 |
-
get_task_tool = GetTaskTool()
|
| 39 |
-
task_id = "86a700c6e"
|
| 40 |
-
direct_result = get_task_tool._run(task_id=task_id)
|
| 41 |
-
print(f"Direct result: {json.dumps(direct_result, indent=2)}")
|
| 42 |
-
|
| 43 |
-
# Now test through Agency Swarm
|
| 44 |
-
print("\n==== Testing through Agency Swarm ====")
|
| 45 |
-
|
| 46 |
-
# Convert tools
|
| 47 |
-
print("Converting ClickUp tools...")
|
| 48 |
-
clickup_tools = initialize_clickup_tools()
|
| 49 |
-
|
| 50 |
-
# Instructions
|
| 51 |
-
clickup_instructions = """
|
| 52 |
-
You need to use the get_tasks_tool to retrieve tasks from list_id 901307715461.
|
| 53 |
-
Always show the full output to the user.
|
| 54 |
-
"""
|
| 55 |
-
|
| 56 |
-
print("Creating ClickUp agent...")
|
| 57 |
-
clickup_agent = Agent(
|
| 58 |
-
name="clickup_agent",
|
| 59 |
-
description="I help with ClickUp tasks",
|
| 60 |
-
instructions=clickup_instructions,
|
| 61 |
-
model="gpt-4o",
|
| 62 |
-
tools=clickup_tools,
|
| 63 |
-
)
|
| 64 |
-
|
| 65 |
-
# Create the agency with a single agent
|
| 66 |
-
print("Creating agency...")
|
| 67 |
-
agency = Agency(
|
| 68 |
-
agency_chart=[
|
| 69 |
-
clickup_agent,
|
| 70 |
-
]
|
| 71 |
-
)
|
| 72 |
-
|
| 73 |
-
# Run the query through the agency
|
| 74 |
-
print("\nSending query to agent...")
|
| 75 |
-
user_query = "Use the get_tasks_tool to get all tasks in list_id 901307715461 and show me the complete results without summarizing."
|
| 76 |
-
print(f"Query: '{user_query}'")
|
| 77 |
-
|
| 78 |
-
response = agency.get_completion(user_query)
|
| 79 |
-
print(f"\nAgent response: {response}")
|
| 80 |
-
|
| 81 |
-
print("\nDone!")
|
| 82 |
-
|
| 83 |
-
except Exception as e:
|
| 84 |
-
print(f"\nAn error occurred: {e}")
|
| 85 |
-
print("\nTraceback:")
|
| 86 |
-
traceback.print_exception(*sys.exc_info())
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
if __name__ == "__main__":
|
| 90 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{agency_ai_demo → app}/agents/NotionProjectAgent/NotionProjectAgent.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/NotionProjectAgent/__init__.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/NotionProjectAgent/instructions.md
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/NotionProjectAgent/tools/CreateTask.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/NotionProjectAgent/tools/DeleteTask.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/NotionProjectAgent/tools/GetTask.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/NotionProjectAgent/tools/GetTasks.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/NotionProjectAgent/tools/UpdateTask.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/ResearchAndReportAgent/ResearchAndReportAgent.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/ResearchAndReportAgent/__init__.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/ResearchAndReportAgent/instructions.md
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/ResearchAndReportAgent/tools/ExampleTool.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/TechnicalProjectManager/TechnicalProjectManager.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/TechnicalProjectManager/__init__.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/TechnicalProjectManager/instructions.md
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/TechnicalProjectManager/tools/ExampleTool.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/TechnicalProjectManager/tools/SendWhatsAppText.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/agents/__init__.py
RENAMED
|
File without changes
|
{agency_ai_demo → app}/demo.py
RENAMED
|
@@ -98,11 +98,11 @@ class NotionAgency(Agency):
|
|
| 98 |
raise Exception("Please install gradio: pip install gradio")
|
| 99 |
|
| 100 |
# Use the specific Notion embed URL provided by the user
|
| 101 |
-
notion_embed_url =
|
| 102 |
|
| 103 |
# Create iframe with the exact attributes provided by the user
|
| 104 |
iframe_html = f"""
|
| 105 |
-
<iframe src="{notion_embed_url}" width="100%" height="
|
| 106 |
<div style="text-align: center; margin-top: 5px; font-size: 12px; color: #888;">
|
| 107 |
If the Notion board doesn't appear, please ensure your Notion page is shared publicly with "Share to web" enabled.
|
| 108 |
</div>
|
|
|
|
| 98 |
raise Exception("Please install gradio: pip install gradio")
|
| 99 |
|
| 100 |
# Use the specific Notion embed URL provided by the user
|
| 101 |
+
notion_embed_url = os.getenv("NOTION_DB_URL")
|
| 102 |
|
| 103 |
# Create iframe with the exact attributes provided by the user
|
| 104 |
iframe_html = f"""
|
| 105 |
+
<iframe src="{notion_embed_url}" width="100%" height="400" frameborder="1" allowfullscreen></iframe>
|
| 106 |
<div style="text-align: center; margin-top: 5px; font-size: 12px; color: #888;">
|
| 107 |
If the Notion board doesn't appear, please ensure your Notion page is shared publicly with "Share to web" enabled.
|
| 108 |
</div>
|
{agency_ai_demo → app}/shared_files/agency_manifesto.md
RENAMED
|
File without changes
|