pygeai 0.1.6__py3-none-any.whl → 0.6.0b15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pygeai might be problematic. Click here for more details.

Files changed (788) hide show
  1. pygeai/__init__.py +11 -2
  2. pygeai/_docs/Makefile +20 -0
  3. pygeai/_docs/make.bat +35 -0
  4. pygeai/_docs/source/conf.py +117 -0
  5. pygeai/_docs/source/content/ai_lab/cli.rst +747 -0
  6. pygeai/_docs/source/content/ai_lab/models.rst +1734 -0
  7. pygeai/_docs/source/content/ai_lab/runner.rst +253 -0
  8. pygeai/_docs/source/content/ai_lab/spec.rst +431 -0
  9. pygeai/_docs/source/content/ai_lab/usage.rst +1011 -0
  10. pygeai/_docs/source/content/ai_lab.rst +102 -0
  11. pygeai/_docs/source/content/analytics.rst +598 -0
  12. pygeai/_docs/source/content/api_reference/admin.rst +161 -0
  13. pygeai/_docs/source/content/api_reference/assistant.rst +326 -0
  14. pygeai/_docs/source/content/api_reference/auth.rst +379 -0
  15. pygeai/_docs/source/content/api_reference/chat.rst +754 -0
  16. pygeai/_docs/source/content/api_reference/embeddings.rst +154 -0
  17. pygeai/_docs/source/content/api_reference/evaluation.rst +590 -0
  18. pygeai/_docs/source/content/api_reference/feedback.rst +237 -0
  19. pygeai/_docs/source/content/api_reference/files.rst +592 -0
  20. pygeai/_docs/source/content/api_reference/gam.rst +401 -0
  21. pygeai/_docs/source/content/api_reference/health.rst +58 -0
  22. pygeai/_docs/source/content/api_reference/project.rst +738 -0
  23. pygeai/_docs/source/content/api_reference/proxy.rst +318 -0
  24. pygeai/_docs/source/content/api_reference/rag.rst +710 -0
  25. pygeai/_docs/source/content/api_reference/rerank.rst +94 -0
  26. pygeai/_docs/source/content/api_reference/secrets.rst +495 -0
  27. pygeai/_docs/source/content/api_reference/usage_limits.rst +390 -0
  28. pygeai/_docs/source/content/api_reference.rst +58 -0
  29. pygeai/_docs/source/content/authentication.rst +295 -0
  30. pygeai/_docs/source/content/chat_gui.rst +121 -0
  31. pygeai/_docs/source/content/cli.rst +203 -0
  32. pygeai/_docs/source/content/debugger.rst +651 -0
  33. pygeai/_docs/source/content/intro.rst +67 -0
  34. pygeai/_docs/source/content/migration.rst +929 -0
  35. pygeai/_docs/source/content/modules.rst +7 -0
  36. pygeai/_docs/source/content/quickstart.rst +143 -0
  37. pygeai/_docs/source/content/samples.rst +394 -0
  38. pygeai/_docs/source/index.rst +75 -0
  39. pygeai/_docs/source/modules.rst +7 -0
  40. pygeai/_docs/source/pygeai.admin.rst +29 -0
  41. pygeai/_docs/source/pygeai.analytics.rst +53 -0
  42. pygeai/_docs/source/pygeai.assistant.data.rst +21 -0
  43. pygeai/_docs/source/pygeai.assistant.data_analyst.rst +29 -0
  44. pygeai/_docs/source/pygeai.assistant.rag.rst +53 -0
  45. pygeai/_docs/source/pygeai.assistant.rst +55 -0
  46. pygeai/_docs/source/pygeai.auth.rst +29 -0
  47. pygeai/_docs/source/pygeai.chat.rst +69 -0
  48. pygeai/_docs/source/pygeai.cli.commands.flows.rst +10 -0
  49. pygeai/_docs/source/pygeai.cli.commands.lab.rst +53 -0
  50. pygeai/_docs/source/pygeai.cli.commands.rst +222 -0
  51. pygeai/_docs/source/pygeai.cli.rst +62 -0
  52. pygeai/_docs/source/pygeai.cli.texts.rst +21 -0
  53. pygeai/_docs/source/pygeai.core.base.rst +53 -0
  54. pygeai/_docs/source/pygeai.core.common.rst +37 -0
  55. pygeai/_docs/source/pygeai.core.embeddings.rst +61 -0
  56. pygeai/_docs/source/pygeai.core.feedback.rst +37 -0
  57. pygeai/_docs/source/pygeai.core.files.rst +61 -0
  58. pygeai/_docs/source/pygeai.core.llm.rst +29 -0
  59. pygeai/_docs/source/pygeai.core.plugins.rst +37 -0
  60. pygeai/_docs/source/pygeai.core.rerank.rst +53 -0
  61. pygeai/_docs/source/pygeai.core.rst +63 -0
  62. pygeai/_docs/source/pygeai.core.secrets.rst +29 -0
  63. pygeai/_docs/source/pygeai.core.services.llm.rst +29 -0
  64. pygeai/_docs/source/pygeai.core.services.rst +37 -0
  65. pygeai/_docs/source/pygeai.core.utils.rst +37 -0
  66. pygeai/_docs/source/pygeai.dbg.rst +21 -0
  67. pygeai/_docs/source/pygeai.evaluation.dataset.rst +29 -0
  68. pygeai/_docs/source/pygeai.evaluation.plan.rst +29 -0
  69. pygeai/_docs/source/pygeai.evaluation.result.rst +29 -0
  70. pygeai/_docs/source/pygeai.evaluation.rst +31 -0
  71. pygeai/_docs/source/pygeai.flows.rst +29 -0
  72. pygeai/_docs/source/pygeai.gam.rst +29 -0
  73. pygeai/_docs/source/pygeai.health.rst +29 -0
  74. pygeai/_docs/source/pygeai.lab.agents.rst +37 -0
  75. pygeai/_docs/source/pygeai.lab.processes.rst +37 -0
  76. pygeai/_docs/source/pygeai.lab.rst +65 -0
  77. pygeai/_docs/source/pygeai.lab.spec.rst +29 -0
  78. pygeai/_docs/source/pygeai.lab.strategies.rst +37 -0
  79. pygeai/_docs/source/pygeai.lab.tools.rst +37 -0
  80. pygeai/_docs/source/pygeai.man.man1.rst +10 -0
  81. pygeai/_docs/source/pygeai.man.rst +18 -0
  82. pygeai/_docs/source/pygeai.migration.rst +29 -0
  83. pygeai/_docs/source/pygeai.organization.limits.rst +45 -0
  84. pygeai/_docs/source/pygeai.organization.rst +61 -0
  85. pygeai/_docs/source/pygeai.proxy.rst +53 -0
  86. pygeai/_docs/source/pygeai.rst +35 -0
  87. pygeai/_docs/source/pygeai.tests.admin.rst +21 -0
  88. pygeai/_docs/source/pygeai.tests.analytics.rst +45 -0
  89. pygeai/_docs/source/pygeai.tests.assistants.rag.rst +37 -0
  90. pygeai/_docs/source/pygeai.tests.assistants.rst +45 -0
  91. pygeai/_docs/source/pygeai.tests.auth.rst +29 -0
  92. pygeai/_docs/source/pygeai.tests.chat.rst +45 -0
  93. pygeai/_docs/source/pygeai.tests.cli.commands.lab.rst +37 -0
  94. pygeai/_docs/source/pygeai.tests.cli.commands.rst +165 -0
  95. pygeai/_docs/source/pygeai.tests.cli.docker.rst +10 -0
  96. pygeai/_docs/source/pygeai.tests.cli.rst +46 -0
  97. pygeai/_docs/source/pygeai.tests.core.base.data.rst +29 -0
  98. pygeai/_docs/source/pygeai.tests.core.base.rst +45 -0
  99. pygeai/_docs/source/pygeai.tests.core.common.data.rst +10 -0
  100. pygeai/_docs/source/pygeai.tests.core.common.rst +37 -0
  101. pygeai/_docs/source/pygeai.tests.core.embeddings.rst +37 -0
  102. pygeai/_docs/source/pygeai.tests.core.feedback.rst +21 -0
  103. pygeai/_docs/source/pygeai.tests.core.files.rst +53 -0
  104. pygeai/_docs/source/pygeai.tests.core.llm.rst +21 -0
  105. pygeai/_docs/source/pygeai.tests.core.plugins.rst +21 -0
  106. pygeai/_docs/source/pygeai.tests.core.rerank.rst +37 -0
  107. pygeai/_docs/source/pygeai.tests.core.rst +39 -0
  108. pygeai/_docs/source/pygeai.tests.core.secrets.rst +21 -0
  109. pygeai/_docs/source/pygeai.tests.core.services.rst +21 -0
  110. pygeai/_docs/source/pygeai.tests.core.utils.rst +21 -0
  111. pygeai/_docs/source/pygeai.tests.dbg.rst +21 -0
  112. pygeai/_docs/source/pygeai.tests.evaluation.dataset.rst +21 -0
  113. pygeai/_docs/source/pygeai.tests.evaluation.plan.rst +21 -0
  114. pygeai/_docs/source/pygeai.tests.evaluation.result.rst +21 -0
  115. pygeai/_docs/source/pygeai.tests.evaluation.rst +20 -0
  116. pygeai/_docs/source/pygeai.tests.gam.rst +21 -0
  117. pygeai/_docs/source/pygeai.tests.health.rst +21 -0
  118. pygeai/_docs/source/pygeai.tests.integration.assistants.rag.rst +21 -0
  119. pygeai/_docs/source/pygeai.tests.integration.assistants.rst +18 -0
  120. pygeai/_docs/source/pygeai.tests.integration.chat.rst +21 -0
  121. pygeai/_docs/source/pygeai.tests.integration.lab.agents.rst +69 -0
  122. pygeai/_docs/source/pygeai.tests.integration.lab.processes.rst +77 -0
  123. pygeai/_docs/source/pygeai.tests.integration.lab.reasoning_strategies.rst +37 -0
  124. pygeai/_docs/source/pygeai.tests.integration.lab.rst +21 -0
  125. pygeai/_docs/source/pygeai.tests.integration.lab.tools.rst +77 -0
  126. pygeai/_docs/source/pygeai.tests.integration.rst +20 -0
  127. pygeai/_docs/source/pygeai.tests.lab.agents.rst +29 -0
  128. pygeai/_docs/source/pygeai.tests.lab.processes.rst +29 -0
  129. pygeai/_docs/source/pygeai.tests.lab.rst +49 -0
  130. pygeai/_docs/source/pygeai.tests.lab.spec.rst +29 -0
  131. pygeai/_docs/source/pygeai.tests.lab.strategies.rst +29 -0
  132. pygeai/_docs/source/pygeai.tests.lab.tools.rst +29 -0
  133. pygeai/_docs/source/pygeai.tests.migration.rst +29 -0
  134. pygeai/_docs/source/pygeai.tests.organization.limits.rst +29 -0
  135. pygeai/_docs/source/pygeai.tests.organization.rst +53 -0
  136. pygeai/_docs/source/pygeai.tests.proxy.rst +61 -0
  137. pygeai/_docs/source/pygeai.tests.rst +33 -0
  138. pygeai/admin/clients.py +14 -11
  139. pygeai/admin/endpoints.py +2 -2
  140. pygeai/analytics/clients.py +505 -0
  141. pygeai/analytics/endpoints.py +35 -0
  142. pygeai/analytics/managers.py +606 -0
  143. pygeai/analytics/mappers.py +207 -0
  144. pygeai/analytics/responses.py +240 -0
  145. pygeai/assistant/clients.py +48 -57
  146. pygeai/assistant/data/__init__.py +0 -0
  147. pygeai/assistant/data/clients.py +15 -0
  148. pygeai/assistant/data_analyst/__init__.py +0 -0
  149. pygeai/assistant/data_analyst/clients.py +75 -0
  150. pygeai/assistant/data_analyst/endpoints.py +2 -0
  151. pygeai/assistant/endpoints.py +0 -2
  152. pygeai/assistant/managers.py +738 -0
  153. pygeai/assistant/mappers.py +153 -0
  154. pygeai/assistant/rag/clients.py +132 -21
  155. pygeai/assistant/rag/mappers.py +228 -0
  156. pygeai/assistant/rag/models.py +396 -0
  157. pygeai/assistant/rag/responses.py +10 -0
  158. pygeai/auth/__init__.py +0 -0
  159. pygeai/auth/clients.py +129 -0
  160. pygeai/auth/endpoints.py +6 -0
  161. pygeai/chat/clients.py +406 -31
  162. pygeai/chat/endpoints.py +3 -0
  163. pygeai/chat/iris.py +17 -0
  164. pygeai/chat/managers.py +64 -0
  165. pygeai/chat/session.py +38 -0
  166. pygeai/chat/settings.py +6 -0
  167. pygeai/chat/ui.py +678 -0
  168. pygeai/cli/__init__.py +0 -1
  169. pygeai/cli/commands/admin.py +9 -12
  170. pygeai/cli/commands/analytics.py +533 -0
  171. pygeai/cli/commands/assistant.py +11 -11
  172. pygeai/cli/commands/auth.py +299 -0
  173. pygeai/cli/commands/base.py +201 -7
  174. pygeai/cli/commands/chat.py +875 -14
  175. pygeai/cli/commands/common.py +30 -26
  176. pygeai/cli/commands/configuration.py +84 -9
  177. pygeai/cli/commands/docs.py +105 -0
  178. pygeai/cli/commands/embeddings.py +187 -0
  179. pygeai/cli/commands/evaluation.py +2069 -0
  180. pygeai/cli/commands/feedback.py +93 -0
  181. pygeai/cli/commands/files.py +312 -0
  182. pygeai/cli/commands/flows/__init__.py +0 -0
  183. pygeai/cli/commands/gam.py +349 -0
  184. pygeai/cli/commands/lab/__init__.py +0 -0
  185. pygeai/cli/commands/lab/ai_lab.py +4110 -0
  186. pygeai/cli/commands/lab/common.py +135 -0
  187. pygeai/cli/commands/lab/options.py +8 -0
  188. pygeai/cli/commands/lab/spec.py +273 -0
  189. pygeai/cli/commands/lab/utils.py +13 -0
  190. pygeai/cli/commands/llm.py +164 -0
  191. pygeai/cli/commands/migrate.py +1198 -0
  192. pygeai/cli/commands/options.py +86 -0
  193. pygeai/cli/commands/organization.py +560 -98
  194. pygeai/cli/commands/rag.py +306 -10
  195. pygeai/cli/commands/rerank.py +108 -0
  196. pygeai/cli/commands/secrets.py +357 -0
  197. pygeai/cli/commands/usage_limits.py +583 -0
  198. pygeai/cli/commands/validators.py +209 -0
  199. pygeai/cli/commands/version.py +44 -0
  200. pygeai/cli/error_handler.py +151 -0
  201. pygeai/cli/geai.py +171 -30
  202. pygeai/cli/geai_proxy.py +318 -0
  203. pygeai/cli/install_man.py +107 -0
  204. pygeai/cli/parsers.py +78 -25
  205. pygeai/cli/texts/help.py +712 -55
  206. pygeai/core/__init__.py +9 -1
  207. pygeai/core/base/clients.py +61 -10
  208. pygeai/core/base/mappers.py +208 -30
  209. pygeai/core/base/models.py +8 -308
  210. pygeai/core/base/responses.py +18 -1
  211. pygeai/core/base/session.py +110 -17
  212. pygeai/core/common/config.py +98 -16
  213. pygeai/core/common/decorators.py +44 -0
  214. pygeai/core/common/exceptions.py +104 -4
  215. pygeai/core/embeddings/__init__.py +19 -0
  216. pygeai/core/embeddings/clients.py +93 -0
  217. pygeai/core/embeddings/endpoints.py +1 -0
  218. pygeai/core/embeddings/managers.py +62 -0
  219. pygeai/core/embeddings/mappers.py +52 -0
  220. pygeai/core/embeddings/models.py +14 -0
  221. pygeai/core/embeddings/responses.py +31 -0
  222. pygeai/core/feedback/__init__.py +0 -0
  223. pygeai/core/feedback/clients.py +50 -0
  224. pygeai/core/feedback/endpoints.py +1 -0
  225. pygeai/core/feedback/models.py +10 -0
  226. pygeai/core/files/__init__.py +0 -0
  227. pygeai/core/files/clients.py +156 -0
  228. pygeai/core/files/endpoints.py +5 -0
  229. pygeai/core/files/managers.py +224 -0
  230. pygeai/core/files/mappers.py +44 -0
  231. pygeai/core/files/models.py +24 -0
  232. pygeai/core/files/responses.py +19 -0
  233. pygeai/core/handlers.py +32 -0
  234. pygeai/core/llm/__init__.py +0 -0
  235. pygeai/core/llm/clients.py +53 -0
  236. pygeai/core/llm/endpoints.py +4 -0
  237. pygeai/core/models.py +799 -0
  238. pygeai/core/plugins/__init__.py +0 -0
  239. pygeai/core/plugins/clients.py +32 -0
  240. pygeai/core/plugins/endpoints.py +1 -0
  241. pygeai/core/plugins/models.py +86 -0
  242. pygeai/core/rerank/__init__.py +0 -0
  243. pygeai/core/rerank/clients.py +35 -0
  244. pygeai/core/rerank/endpoints.py +1 -0
  245. pygeai/core/rerank/managers.py +47 -0
  246. pygeai/core/rerank/mappers.py +23 -0
  247. pygeai/core/rerank/models.py +27 -0
  248. pygeai/core/responses.py +104 -0
  249. pygeai/core/secrets/__init__.py +0 -0
  250. pygeai/core/secrets/clients.py +212 -0
  251. pygeai/core/secrets/endpoints.py +7 -0
  252. pygeai/core/services/llm/__init__.py +0 -0
  253. pygeai/core/services/llm/model.py +186 -0
  254. pygeai/core/services/llm/providers.py +15 -0
  255. pygeai/core/services/response.py +18 -0
  256. pygeai/core/services/rest.py +311 -89
  257. pygeai/core/utils/__init__.py +0 -0
  258. pygeai/core/utils/console.py +83 -0
  259. pygeai/core/utils/parsers.py +32 -0
  260. pygeai/core/utils/validators.py +10 -0
  261. pygeai/dbg/__init__.py +3 -0
  262. pygeai/dbg/debugger.py +870 -0
  263. pygeai/evaluation/__init__.py +0 -0
  264. pygeai/evaluation/clients.py +19 -0
  265. pygeai/evaluation/dataset/__init__.py +0 -0
  266. pygeai/evaluation/dataset/clients.py +514 -0
  267. pygeai/evaluation/dataset/endpoints.py +26 -0
  268. pygeai/evaluation/plan/__init__.py +0 -0
  269. pygeai/evaluation/plan/clients.py +302 -0
  270. pygeai/evaluation/plan/endpoints.py +16 -0
  271. pygeai/evaluation/result/__init__.py +0 -0
  272. pygeai/evaluation/result/clients.py +70 -0
  273. pygeai/evaluation/result/endpoints.py +2 -0
  274. pygeai/flows/__init__.py +0 -0
  275. pygeai/flows/endpoints.py +362 -0
  276. pygeai/flows/models.py +1304 -0
  277. pygeai/gam/__init__.py +0 -0
  278. pygeai/gam/clients.py +178 -0
  279. pygeai/gam/endpoints.py +4 -0
  280. pygeai/health/__init__.py +0 -0
  281. pygeai/health/clients.py +24 -0
  282. pygeai/health/endpoints.py +1 -0
  283. pygeai/lab/__init__.py +0 -0
  284. pygeai/lab/agents/__init__.py +0 -0
  285. pygeai/lab/agents/clients.py +426 -0
  286. pygeai/lab/agents/endpoints.py +12 -0
  287. pygeai/lab/agents/mappers.py +319 -0
  288. pygeai/lab/clients.py +24 -0
  289. pygeai/lab/constants.py +3 -0
  290. pygeai/lab/managers.py +1558 -0
  291. pygeai/lab/models.py +1719 -0
  292. pygeai/lab/processes/__init__.py +0 -0
  293. pygeai/lab/processes/clients.py +1051 -0
  294. pygeai/lab/processes/endpoints.py +26 -0
  295. pygeai/lab/processes/mappers.py +395 -0
  296. pygeai/lab/runners.py +90 -0
  297. pygeai/lab/spec/__init__.py +0 -0
  298. pygeai/lab/spec/loader.py +24 -0
  299. pygeai/lab/spec/parsers.py +39 -0
  300. pygeai/lab/strategies/__init__.py +0 -0
  301. pygeai/lab/strategies/clients.py +212 -0
  302. pygeai/lab/strategies/endpoints.py +5 -0
  303. pygeai/lab/strategies/mappers.py +58 -0
  304. pygeai/lab/tools/__init__.py +0 -0
  305. pygeai/lab/tools/clients.py +465 -0
  306. pygeai/lab/tools/endpoints.py +13 -0
  307. pygeai/lab/tools/mappers.py +131 -0
  308. pygeai/man/__init__.py +1 -0
  309. pygeai/man/man1/__init__.py +1 -0
  310. pygeai/man/man1/geai-proxy.1 +246 -0
  311. pygeai/man/man1/geai.1 +2615 -0
  312. pygeai/migration/__init__.py +33 -0
  313. pygeai/migration/strategies.py +603 -0
  314. pygeai/migration/tools.py +180 -0
  315. pygeai/organization/clients.py +246 -18
  316. pygeai/organization/endpoints.py +17 -8
  317. pygeai/organization/limits/__init__.py +0 -0
  318. pygeai/organization/limits/clients.py +281 -0
  319. pygeai/organization/limits/endpoints.py +15 -0
  320. pygeai/organization/limits/managers.py +331 -0
  321. pygeai/organization/limits/mappers.py +21 -0
  322. pygeai/organization/managers.py +537 -0
  323. pygeai/organization/mappers.py +111 -46
  324. pygeai/organization/responses.py +61 -11
  325. pygeai/proxy/__init__.py +0 -0
  326. pygeai/proxy/clients.py +216 -0
  327. pygeai/proxy/config.py +128 -0
  328. pygeai/proxy/managers.py +232 -0
  329. pygeai/proxy/servers.py +304 -0
  330. pygeai/proxy/tool.py +69 -0
  331. pygeai/tests/admin/__init__.py +0 -0
  332. pygeai/tests/admin/test_clients.py +148 -0
  333. pygeai/tests/analytics/__init__.py +0 -0
  334. pygeai/tests/analytics/test_clients.py +86 -0
  335. pygeai/tests/analytics/test_managers.py +94 -0
  336. pygeai/tests/analytics/test_mappers.py +84 -0
  337. pygeai/tests/analytics/test_responses.py +73 -0
  338. pygeai/tests/assistants/rag/__init__.py +0 -0
  339. pygeai/tests/assistants/rag/test_clients.py +346 -0
  340. pygeai/tests/assistants/rag/test_mappers.py +189 -0
  341. pygeai/tests/assistants/rag/test_models.py +292 -0
  342. pygeai/tests/assistants/test_clients.py +176 -80
  343. pygeai/tests/assistants/test_managers.py +198 -0
  344. pygeai/tests/assistants/test_mappers.py +111 -0
  345. pygeai/tests/auth/__init__.py +0 -0
  346. pygeai/tests/auth/test_clients.py +289 -0
  347. pygeai/tests/auth/test_oauth.py +172 -0
  348. pygeai/tests/auth/test_session_logging.py +150 -0
  349. pygeai/tests/chat/__init__.py +0 -0
  350. pygeai/tests/chat/test_clients.py +393 -0
  351. pygeai/tests/chat/test_iris.py +38 -0
  352. pygeai/tests/chat/test_session.py +62 -0
  353. pygeai/tests/chat/test_ui.py +224 -0
  354. pygeai/tests/cli/__init__.py +0 -0
  355. pygeai/tests/cli/commands/__init__.py +0 -0
  356. pygeai/tests/cli/commands/lab/__init__.py +0 -0
  357. pygeai/tests/cli/commands/lab/test_ai_lab.py +786 -0
  358. pygeai/tests/cli/commands/lab/test_common.py +208 -0
  359. pygeai/tests/cli/commands/lab/test_spec.py +246 -0
  360. pygeai/tests/cli/commands/test_assistant.py +202 -0
  361. pygeai/tests/cli/commands/test_chat.py +130 -0
  362. pygeai/tests/cli/commands/test_common.py +350 -0
  363. pygeai/tests/cli/commands/test_embeddings.py +132 -0
  364. pygeai/tests/cli/commands/test_evaluation.py +656 -0
  365. pygeai/tests/cli/commands/test_feedback.py +65 -0
  366. pygeai/tests/cli/commands/test_files.py +161 -0
  367. pygeai/tests/cli/commands/test_gam.py +201 -0
  368. pygeai/tests/cli/commands/test_llm.py +114 -0
  369. pygeai/tests/cli/commands/test_migrate.py +176 -0
  370. pygeai/tests/cli/commands/test_organization.py +276 -0
  371. pygeai/tests/cli/commands/test_rag.py +266 -0
  372. pygeai/tests/cli/commands/test_rerank.py +110 -0
  373. pygeai/tests/cli/commands/test_secrets.py +171 -0
  374. pygeai/tests/cli/commands/test_show_help.py +41 -0
  375. pygeai/tests/cli/commands/test_usage_limits.py +412 -0
  376. pygeai/tests/cli/commands/test_validators.py +160 -0
  377. pygeai/tests/cli/commands/test_version.py +81 -0
  378. pygeai/tests/cli/docker/__init__.py +0 -0
  379. pygeai/tests/cli/test_credentials_flag.py +316 -0
  380. pygeai/tests/cli/test_error_handler.py +225 -0
  381. pygeai/tests/cli/test_geai_driver.py +154 -0
  382. pygeai/tests/cli/test_parsers.py +154 -0
  383. pygeai/tests/core/base/__init__.py +0 -0
  384. pygeai/tests/core/base/data/__init__.py +0 -0
  385. pygeai/tests/core/base/data/mappers.py +117 -0
  386. pygeai/tests/core/base/data/models.py +312 -0
  387. pygeai/tests/core/base/test_mappers.py +569 -0
  388. pygeai/tests/core/base/test_models.py +261 -0
  389. pygeai/tests/core/base/test_responses.py +53 -0
  390. pygeai/tests/core/common/__init__.py +0 -0
  391. pygeai/tests/core/common/data/__init__.py +0 -0
  392. pygeai/tests/core/common/test_config.py +186 -0
  393. pygeai/tests/core/common/test_decorators.py +69 -0
  394. pygeai/tests/core/embeddings/__init__.py +0 -0
  395. pygeai/tests/core/embeddings/test_clients.py +225 -0
  396. pygeai/tests/core/embeddings/test_managers.py +171 -0
  397. pygeai/tests/core/embeddings/test_mappers.py +142 -0
  398. pygeai/tests/core/feedback/__init__.py +0 -0
  399. pygeai/tests/core/feedback/test_clients.py +64 -0
  400. pygeai/tests/core/files/__init__.py +0 -0
  401. pygeai/tests/core/files/test_clients.py +128 -0
  402. pygeai/tests/core/files/test_managers.py +219 -0
  403. pygeai/tests/core/files/test_mappers.py +137 -0
  404. pygeai/tests/core/files/test_models.py +103 -0
  405. pygeai/tests/core/files/test_responses.py +122 -0
  406. pygeai/tests/core/llm/__init__.py +0 -0
  407. pygeai/tests/core/llm/test_clients.py +142 -0
  408. pygeai/tests/core/plugins/__init__.py +0 -0
  409. pygeai/tests/core/plugins/test_clients.py +66 -0
  410. pygeai/tests/core/rerank/__init__.py +0 -0
  411. pygeai/tests/core/rerank/test_clients.py +76 -0
  412. pygeai/tests/core/rerank/test_managers.py +99 -0
  413. pygeai/tests/core/rerank/test_mappers.py +54 -0
  414. pygeai/tests/core/secrets/__init__.py +0 -0
  415. pygeai/tests/core/secrets/test_clients.py +264 -0
  416. pygeai/tests/core/services/__init__.py +0 -0
  417. pygeai/tests/core/services/test_rest.py +273 -0
  418. pygeai/tests/core/test_handlers.py +66 -0
  419. pygeai/tests/core/utils/__init__.py +0 -0
  420. pygeai/tests/core/utils/test_console.py +80 -0
  421. pygeai/tests/dbg/__init__.py +0 -0
  422. pygeai/tests/dbg/test_debugger.py +591 -0
  423. pygeai/tests/evaluation/__init__.py +0 -0
  424. pygeai/tests/evaluation/dataset/__init__.py +0 -0
  425. pygeai/tests/evaluation/dataset/test_clients.py +265 -0
  426. pygeai/tests/evaluation/plan/__init__.py +0 -0
  427. pygeai/tests/evaluation/plan/test_clients.py +195 -0
  428. pygeai/tests/evaluation/result/__init__.py +0 -0
  429. pygeai/tests/evaluation/result/test_clients.py +66 -0
  430. pygeai/tests/gam/__init__.py +0 -0
  431. pygeai/tests/gam/test_clients.py +195 -0
  432. pygeai/tests/health/__init__.py +0 -0
  433. pygeai/tests/health/test_clients.py +41 -0
  434. pygeai/tests/integration/__init__.py +0 -0
  435. pygeai/tests/integration/assistants/__init__.py +0 -0
  436. pygeai/tests/integration/assistants/rag/__init__.py +0 -0
  437. pygeai/tests/integration/assistants/rag/test_create_rag.py +91 -0
  438. pygeai/tests/integration/chat/__init__.py +0 -0
  439. pygeai/tests/integration/chat/test_generate_image.py +158 -0
  440. pygeai/tests/integration/lab/__init__.py +0 -0
  441. pygeai/tests/integration/lab/agents/__init__.py +0 -0
  442. pygeai/tests/integration/lab/agents/test_agents_list.py +106 -0
  443. pygeai/tests/integration/lab/agents/test_create_agent.py +319 -0
  444. pygeai/tests/integration/lab/agents/test_create_sharing_link.py +70 -0
  445. pygeai/tests/integration/lab/agents/test_delete_agent.py +75 -0
  446. pygeai/tests/integration/lab/agents/test_get_agent.py +94 -0
  447. pygeai/tests/integration/lab/agents/test_publish_agent_revision.py +127 -0
  448. pygeai/tests/integration/lab/agents/test_update_agent.py +250 -0
  449. pygeai/tests/integration/lab/processes/__init__.py +0 -0
  450. pygeai/tests/integration/lab/processes/test_create_process.py +345 -0
  451. pygeai/tests/integration/lab/processes/test_create_task.py +211 -0
  452. pygeai/tests/integration/lab/processes/test_delete_process.py +111 -0
  453. pygeai/tests/integration/lab/processes/test_get_process.py +201 -0
  454. pygeai/tests/integration/lab/processes/test_list_process_instances.py +91 -0
  455. pygeai/tests/integration/lab/processes/test_list_processes.py +138 -0
  456. pygeai/tests/integration/lab/processes/test_publish_process_revision.py +232 -0
  457. pygeai/tests/integration/lab/processes/test_update_process.py +289 -0
  458. pygeai/tests/integration/lab/reasoning_strategies/__init__.py +0 -0
  459. pygeai/tests/integration/lab/reasoning_strategies/test_get_reasoning_strategy.py +70 -0
  460. pygeai/tests/integration/lab/reasoning_strategies/test_list_reasoning_strategies.py +93 -0
  461. pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +149 -0
  462. pygeai/tests/integration/lab/tools/__init__.py +0 -0
  463. pygeai/tests/integration/lab/tools/test_create_tool.py +288 -0
  464. pygeai/tests/integration/lab/tools/test_delete_tool.py +87 -0
  465. pygeai/tests/integration/lab/tools/test_get_parameter.py +98 -0
  466. pygeai/tests/integration/lab/tools/test_get_tool.py +91 -0
  467. pygeai/tests/integration/lab/tools/test_list_tools.py +106 -0
  468. pygeai/tests/integration/lab/tools/test_publish_tool_revision.py +119 -0
  469. pygeai/tests/integration/lab/tools/test_set_parameter.py +114 -0
  470. pygeai/tests/integration/lab/tools/test_update_tool.py +267 -0
  471. pygeai/tests/lab/__init__.py +0 -0
  472. pygeai/tests/lab/agents/__init__.py +0 -0
  473. pygeai/tests/lab/agents/test_clients.py +481 -0
  474. pygeai/tests/lab/agents/test_mappers.py +440 -0
  475. pygeai/tests/lab/processes/__init__.py +0 -0
  476. pygeai/tests/lab/processes/test_clients.py +1416 -0
  477. pygeai/tests/lab/processes/test_mappers.py +1092 -0
  478. pygeai/tests/lab/spec/__init__.py +0 -0
  479. pygeai/tests/lab/spec/test_loader.py +59 -0
  480. pygeai/tests/lab/spec/test_parsers.py +182 -0
  481. pygeai/tests/lab/strategies/__init__.py +0 -0
  482. pygeai/tests/lab/strategies/test_clients.py +241 -0
  483. pygeai/tests/lab/strategies/test_mappers.py +132 -0
  484. pygeai/tests/lab/test_managers.py +553 -0
  485. pygeai/tests/lab/test_mappers.py +245 -0
  486. pygeai/tests/lab/test_models.py +1154 -0
  487. pygeai/tests/lab/tools/__init__.py +0 -0
  488. pygeai/tests/lab/tools/test_clients.py +521 -0
  489. pygeai/tests/lab/tools/test_mappers.py +198 -0
  490. pygeai/tests/migration/__init__.py +0 -0
  491. pygeai/tests/migration/test_strategies.py +405 -0
  492. pygeai/tests/migration/test_tools.py +159 -0
  493. pygeai/tests/organization/limits/__init__.py +0 -0
  494. pygeai/tests/organization/limits/test_clients.py +567 -0
  495. pygeai/tests/organization/limits/test_managers.py +402 -0
  496. pygeai/tests/organization/test_clients.py +615 -64
  497. pygeai/tests/organization/test_managers.py +424 -0
  498. pygeai/tests/organization/test_mappers.py +153 -0
  499. pygeai/tests/organization/test_responses.py +137 -0
  500. pygeai/tests/proxy/__init__.py +1 -0
  501. pygeai/tests/proxy/test_clients.py +397 -0
  502. pygeai/tests/proxy/test_config.py +171 -0
  503. pygeai/tests/proxy/test_integration.py +305 -0
  504. pygeai/tests/proxy/test_managers.py +312 -0
  505. pygeai/tests/proxy/test_servers.py +387 -0
  506. pygeai/tests/proxy/test_tool.py +176 -0
  507. pygeai/tests/snippets/__init__.py +0 -0
  508. pygeai/tests/snippets/analytics/__init__.py +0 -0
  509. pygeai/tests/snippets/analytics/get_agent_usage_per_user.py +16 -0
  510. pygeai/tests/snippets/analytics/get_agents_created_and_modified.py +11 -0
  511. pygeai/tests/snippets/analytics/get_average_cost_per_request.py +10 -0
  512. pygeai/tests/snippets/analytics/get_overall_error_rate.py +10 -0
  513. pygeai/tests/snippets/analytics/get_top_10_agents_by_requests.py +12 -0
  514. pygeai/tests/snippets/analytics/get_total_active_users.py +10 -0
  515. pygeai/tests/snippets/analytics/get_total_cost.py +10 -0
  516. pygeai/tests/snippets/analytics/get_total_requests_per_day.py +12 -0
  517. pygeai/tests/snippets/analytics/get_total_tokens.py +12 -0
  518. pygeai/tests/snippets/assistants/__init__.py +0 -0
  519. pygeai/tests/snippets/assistants/create_chat_assistant.py +54 -0
  520. pygeai/tests/snippets/assistants/create_text_assistant.py +51 -0
  521. pygeai/tests/snippets/assistants/data_analyst/__init__.py +0 -0
  522. pygeai/tests/snippets/assistants/data_analyst/extend_and_check.py +100 -0
  523. pygeai/tests/snippets/assistants/data_analyst/extend_dataset.py +9 -0
  524. pygeai/tests/snippets/assistants/data_analyst/get_status.py +9 -0
  525. pygeai/tests/snippets/assistants/file_summarizer_assistant.py +149 -0
  526. pygeai/tests/snippets/assistants/get_assistant_data.py +8 -0
  527. pygeai/tests/snippets/assistants/get_assistant_list.py +7 -0
  528. pygeai/tests/snippets/assistants/rag/__init__.py +0 -0
  529. pygeai/tests/snippets/assistants/rag/create_rag_assistant.py +65 -0
  530. pygeai/tests/snippets/assistants/rag/delete_al_documents.py +7 -0
  531. pygeai/tests/snippets/assistants/rag/delete_document.py +10 -0
  532. pygeai/tests/snippets/assistants/rag/delete_rag_assistant.py +8 -0
  533. pygeai/tests/snippets/assistants/rag/get_document.py +10 -0
  534. pygeai/tests/snippets/assistants/rag/get_documents.py +7 -0
  535. pygeai/tests/snippets/assistants/rag/get_rag_assistant_data.py +8 -0
  536. pygeai/tests/snippets/assistants/rag/update_rag_assistant.py +48 -0
  537. pygeai/tests/snippets/assistants/rag/upload_document.py +19 -0
  538. pygeai/tests/snippets/assistants/send_feedback.py +14 -0
  539. pygeai/tests/snippets/assistants/update_chat_assistant.py +63 -0
  540. pygeai/tests/snippets/auth/__init__.py +0 -0
  541. pygeai/tests/snippets/chat/__init__.py +0 -0
  542. pygeai/tests/snippets/chat/cancel_request.py +7 -0
  543. pygeai/tests/snippets/chat/chat_completion.py +28 -0
  544. pygeai/tests/snippets/chat/chat_completion_1.py +40 -0
  545. pygeai/tests/snippets/chat/chat_completion_2.py +60 -0
  546. pygeai/tests/snippets/chat/chat_completion_3.py +27 -0
  547. pygeai/tests/snippets/chat/chat_completion_4.py +67 -0
  548. pygeai/tests/snippets/chat/chat_completion_streaming.py +63 -0
  549. pygeai/tests/snippets/chat/chat_completion_with_reasoning_effort.py +18 -0
  550. pygeai/tests/snippets/chat/get_request_status.py +7 -0
  551. pygeai/tests/snippets/chat/get_response.py +15 -0
  552. pygeai/tests/snippets/chat/get_response_complete_example.py +67 -0
  553. pygeai/tests/snippets/chat/get_response_streaming.py +20 -0
  554. pygeai/tests/snippets/chat/get_response_with_files.py +16 -0
  555. pygeai/tests/snippets/chat/get_response_with_instructions.py +19 -0
  556. pygeai/tests/snippets/chat/get_response_with_metadata.py +24 -0
  557. pygeai/tests/snippets/chat/get_response_with_parallel_tools.py +58 -0
  558. pygeai/tests/snippets/chat/get_response_with_reasoning.py +21 -0
  559. pygeai/tests/snippets/chat/get_response_with_store.py +38 -0
  560. pygeai/tests/snippets/chat/get_response_with_tools.py +36 -0
  561. pygeai/tests/snippets/chat/get_response_with_truncation.py +24 -0
  562. pygeai/tests/snippets/chat/send_chat_request.py +33 -0
  563. pygeai/tests/snippets/dbg/__init__.py +0 -0
  564. pygeai/tests/snippets/dbg/basic_debugging.py +32 -0
  565. pygeai/tests/snippets/dbg/breakpoint_management.py +48 -0
  566. pygeai/tests/snippets/dbg/file_debugging.py +72 -0
  567. pygeai/tests/snippets/dbg/module_debugging.py +61 -0
  568. pygeai/tests/snippets/dbg/stack_navigation.py +45 -0
  569. pygeai/tests/snippets/dbg/stepping_example.py +40 -0
  570. pygeai/tests/snippets/embeddings/__init__.py +0 -0
  571. pygeai/tests/snippets/embeddings/cache_example.py +31 -0
  572. pygeai/tests/snippets/embeddings/cohere_example.py +41 -0
  573. pygeai/tests/snippets/embeddings/generate_embeddings.py +26 -0
  574. pygeai/tests/snippets/embeddings/openai_base64_example.py +27 -0
  575. pygeai/tests/snippets/embeddings/openai_example.py +30 -0
  576. pygeai/tests/snippets/embeddings/similarity_example.py +42 -0
  577. pygeai/tests/snippets/evaluation/__init__.py +0 -0
  578. pygeai/tests/snippets/evaluation/dataset/__init__.py +0 -0
  579. pygeai/tests/snippets/evaluation/dataset/complete_workflow_example.py +195 -0
  580. pygeai/tests/snippets/evaluation/dataset/create_dataset.py +26 -0
  581. pygeai/tests/snippets/evaluation/dataset/create_dataset_from_file.py +11 -0
  582. pygeai/tests/snippets/evaluation/dataset/create_dataset_row.py +17 -0
  583. pygeai/tests/snippets/evaluation/dataset/create_expected_source.py +18 -0
  584. pygeai/tests/snippets/evaluation/dataset/create_filter_variable.py +19 -0
  585. pygeai/tests/snippets/evaluation/dataset/delete_dataset.py +9 -0
  586. pygeai/tests/snippets/evaluation/dataset/delete_dataset_row.py +10 -0
  587. pygeai/tests/snippets/evaluation/dataset/delete_expected_source.py +15 -0
  588. pygeai/tests/snippets/evaluation/dataset/delete_filter_variable.py +15 -0
  589. pygeai/tests/snippets/evaluation/dataset/get_dataset.py +9 -0
  590. pygeai/tests/snippets/evaluation/dataset/get_dataset_row.py +10 -0
  591. pygeai/tests/snippets/evaluation/dataset/get_expected_source.py +15 -0
  592. pygeai/tests/snippets/evaluation/dataset/get_filter_variable.py +15 -0
  593. pygeai/tests/snippets/evaluation/dataset/list_dataset_rows.py +9 -0
  594. pygeai/tests/snippets/evaluation/dataset/list_datasets.py +6 -0
  595. pygeai/tests/snippets/evaluation/dataset/list_expected_sources.py +10 -0
  596. pygeai/tests/snippets/evaluation/dataset/list_filter_variables.py +10 -0
  597. pygeai/tests/snippets/evaluation/dataset/update_dataset.py +15 -0
  598. pygeai/tests/snippets/evaluation/dataset/update_dataset_row.py +20 -0
  599. pygeai/tests/snippets/evaluation/dataset/update_expected_source.py +18 -0
  600. pygeai/tests/snippets/evaluation/dataset/update_filter_variable.py +19 -0
  601. pygeai/tests/snippets/evaluation/dataset/upload_dataset_rows_file.py +10 -0
  602. pygeai/tests/snippets/evaluation/plan/__init__.py +0 -0
  603. pygeai/tests/snippets/evaluation/plan/add_plan_system_metric.py +13 -0
  604. pygeai/tests/snippets/evaluation/plan/complete_workflow_example.py +136 -0
  605. pygeai/tests/snippets/evaluation/plan/create_evaluation_plan.py +24 -0
  606. pygeai/tests/snippets/evaluation/plan/create_rag_evaluation_plan.py +22 -0
  607. pygeai/tests/snippets/evaluation/plan/delete_evaluation_plan.py +9 -0
  608. pygeai/tests/snippets/evaluation/plan/delete_plan_system_metric.py +13 -0
  609. pygeai/tests/snippets/evaluation/plan/execute_evaluation_plan.py +11 -0
  610. pygeai/tests/snippets/evaluation/plan/get_evaluation_plan.py +9 -0
  611. pygeai/tests/snippets/evaluation/plan/get_plan_system_metric.py +13 -0
  612. pygeai/tests/snippets/evaluation/plan/get_system_metric.py +9 -0
  613. pygeai/tests/snippets/evaluation/plan/list_evaluation_plans.py +7 -0
  614. pygeai/tests/snippets/evaluation/plan/list_plan_system_metrics.py +9 -0
  615. pygeai/tests/snippets/evaluation/plan/list_system_metrics.py +7 -0
  616. pygeai/tests/snippets/evaluation/plan/update_evaluation_plan.py +22 -0
  617. pygeai/tests/snippets/evaluation/plan/update_plan_system_metric.py +14 -0
  618. pygeai/tests/snippets/evaluation/result/__init__.py +0 -0
  619. pygeai/tests/snippets/evaluation/result/complete_workflow_example.py +150 -0
  620. pygeai/tests/snippets/evaluation/result/get_evaluation_result.py +26 -0
  621. pygeai/tests/snippets/evaluation/result/list_evaluation_results.py +17 -0
  622. pygeai/tests/snippets/files/__init__.py +0 -0
  623. pygeai/tests/snippets/files/delete_file.py +9 -0
  624. pygeai/tests/snippets/files/get_file_content.py +10 -0
  625. pygeai/tests/snippets/files/get_file_data.py +9 -0
  626. pygeai/tests/snippets/files/get_file_list.py +6 -0
  627. pygeai/tests/snippets/files/upload_file.py +13 -0
  628. pygeai/tests/snippets/gam/__init__.py +0 -0
  629. pygeai/tests/snippets/gam/gam_access_token.py +87 -0
  630. pygeai/tests/snippets/lab/__init__.py +0 -0
  631. pygeai/tests/snippets/lab/agentic_flow_example_1.py +326 -0
  632. pygeai/tests/snippets/lab/agentic_flow_example_2.py +206 -0
  633. pygeai/tests/snippets/lab/agentic_flow_example_3.py +486 -0
  634. pygeai/tests/snippets/lab/agentic_flow_example_4.py +446 -0
  635. pygeai/tests/snippets/lab/agents/__init__.py +0 -0
  636. pygeai/tests/snippets/lab/agents/create_agent.py +48 -0
  637. pygeai/tests/snippets/lab/agents/create_agent_2.py +48 -0
  638. pygeai/tests/snippets/lab/agents/create_agent_edge_case.py +48 -0
  639. pygeai/tests/snippets/lab/agents/create_agent_with_permissions.py +39 -0
  640. pygeai/tests/snippets/lab/agents/create_agent_with_properties.py +46 -0
  641. pygeai/tests/snippets/lab/agents/create_agent_without_instructions.py +48 -0
  642. pygeai/tests/snippets/lab/agents/delete_agent.py +12 -0
  643. pygeai/tests/snippets/lab/agents/get_agent.py +24 -0
  644. pygeai/tests/snippets/lab/agents/get_agent_with_new_fields.py +62 -0
  645. pygeai/tests/snippets/lab/agents/get_sharing_link.py +13 -0
  646. pygeai/tests/snippets/lab/agents/list_agents.py +18 -0
  647. pygeai/tests/snippets/lab/agents/publish_agent_revision.py +12 -0
  648. pygeai/tests/snippets/lab/agents/update_agent.py +50 -0
  649. pygeai/tests/snippets/lab/agents/update_agent_properties.py +50 -0
  650. pygeai/tests/snippets/lab/assistant_to_agent.py +191 -0
  651. pygeai/tests/snippets/lab/crud_ui.py +462 -0
  652. pygeai/tests/snippets/lab/processes/__init__.py +0 -0
  653. pygeai/tests/snippets/lab/processes/create_process.py +24 -0
  654. pygeai/tests/snippets/lab/processes/create_task.py +8 -0
  655. pygeai/tests/snippets/lab/processes/jobs/__init__.py +0 -0
  656. pygeai/tests/snippets/lab/processes/jobs/list_jobs.py +21 -0
  657. pygeai/tests/snippets/lab/processes/kbs/__init__.py +0 -0
  658. pygeai/tests/snippets/lab/processes/kbs/create_kb.py +18 -0
  659. pygeai/tests/snippets/lab/processes/kbs/get_kb.py +26 -0
  660. pygeai/tests/snippets/lab/processes/kbs/list_kbs.py +30 -0
  661. pygeai/tests/snippets/lab/processes/kbs/try_all.py +73 -0
  662. pygeai/tests/snippets/lab/processes/list_processes.py +10 -0
  663. pygeai/tests/snippets/lab/runner_1.py +212 -0
  664. pygeai/tests/snippets/lab/samples/__init__.py +0 -0
  665. pygeai/tests/snippets/lab/samples/summarize_files.py +162 -0
  666. pygeai/tests/snippets/lab/strategies/__init__.py +0 -0
  667. pygeai/tests/snippets/lab/strategies/create_reasoning_strategy.py +22 -0
  668. pygeai/tests/snippets/lab/strategies/get_reasoning_strategy.py +10 -0
  669. pygeai/tests/snippets/lab/strategies/list_reasoning_strategies.py +16 -0
  670. pygeai/tests/snippets/lab/strategies/update_reasoning_strategy.py +26 -0
  671. pygeai/tests/snippets/lab/tools/__init__.py +0 -0
  672. pygeai/tests/snippets/lab/tools/create_tool.py +48 -0
  673. pygeai/tests/snippets/lab/tools/create_tool_edge_case.py +50 -0
  674. pygeai/tests/snippets/lab/tools/delete_tool.py +21 -0
  675. pygeai/tests/snippets/lab/tools/get_parameter.py +21 -0
  676. pygeai/tests/snippets/lab/tools/get_tool.py +22 -0
  677. pygeai/tests/snippets/lab/tools/list_tools.py +23 -0
  678. pygeai/tests/snippets/lab/tools/publish_tool_revision.py +13 -0
  679. pygeai/tests/snippets/lab/tools/set_parameters.py +33 -0
  680. pygeai/tests/snippets/lab/tools/update_tool.py +52 -0
  681. pygeai/tests/snippets/lab/use_cases/__init__.py +0 -0
  682. pygeai/tests/snippets/lab/use_cases/c_code_fixer_agent_flow.py +238 -0
  683. pygeai/tests/snippets/lab/use_cases/create_cli_expert.py +1640 -0
  684. pygeai/tests/snippets/lab/use_cases/create_lab_expert.py +4541 -0
  685. pygeai/tests/snippets/lab/use_cases/create_tool_headless_web_browser.py +133 -0
  686. pygeai/tests/snippets/lab/use_cases/create_web_designer.py +189 -0
  687. pygeai/tests/snippets/lab/use_cases/create_web_reader.py +185 -0
  688. pygeai/tests/snippets/lab/use_cases/file_summarizer_example.py +157 -0
  689. pygeai/tests/snippets/lab/use_cases/file_summarizer_example_2.py +157 -0
  690. pygeai/tests/snippets/lab/use_cases/update_cli_expert.py +1773 -0
  691. pygeai/tests/snippets/lab/use_cases/update_lab_expert.py +4541 -0
  692. pygeai/tests/snippets/lab/use_cases/update_web_designer.py +188 -0
  693. pygeai/tests/snippets/lab/use_cases/update_web_reader.py +195 -0
  694. pygeai/tests/snippets/lab/use_cases/update_web_reader_with_tool.py +210 -0
  695. pygeai/tests/snippets/migrate/__init__.py +45 -0
  696. pygeai/tests/snippets/migrate/agent_migration.py +110 -0
  697. pygeai/tests/snippets/migrate/assistant_migration.py +64 -0
  698. pygeai/tests/snippets/migrate/orchestrator_examples.py +179 -0
  699. pygeai/tests/snippets/migrate/process_migration.py +64 -0
  700. pygeai/tests/snippets/migrate/project_migration.py +42 -0
  701. pygeai/tests/snippets/migrate/tool_migration.py +64 -0
  702. pygeai/tests/snippets/organization/__init__.py +0 -0
  703. pygeai/tests/snippets/organization/add_project_member.py +10 -0
  704. pygeai/tests/snippets/organization/add_project_member_batch.py +44 -0
  705. pygeai/tests/snippets/organization/create_project.py +23 -0
  706. pygeai/tests/snippets/organization/delete_project.py +7 -0
  707. pygeai/tests/snippets/organization/export_request_data.py +7 -0
  708. pygeai/tests/snippets/organization/get_memberships.py +12 -0
  709. pygeai/tests/snippets/organization/get_organization_members.py +6 -0
  710. pygeai/tests/snippets/organization/get_project_data.py +7 -0
  711. pygeai/tests/snippets/organization/get_project_list.py +8 -0
  712. pygeai/tests/snippets/organization/get_project_members.py +6 -0
  713. pygeai/tests/snippets/organization/get_project_memberships.py +12 -0
  714. pygeai/tests/snippets/organization/get_project_roles.py +6 -0
  715. pygeai/tests/snippets/organization/get_project_tokens.py +7 -0
  716. pygeai/tests/snippets/organization/update_project.py +14 -0
  717. pygeai/tests/snippets/rerank/__init__.py +0 -0
  718. pygeai/tests/snippets/rerank/rerank_chunks.py +19 -0
  719. pygeai/tests/snippets/secrets/__init__.py +0 -0
  720. pygeai/tests/snippets/usage_limit/__init__.py +0 -0
  721. pygeai/tests/snippets/usage_limit/delete_usage_limit.py +16 -0
  722. pygeai/tests/snippets/usage_limit/get_all_usage_limit_from_organization.py +12 -0
  723. pygeai/tests/snippets/usage_limit/get_usage_limit_from_organization.py +11 -0
  724. pygeai/tests/snippets/usage_limit/get_usage_limit_from_project.py +13 -0
  725. pygeai/tests/snippets/usage_limit/set_usage_limit_organization.py +22 -0
  726. pygeai/tests/snippets/usage_limit/set_usage_limit_project.py +23 -0
  727. pygeai/tests/snippets/usage_limit/update_usage_limit_organization.py +23 -0
  728. pygeai/tests/snippets/usage_limit/update_usage_limit_project.py +24 -0
  729. pygeai/vendor/a2a/__init__.py +1 -0
  730. pygeai/vendor/a2a/auth/__init__.py +0 -0
  731. pygeai/vendor/a2a/auth/user.py +31 -0
  732. pygeai/vendor/a2a/client/__init__.py +19 -0
  733. pygeai/vendor/a2a/client/client.py +425 -0
  734. pygeai/vendor/a2a/client/errors.py +33 -0
  735. pygeai/vendor/a2a/client/helpers.py +22 -0
  736. pygeai/vendor/a2a/py.typed +0 -0
  737. pygeai/vendor/a2a/server/__init__.py +1 -0
  738. pygeai/vendor/a2a/server/agent_execution/__init__.py +18 -0
  739. pygeai/vendor/a2a/server/agent_execution/agent_executor.py +44 -0
  740. pygeai/vendor/a2a/server/agent_execution/context.py +155 -0
  741. pygeai/vendor/a2a/server/agent_execution/request_context_builder.py +20 -0
  742. pygeai/vendor/a2a/server/agent_execution/simple_request_context_builder.py +77 -0
  743. pygeai/vendor/a2a/server/apps/__init__.py +16 -0
  744. pygeai/vendor/a2a/server/apps/jsonrpc/__init__.py +16 -0
  745. pygeai/vendor/a2a/server/apps/jsonrpc/fastapi_app.py +88 -0
  746. pygeai/vendor/a2a/server/apps/jsonrpc/jsonrpc_app.py +426 -0
  747. pygeai/vendor/a2a/server/apps/jsonrpc/starlette_app.py +123 -0
  748. pygeai/vendor/a2a/server/context.py +23 -0
  749. pygeai/vendor/a2a/server/events/__init__.py +21 -0
  750. pygeai/vendor/a2a/server/events/event_consumer.py +149 -0
  751. pygeai/vendor/a2a/server/events/event_queue.py +156 -0
  752. pygeai/vendor/a2a/server/events/in_memory_queue_manager.py +85 -0
  753. pygeai/vendor/a2a/server/events/queue_manager.py +35 -0
  754. pygeai/vendor/a2a/server/request_handlers/__init__.py +20 -0
  755. pygeai/vendor/a2a/server/request_handlers/default_request_handler.py +435 -0
  756. pygeai/vendor/a2a/server/request_handlers/jsonrpc_handler.py +327 -0
  757. pygeai/vendor/a2a/server/request_handlers/request_handler.py +161 -0
  758. pygeai/vendor/a2a/server/request_handlers/response_helpers.py +133 -0
  759. pygeai/vendor/a2a/server/tasks/__init__.py +20 -0
  760. pygeai/vendor/a2a/server/tasks/inmemory_push_notifier.py +62 -0
  761. pygeai/vendor/a2a/server/tasks/inmemory_task_store.py +51 -0
  762. pygeai/vendor/a2a/server/tasks/push_notifier.py +25 -0
  763. pygeai/vendor/a2a/server/tasks/result_aggregator.py +151 -0
  764. pygeai/vendor/a2a/server/tasks/task_manager.py +253 -0
  765. pygeai/vendor/a2a/server/tasks/task_store.py +22 -0
  766. pygeai/vendor/a2a/server/tasks/task_updater.py +155 -0
  767. pygeai/vendor/a2a/types.py +1624 -0
  768. pygeai/vendor/a2a/utils/__init__.py +40 -0
  769. pygeai/vendor/a2a/utils/artifact.py +72 -0
  770. pygeai/vendor/a2a/utils/errors.py +69 -0
  771. pygeai/vendor/a2a/utils/helpers.py +176 -0
  772. pygeai/vendor/a2a/utils/message.py +83 -0
  773. pygeai/vendor/a2a/utils/task.py +57 -0
  774. pygeai/vendor/a2a/utils/telemetry.py +299 -0
  775. pygeai-0.6.0b15.dist-info/METADATA +205 -0
  776. pygeai-0.6.0b15.dist-info/RECORD +799 -0
  777. {pygeai-0.1.6.dist-info → pygeai-0.6.0b15.dist-info}/WHEEL +1 -1
  778. pygeai-0.6.0b15.dist-info/entry_points.txt +5 -0
  779. {pygeai-0.1.6.dist-info → pygeai-0.6.0b15.dist-info/licenses}/LICENSE +13 -1
  780. {pygeai-0.1.6.dist-info → pygeai-0.6.0b15.dist-info}/top_level.txt +0 -1
  781. docs/source/conf.py +0 -45
  782. pygeai/core/clients.py +0 -240
  783. pygeai/tests/core/test_clients.py +0 -49
  784. pygeai-0.1.6.dist-info/METADATA +0 -92
  785. pygeai-0.1.6.dist-info/RECORD +0 -65
  786. pygeai-0.1.6.dist-info/SOURCES.sync-conflict-20241223-145950-3QD4F42.txt +0 -41
  787. pygeai-0.1.6.dist-info/entry_points.txt +0 -2
  788. /pygeai/{agent → analytics}/__init__.py +0 -0
@@ -0,0 +1,4110 @@
1
+ import json
2
+
3
+ from pygeai import logger
4
+ from pygeai.cli.commands import Command, Option, ArgumentsEnum
5
+ from pygeai.cli.commands.builders import build_help_text
6
+ from pygeai.cli.commands.common import get_boolean_value
7
+ from pygeai.cli.commands.lab.common import get_agent_data_prompt_inputs, get_agent_data_prompt_outputs, \
8
+ get_agent_data_prompt_examples, get_tool_parameters
9
+ from pygeai.cli.texts.help import AI_LAB_HELP_TEXT
10
+ from pygeai.core.common.exceptions import MissingRequirementException, WrongArgumentError
11
+ from pygeai.core.utils.console import Console
12
+ from pygeai.cli.commands.lab.options import PROJECT_ID_OPTION
13
+ from pygeai.lab.agents.clients import AgentClient
14
+ from pygeai.lab.processes.clients import AgenticProcessClient
15
+ from pygeai.lab.strategies.clients import ReasoningStrategyClient
16
+ from pygeai.lab.tools.clients import ToolClient
17
+ from pygeai.lab.constants import VALID_SCOPES
18
+
19
+
20
+ def show_help():
21
+ """
22
+ Displays help text in stdout
23
+ """
24
+ help_text = build_help_text(ai_lab_commands, AI_LAB_HELP_TEXT)
25
+ Console.write_stdout(help_text)
26
+
27
+
28
+ def list_agents(option_list: list):
29
+ project_id = None
30
+ status = ""
31
+ start = ""
32
+ count = ""
33
+ access_scope = "public"
34
+ allow_drafts = True
35
+ allow_external = False
36
+
37
+ for option_flag, option_arg in option_list:
38
+ if option_flag.name == "project_id":
39
+ project_id = option_arg
40
+ if option_flag.name == "status":
41
+ status = option_arg
42
+ if option_flag.name == "start":
43
+ start = option_arg
44
+ if option_flag.name == "count":
45
+ count = option_arg
46
+ if option_flag.name == "access_scope":
47
+ access_scope = option_arg
48
+ if option_flag.name == "allow_drafts":
49
+ allow_drafts = get_boolean_value(option_arg)
50
+ if option_flag.name == "allow_external":
51
+ allow_external = get_boolean_value(option_arg)
52
+
53
+ client = AgentClient(project_id=project_id)
54
+ result = client.list_agents(
55
+ status=status,
56
+ start=start,
57
+ count=count,
58
+ access_scope=access_scope,
59
+ allow_drafts=allow_drafts,
60
+ allow_external=allow_external,
61
+ )
62
+ Console.write_stdout(f"Agent list: \n{result}")
63
+
64
+
65
+ list_agents_options = [
66
+ PROJECT_ID_OPTION,
67
+ Option(
68
+ "status",
69
+ ["--status"],
70
+ "Status of the agents to filter by. Defaults to an empty string (no filtering).",
71
+ True
72
+ ),
73
+ Option(
74
+ "start",
75
+ ["--start"],
76
+ "Starting index for pagination. Defaults to an empty string (no offset).",
77
+ True
78
+ ),
79
+ Option(
80
+ "count",
81
+ ["--count"],
82
+ "Number of agents to retrieve. Defaults to an empty string (no limit).",
83
+ True
84
+ ),
85
+ Option(
86
+ "access_scope",
87
+ ["--access-scope"],
88
+ 'Access scope of the agents, either "public" or "private". Defaults to "public".',
89
+ True
90
+ ),
91
+ Option(
92
+ "allow_drafts",
93
+ ["--allow-drafts"],
94
+ "Whether to include draft agents. Defaults to 1 (True).",
95
+ True
96
+ ),
97
+ Option(
98
+ "allow_external",
99
+ ["--allow-external"],
100
+ "Whether to include external agents. Defaults to 0 (False).",
101
+ True
102
+ )
103
+ ]
104
+
105
+
106
+ def create_agent(option_list: list):
107
+ project_id = None
108
+ name = None
109
+ access_scope = None
110
+ public_name = None
111
+ job_description = None
112
+ avatar_image = None
113
+ description = None
114
+ agent_data_prompt_instructions = None
115
+ agent_data_prompt_inputs = list()
116
+ agent_data_prompt_outputs = list()
117
+ agent_data_prompt_examples = list()
118
+ agent_data_llm_max_tokens = None
119
+ agent_data_llm_timeout = None
120
+ agent_data_llm_temperature = None
121
+ agent_data_llm_top_k = None
122
+ agent_data_llm_top_p = None
123
+ agent_data_strategy_name = None
124
+ agent_data_model_name = None
125
+ agent_data_resource_pools = None
126
+ automatic_publish = False
127
+
128
+ for option_flag, option_arg in option_list:
129
+ if option_flag.name == "project_id":
130
+ project_id = option_arg
131
+ if option_flag.name == "name":
132
+ name = option_arg
133
+ if option_flag.name == "access_scope":
134
+ access_scope = option_arg
135
+ if option_flag.name == "public_name":
136
+ public_name = option_arg
137
+ if option_flag.name == "job_description":
138
+ job_description = option_arg
139
+ if option_flag.name == "avatar_image":
140
+ avatar_image = option_arg
141
+ if option_flag.name == "description":
142
+ description = option_arg
143
+
144
+ if option_flag.name == "agent_data_prompt_instructions":
145
+ agent_data_prompt_instructions = option_arg
146
+ if option_flag.name == "agent_data_prompt_input":
147
+
148
+ if "[" not in option_arg:
149
+ agent_data_prompt_inputs.append(option_arg)
150
+ else:
151
+ try:
152
+ input_json = json.loads(option_arg)
153
+ if not isinstance(input_json, list):
154
+ raise ValueError
155
+
156
+ agent_data_prompt_inputs = input_json
157
+ except Exception as e:
158
+ raise WrongArgumentError(
159
+ "Inputs must be a list of strings: '[\"input_name\", \"another_input\"]'. "
160
+ "Each element in the list must be a string representing an input name."
161
+ )
162
+ if option_flag.name == "agent_data_prompt_output":
163
+ try:
164
+ output_json = json.loads(option_arg)
165
+ if isinstance(output_json, list):
166
+ agent_data_prompt_outputs = output_json
167
+ elif isinstance(output_json, dict):
168
+ agent_data_prompt_outputs.append(output_json)
169
+ except Exception as e:
170
+ raise WrongArgumentError(
171
+ "Each output must be in JSON format: '{\"key\": \"output_key\", \"description\": \"description of the output\"}' "
172
+ "It must be a dictionary or a list of dictionaries. Each dictionary must contain 'key' and 'description'."
173
+ )
174
+
175
+ if option_flag.name == "agent_data_prompt_example":
176
+ try:
177
+ examples_json = json.loads(option_arg)
178
+ if isinstance(examples_json, list):
179
+ agent_data_prompt_examples = examples_json
180
+ elif isinstance(examples_json, dict):
181
+ agent_data_prompt_examples.append(examples_json)
182
+ except Exception as e:
183
+ raise WrongArgumentError(
184
+ "Each example must be in JSON format: '{\"inputData\": \"example input\", \"output\": \"expected output in JSON string format\"}' "
185
+ "It must be a dictionary or a list of dictionaries. Each dictionary must contain 'inputData' and 'output'."
186
+ )
187
+
188
+ if option_flag.name == "agent_data_llm_max_tokens":
189
+ agent_data_llm_max_tokens = option_arg
190
+ if option_flag.name == "agent_data_llm_timeout":
191
+ agent_data_llm_timeout = option_arg
192
+ if option_flag.name == "agent_data_llm_temperature":
193
+ agent_data_llm_temperature = option_arg
194
+ if option_flag.name == "agent_data_llm_top_k":
195
+ agent_data_llm_top_k = option_arg
196
+ if option_flag.name == "agent_data_llm_top_p":
197
+ agent_data_llm_top_p = option_arg
198
+ if option_flag.name == "agent_data_strategy_name":
199
+ agent_data_strategy_name = option_arg
200
+ if option_flag.name == "agent_data_model_name":
201
+ agent_data_model_name = option_arg
202
+ if option_flag.name == "agent_data_resource_pools":
203
+ try:
204
+ pools_json = json.loads(option_arg)
205
+ if not isinstance(pools_json, list):
206
+ raise ValueError
207
+ agent_data_resource_pools = pools_json
208
+ except Exception as e:
209
+ raise WrongArgumentError(
210
+ "Resource pools must be in JSON format: '[{\"name\": \"pool_name\", \"tools\": [{\"name\": \"tool_name\", \"revision\": int}], \"agents\": [{\"name\": \"agent_name\", \"revision\": int}]}]' "
211
+ "It must be a list of dictionaries. Each dictionary must contain 'name' and optional 'tools' and 'agents' lists."
212
+ )
213
+ if option_flag.name == "automatic_publish":
214
+ automatic_publish = get_boolean_value(option_arg)
215
+
216
+ if not name:
217
+ raise MissingRequirementException("Cannot create assistant without specifying name.")
218
+
219
+ if access_scope == 'public' and not public_name:
220
+ raise MissingRequirementException("If access scope is public, public name must be defined.")
221
+
222
+ prompt_inputs = get_agent_data_prompt_inputs(agent_data_prompt_inputs)
223
+ prompt_outputs = get_agent_data_prompt_outputs(agent_data_prompt_outputs)
224
+ prompt_examples = get_agent_data_prompt_examples(agent_data_prompt_examples)
225
+
226
+ agent_data_prompt = {
227
+ "instructions": agent_data_prompt_instructions,
228
+ "inputs": prompt_inputs,
229
+ "outputs": prompt_outputs,
230
+ "examples": prompt_examples
231
+ }
232
+ agent_data_llm_config = {
233
+ "maxTokens": agent_data_llm_max_tokens,
234
+ "timeout": agent_data_llm_timeout,
235
+ "sampling": {
236
+ "temperature": agent_data_llm_temperature,
237
+ "topK": agent_data_llm_top_k,
238
+ "topP": agent_data_llm_top_p,
239
+ }
240
+ }
241
+ agent_data_models = [
242
+ {"name": agent_data_model_name}
243
+ ]
244
+
245
+ client = AgentClient(project_id=project_id)
246
+ result = client.create_agent(
247
+ name=name,
248
+ access_scope=access_scope,
249
+ public_name=public_name,
250
+ job_description=job_description,
251
+ avatar_image=avatar_image,
252
+ description=description,
253
+ agent_data_prompt=agent_data_prompt,
254
+ agent_data_llm_config=agent_data_llm_config,
255
+ agent_data_strategy_name=agent_data_strategy_name,
256
+ agent_data_models=agent_data_models,
257
+ agent_data_resource_pools=agent_data_resource_pools,
258
+ automatic_publish=automatic_publish
259
+ )
260
+ Console.write_stdout(f"New agent detail: \n{result}")
261
+
262
+
263
+ create_agent_options = [
264
+ PROJECT_ID_OPTION,
265
+ Option(
266
+ "name",
267
+ ["--name", "-n"],
268
+ "Name of the agent, must be unique within the project and exclude ':' or '/'",
269
+ True
270
+ ),
271
+ Option(
272
+ "access_scope",
273
+ ["--access-scope", "--as"],
274
+ "Access scope of the agent, either 'public' or 'private' (defaults to 'private')",
275
+ True
276
+ ),
277
+ Option(
278
+ "public_name",
279
+ ["--public-name", "--pn"],
280
+ "Public name of the agent, required if access_scope is 'public', must be unique and follow a domain/library convention (e.g., 'com.example.my-agent') with only alphanumeric characters, periods, dashes, or underscores",
281
+ True
282
+ ),
283
+ Option(
284
+ "job_description",
285
+ ["--job-description", "--jd"],
286
+ "Description of the agent's role",
287
+ True
288
+ ),
289
+ Option(
290
+ "avatar_image",
291
+ ["--avatar-image", "--aimg"],
292
+ "URL for the agent's avatar image",
293
+ True
294
+ ),
295
+ Option(
296
+ "description",
297
+ ["--description", "-d"],
298
+ "Detailed description of the agent's purpose",
299
+ True
300
+ ),
301
+ Option(
302
+ "agent_data_prompt_instructions",
303
+ ["--agent-data-prompt-instructions", "--adp-inst"],
304
+ "Instructions defining what the agent does and how, required for publication if context is not provided",
305
+ True
306
+ ),
307
+ Option(
308
+ "agent_data_prompt_input",
309
+ ["--agent-data-prompt-input", "--adp-input"],
310
+ "Agent Data prompt input: "
311
+ "Prompt input as a list of strings (e.g., '[\"input1\", \"input2\"]') or multiple single strings via repeated flags, each representing an input name",
312
+ True
313
+ ),
314
+ Option(
315
+ "agent_data_prompt_output",
316
+ ["--agent-data-prompt-output", "--adp-out"],
317
+ "Prompt output in JSON format (e.g., '[{\"key\": \"output_key\", \"description\": \"output description\"}]'), as a dictionary or list of dictionaries with 'key' and 'description' fields",
318
+ True
319
+ ),
320
+ Option(
321
+ "agent_data_prompt_example",
322
+ ["--agent-data-prompt-example", "--adp-ex"],
323
+ "Prompt example in JSON format (e.g., '[{\"inputData\": \"example input\", \"output\": \"example output\"}]'), as a dictionary or list of dictionaries with 'inputData' and 'output' fields",
324
+ True
325
+ ),
326
+ Option(
327
+ "agent_data_llm_max_tokens",
328
+ ["--agent-data-llm-max-tokens", "--adl-max-tokens"],
329
+ "Maximum number of tokens the LLM can generate, used to control costs",
330
+ True
331
+ ),
332
+ Option(
333
+ "agent_data_llm_timeout",
334
+ ["--agent-data-llm-timeout", "--adl-timeout"],
335
+ "Timeout in seconds for LLM responses",
336
+ True
337
+ ),
338
+ Option(
339
+ "agent_data_llm_temperature",
340
+ ["--agent-data-llm-temperature", "--adl-temperature"],
341
+ "Sampling temperature for LLM (0.0 to 1.0), lower values for focused responses, higher for more random outputs",
342
+ True
343
+ ),
344
+ Option(
345
+ "agent_data_llm_top_k",
346
+ ["--agent-data-llm-top-k", "--adl-top-k"],
347
+ "TopK sampling parameter for LLM (currently unused)",
348
+ True
349
+ ),
350
+ Option(
351
+ "agent_data_llm_top_p",
352
+ ["--agent-data-llm-top-p", "--adl-top-p"],
353
+ "TopP sampling parameter for LLM (currently unused)",
354
+ True
355
+ ),
356
+ Option(
357
+ "agent_data_strategy_name",
358
+ ["--agent-data-strategy-name", "--strategy-name"],
359
+ "Name of the reasoning strategy to use",
360
+ True
361
+ ),
362
+ Option(
363
+ "agent_data_model_name",
364
+ ["--agent-data-model-name", "--adm-name"],
365
+ "Name of the LLM model (e.g., 'gpt-4o' or 'openai/gpt-4o'), at least one valid model required for publication",
366
+ True
367
+ ),
368
+ Option(
369
+ "agent_data_resource_pools",
370
+ ["--agent-data-resource-pools", "--adr-pools"],
371
+ "Resource pools in JSON format (e.g., '[{\"name\": \"pool_name\", \"tools\": [{\"name\": \"tool_name\", \"revision\": int}], \"agents\": [{\"name\": \"agent_name\", \"revision\": int}]}]'), "
372
+ "as a list of dictionaries with 'name' (required) and optional 'tools' and 'agents' lists",
373
+ True
374
+ ),
375
+ Option(
376
+ "automatic_publish",
377
+ ["--automatic-publish", "--ap"],
378
+ "Whether to publish the agent after creation (0: create as draft, 1: create and publish)",
379
+ True
380
+ ),
381
+ ]
382
+
383
+
384
+ def get_agent(option_list: list):
385
+ project_id = None
386
+ agent_id = None
387
+ revision = 0
388
+ version = 0
389
+ allow_drafts = True
390
+
391
+ for option_flag, option_arg in option_list:
392
+ if option_flag.name == "project_id":
393
+ project_id = option_arg
394
+ if option_flag.name == "agent_id":
395
+ agent_id = option_arg
396
+ if option_flag.name == "revision":
397
+ revision = option_arg
398
+ if option_flag.name == "version":
399
+ version = option_arg
400
+ if option_flag.name == "allow_drafts":
401
+ allow_drafts = get_boolean_value(option_arg)
402
+
403
+ if not agent_id:
404
+ raise MissingRequirementException("Agent ID must be specified.")
405
+
406
+ client = AgentClient(project_id=project_id)
407
+ result = client.get_agent(
408
+ agent_id=agent_id,
409
+ revision=revision,
410
+ version=version,
411
+ allow_drafts=allow_drafts,
412
+ )
413
+ Console.write_stdout(f"Agent detail: \n{result}")
414
+
415
+
416
+ get_agent_options = [
417
+ PROJECT_ID_OPTION,
418
+ Option(
419
+ "agent_id",
420
+ ["--agent-id", "--aid"],
421
+ "ID of the agent to retrieve",
422
+ True
423
+ ),
424
+ Option(
425
+ "revision",
426
+ ["--revision", "-r"],
427
+ "Revision of agent.",
428
+ True
429
+ ),
430
+ Option(
431
+ "version",
432
+ ["--version", "-v"],
433
+ 'Version of agent.',
434
+ True
435
+ ),
436
+ Option(
437
+ "allow_drafts",
438
+ ["--allow-drafts"],
439
+ "Whether to include draft agents. Defaults to 1 (True).",
440
+ True
441
+ ),
442
+ ]
443
+
444
+
445
+ def export_agent(option_list: list):
446
+ project_id = None
447
+ agent_id = None
448
+ file = None
449
+
450
+ for option_flag, option_arg in option_list:
451
+ if option_flag.name == "project_id":
452
+ project_id = option_arg
453
+ if option_flag.name == "agent_id":
454
+ agent_id = option_arg
455
+ if option_flag.name == "file":
456
+ file = option_arg
457
+
458
+ if not agent_id:
459
+ raise MissingRequirementException("Agent ID must be specified.")
460
+
461
+ client = AgentClient(project_id=project_id)
462
+ result = client.export_agent(
463
+ agent_id=agent_id,
464
+ )
465
+ if file:
466
+ try:
467
+ data = json.loads(result) if isinstance(result, str) else result
468
+ with open(file, "w") as f:
469
+ json.dump(data, f, indent=4)
470
+ Console.write_stdout(f"Result from API saved to {file}.")
471
+ except json.JSONDecodeError as e:
472
+ logger.error(f"Result from API endpoint is not in JSON format: {e}")
473
+ Console.write_stderr(f"Result from API endpoint is not in JSON format.")
474
+ else:
475
+ Console.write_stdout(f"Agent spec: \n{result}")
476
+
477
+
478
+ export_agent_options = [
479
+ PROJECT_ID_OPTION,
480
+ Option(
481
+ "agent_id",
482
+ ["--agent-id", "--aid"],
483
+ "ID of the agent to retrieve",
484
+ True
485
+ ),
486
+ Option(
487
+ "file",
488
+ ["--file", "-f"],
489
+ "File path to save export specification for agent",
490
+ True
491
+ ),
492
+ ]
493
+
494
+
495
+ def import_agent(option_list: list):
496
+ project_id = None
497
+ file = None
498
+
499
+ for option_flag, option_arg in option_list:
500
+ if option_flag.name == "project_id":
501
+ project_id = option_arg
502
+ if option_flag.name == "file":
503
+ file = option_arg
504
+
505
+
506
+ if not file:
507
+ raise MissingRequirementException("File path to spec must be specified.")
508
+
509
+ try:
510
+ with open(file, "r") as f:
511
+ agent_data = json.load(f)
512
+ except json.JSONDecodeError as e:
513
+ logger.error(f"File is not in JSON format: {e}")
514
+ Console.write_stderr(f"File is not in JSON format.")
515
+
516
+ client = AgentClient(project_id=project_id)
517
+ result = client.import_agent(
518
+ data=agent_data
519
+ )
520
+
521
+ Console.write_stdout(f"Agent import details: {result}")
522
+
523
+
524
+
525
+ import_agent_options = [
526
+ PROJECT_ID_OPTION,
527
+ Option(
528
+ "file",
529
+ ["--file", "-f"],
530
+ "File path to save export specification for agent",
531
+ True
532
+ ),
533
+ ]
534
+
535
+
536
+ def create_sharing_link(option_list: list):
537
+ project_id = None
538
+ agent_id = None
539
+
540
+ for option_flag, option_arg in option_list:
541
+ if option_flag.name == "project_id":
542
+ project_id = option_arg
543
+ if option_flag.name == "agent_id":
544
+ agent_id = option_arg
545
+
546
+ if not agent_id:
547
+ raise MissingRequirementException("Agent ID must be specified.")
548
+
549
+ client = AgentClient(project_id=project_id)
550
+ result = client.create_sharing_link(
551
+ agent_id=agent_id,
552
+ )
553
+ Console.write_stdout(f"Sharing token: \n{result}")
554
+
555
+
556
+ create_sharing_link_options = [
557
+ PROJECT_ID_OPTION,
558
+ Option(
559
+ "agent_id",
560
+ ["--agent-id", "--aid"],
561
+ "ID of the agent to retrieve",
562
+ True
563
+ ),
564
+ ]
565
+
566
+
567
+ def publish_agent_revision(option_list: list):
568
+ project_id = None
569
+ agent_id = None
570
+ revision = None
571
+
572
+ for option_flag, option_arg in option_list:
573
+ if option_flag.name == "project_id":
574
+ project_id = option_arg
575
+ if option_flag.name == "agent_id":
576
+ agent_id = option_arg
577
+ if option_flag.name == "revision":
578
+ revision = option_arg
579
+
580
+ if not (agent_id and revision):
581
+ raise MissingRequirementException("Agent ID and revision must be specified.")
582
+
583
+ client = AgentClient(project_id=project_id)
584
+ result = client.publish_agent_revision(
585
+ agent_id=agent_id,
586
+ revision=revision
587
+ )
588
+ Console.write_stdout(f"Published revision detail: \n{result}")
589
+
590
+
591
+ publish_agent_revision_options = [
592
+ PROJECT_ID_OPTION,
593
+ Option(
594
+ "agent_id",
595
+ ["--agent-id", "--aid"],
596
+ "ID of the agent to retrieve",
597
+ True
598
+ ),
599
+ Option(
600
+ "revision",
601
+ ["--revision", "-r"],
602
+ "Revision of agent.",
603
+ True
604
+ ),
605
+ ]
606
+
607
+
608
+ def delete_agent(option_list: list):
609
+ project_id = None
610
+ agent_id = None
611
+
612
+ for option_flag, option_arg in option_list:
613
+ if option_flag.name == "project_id":
614
+ project_id = option_arg
615
+ if option_flag.name == "agent_id":
616
+ agent_id = option_arg
617
+
618
+ if not agent_id:
619
+ raise MissingRequirementException("Agent ID must be specified.")
620
+
621
+ client = AgentClient(project_id=project_id)
622
+ result = client.delete_agent(
623
+ agent_id=agent_id,
624
+ )
625
+ Console.write_stdout(f"Deleted agent detail: \n{result}")
626
+
627
+
628
+ delete_agent_options = [
629
+ PROJECT_ID_OPTION,
630
+ Option(
631
+ "agent_id",
632
+ ["--agent-id", "--aid"],
633
+ "ID of the agent to retrieve",
634
+ True
635
+ ),
636
+ ]
637
+
638
+
639
+ def update_agent(option_list: list):
640
+ project_id = None
641
+ agent_id = None
642
+ name = None
643
+ access_scope = None
644
+ public_name = None
645
+ job_description = None
646
+ avatar_image = None
647
+ description = None
648
+ agent_data_prompt_instructions = None
649
+ agent_data_prompt_inputs = list()
650
+ agent_data_prompt_outputs = list()
651
+ agent_data_prompt_examples = list()
652
+ agent_data_llm_max_tokens = None
653
+ agent_data_llm_timeout = None
654
+ agent_data_llm_temperature = None
655
+ agent_data_llm_top_k = None
656
+ agent_data_llm_top_p = None
657
+ agent_data_strategy_name = None
658
+ agent_data_model_name = None
659
+ agent_data_resource_pools = None
660
+ automatic_publish = False
661
+ upsert = False
662
+
663
+ for option_flag, option_arg in option_list:
664
+ if option_flag.name == "project_id":
665
+ project_id = option_arg
666
+ if option_flag.name == "agent_id":
667
+ agent_id = option_arg
668
+ if option_flag.name == "name":
669
+ name = option_arg
670
+ if option_flag.name == "access_scope":
671
+ access_scope = option_arg
672
+ if option_flag.name == "public_name":
673
+ public_name = option_arg
674
+ if option_flag.name == "job_description":
675
+ job_description = option_arg
676
+ if option_flag.name == "avatar_image":
677
+ avatar_image = option_arg
678
+ if option_flag.name == "description":
679
+ description = option_arg
680
+
681
+ if option_flag.name == "agent_data_prompt_instructions":
682
+ agent_data_prompt_instructions = option_arg
683
+ if option_flag.name == "agent_data_prompt_input":
684
+
685
+ if "[" not in option_arg:
686
+ agent_data_prompt_inputs.append(option_arg)
687
+ else:
688
+ try:
689
+ input_json = json.loads(option_arg)
690
+ if not isinstance(input_json, list):
691
+ raise ValueError
692
+
693
+ agent_data_prompt_inputs = input_json
694
+ except Exception as e:
695
+ raise WrongArgumentError(
696
+ "Inputs must be a list of strings: '[\"input_name\", \"another_input\"]'. "
697
+ "Each element in the list must be a string representing an input name."
698
+ )
699
+ if option_flag.name == "agent_data_prompt_output":
700
+ try:
701
+ output_json = json.loads(option_arg)
702
+ if isinstance(output_json, list):
703
+ agent_data_prompt_outputs = output_json
704
+ elif isinstance(output_json, dict):
705
+ agent_data_prompt_outputs.append(output_json)
706
+ except Exception as e:
707
+ raise WrongArgumentError(
708
+ "Each output must be in JSON format: '{\"key\": \"output_key\", \"description\": \"description of the output\"}' "
709
+ "It must be a dictionary or a list of dictionaries. Each dictionary must contain 'key' and 'description'."
710
+ )
711
+
712
+ if option_flag.name == "agent_data_prompt_example":
713
+ try:
714
+ examples_json = json.loads(option_arg)
715
+ if isinstance(examples_json, list):
716
+ agent_data_prompt_examples = examples_json
717
+ elif isinstance(examples_json, dict):
718
+ agent_data_prompt_examples.append(examples_json)
719
+ except Exception as e:
720
+ raise WrongArgumentError(
721
+ "Each example must be in JSON format: '{\"inputData\": \"example input\", \"output\": \"expected output in JSON string format\"}' "
722
+ "It must be a dictionary or a list of dictionaries. Each dictionary must contain 'inputData' and 'output'."
723
+ )
724
+
725
+ if option_flag.name == "agent_data_llm_max_tokens":
726
+ agent_data_llm_max_tokens = option_arg
727
+ if option_flag.name == "agent_data_llm_timeout":
728
+ agent_data_llm_timeout = option_arg
729
+ if option_flag.name == "agent_data_llm_temperature":
730
+ agent_data_llm_temperature = option_arg
731
+ if option_flag.name == "agent_data_llm_top_k":
732
+ agent_data_llm_top_k = option_arg
733
+ if option_flag.name == "agent_data_llm_top_p":
734
+ agent_data_llm_top_k = option_arg
735
+ if option_flag.name == "agent_data_strategy_name":
736
+ agent_data_strategy_name = option_arg
737
+ if option_flag.name == "agent_data_model_name":
738
+ agent_data_model_name = option_arg
739
+ if option_flag.name == "agent_data_resource_pools":
740
+ try:
741
+ pools_json = json.loads(option_arg)
742
+ if not isinstance(pools_json, list):
743
+ raise ValueError
744
+ agent_data_resource_pools = pools_json
745
+ except Exception as e:
746
+ raise WrongArgumentError(
747
+ "Resource pools must be in JSON format: '[{\"name\": \"pool_name\", \"tools\": [{\"name\": \"tool_name\", \"revision\": int}], \"agents\": [{\"name\": \"agent_name\", \"revision\": int}]}]' "
748
+ "It must be a list of dictionaries. Each dictionary must contain 'name' and optional 'tools' and 'agents' lists."
749
+ )
750
+ if option_flag.name == "automatic_publish":
751
+ automatic_publish = get_boolean_value(option_arg)
752
+ if option_flag.name == "upsert":
753
+ upsert = get_boolean_value(option_arg)
754
+
755
+ if not (name and access_scope and public_name):
756
+ raise MissingRequirementException("Cannot update assistant without specifying name, access scope and public name")
757
+
758
+ prompt_inputs = get_agent_data_prompt_inputs(agent_data_prompt_inputs)
759
+ prompt_outputs = get_agent_data_prompt_outputs(agent_data_prompt_outputs)
760
+ prompt_examples = get_agent_data_prompt_examples(agent_data_prompt_examples)
761
+
762
+ agent_data_prompt = {
763
+ "instructions": agent_data_prompt_instructions,
764
+ "inputs": prompt_inputs,
765
+ "outputs": prompt_outputs,
766
+ "examples": prompt_examples
767
+ }
768
+ agent_data_llm_config = {
769
+ "maxTokens": agent_data_llm_max_tokens,
770
+ "timeout": agent_data_llm_timeout,
771
+ "sampling": {
772
+ "temperature": agent_data_llm_temperature,
773
+ "topK": agent_data_llm_top_k,
774
+ "topP": agent_data_llm_top_p,
775
+ }
776
+ }
777
+ agent_data_models = [
778
+ {"name": agent_data_model_name}
779
+ ]
780
+
781
+ client = AgentClient(project_id=project_id)
782
+ result = client.update_agent(
783
+ agent_id=agent_id,
784
+ name=name,
785
+ access_scope=access_scope,
786
+ public_name=public_name,
787
+ job_description=job_description,
788
+ avatar_image=avatar_image,
789
+ description=description,
790
+ agent_data_prompt=agent_data_prompt,
791
+ agent_data_llm_config=agent_data_llm_config,
792
+ agent_data_strategy_name=agent_data_strategy_name,
793
+ agent_data_models=agent_data_models,
794
+ agent_data_resource_pools=agent_data_resource_pools,
795
+ automatic_publish=automatic_publish,
796
+ upsert=upsert
797
+ )
798
+ Console.write_stdout(f"Updated agent detail: \n{result}")
799
+
800
+
801
+ update_agent_options = [
802
+ PROJECT_ID_OPTION,
803
+ Option(
804
+ "agent_id",
805
+ ["--agent-id", "--aid"],
806
+ "Unique identifier of the agent to update",
807
+ True
808
+ ),
809
+ Option(
810
+ "name",
811
+ ["--name", "-n"],
812
+ "Name of the agent, must be unique within the project and exclude ':' or '/'",
813
+ True
814
+ ),
815
+ Option(
816
+ "access_scope",
817
+ ["--access-scope", "--as"],
818
+ "Access scope of the agent, either 'public' or 'private' (defaults to 'private')",
819
+ True
820
+ ),
821
+ Option(
822
+ "public_name",
823
+ ["--public-name", "--pn"],
824
+ "Public name of the agent, required if access_scope is 'public', must be unique and follow a domain/library convention (e.g., 'com.example.my-agent') with only alphanumeric characters, periods, dashes, or underscores",
825
+ True
826
+ ),
827
+ Option(
828
+ "job_description",
829
+ ["--job-description", "--jd"],
830
+ "Description of the agent's role",
831
+ True
832
+ ),
833
+ Option(
834
+ "avatar_image",
835
+ ["--avatar-image", "--aimg"],
836
+ "URL for the agent's avatar image",
837
+ True
838
+ ),
839
+ Option(
840
+ "description",
841
+ ["--description", "-d"],
842
+ "Detailed description of the agent's purpose",
843
+ True
844
+ ),
845
+ Option(
846
+ "agent_data_prompt_instructions",
847
+ ["--agent-data-prompt-instructions", "--adp-inst"],
848
+ "Instructions defining what the agent does and how, required for publication if context is not provided",
849
+ True
850
+ ),
851
+ Option(
852
+ "agent_data_prompt_input",
853
+ ["--agent-data-prompt-input", "--adp-input"],
854
+ "Agent Data prompt input: "
855
+ "Prompt input as a list of strings (e.g., '[\"input1\", \"input2\"]') or multiple single strings via repeated flags, each representing an input name",
856
+ True
857
+ ),
858
+ Option(
859
+ "agent_data_prompt_output",
860
+ ["--agent-data-prompt-output", "--adp-out"],
861
+ "Prompt output in JSON format (e.g., '[{\"key\": \"output_key\", \"description\": \"output description\"}]'), as a dictionary or list of dictionaries with 'key' and 'description' fields",
862
+ True
863
+ ),
864
+ Option(
865
+ "agent_data_prompt_example",
866
+ ["--agent-data-prompt-example", "--adp-ex"],
867
+ "Prompt example in JSON format (e.g., '[{\"inputData\": \"example input\", \"output\": \"example output\"}]'), as a dictionary or list of dictionaries with 'inputData' and 'output' fields",
868
+ True
869
+ ),
870
+ Option(
871
+ "agent_data_llm_max_tokens",
872
+ ["--agent-data-llm-max-tokens", "--adl-max-tokens"],
873
+ "Maximum number of tokens the LLM can generate, used to control costs",
874
+ True
875
+ ),
876
+ Option(
877
+ "agent_data_llm_timeout",
878
+ ["--agent-data-llm-timeout", "--adl-timeout"],
879
+ "Timeout in seconds for LLM responses",
880
+ True
881
+ ),
882
+ Option(
883
+ "agent_data_llm_temperature",
884
+ ["--agent-data-llm-temperature", "--adl-temperature"],
885
+ "Sampling temperature for LLM (0.0 to 1.0), lower values for focused responses, higher for more random outputs",
886
+ True
887
+ ),
888
+ Option(
889
+ "agent_data_llm_top_k",
890
+ ["--agent-data-llm-top-k", "--adl-top-k"],
891
+ "TopK sampling parameter for LLM (currently unused)",
892
+ True
893
+ ),
894
+ Option(
895
+ "agent_data_llm_top_p",
896
+ ["--agent-data-llm-top-p", "--adl-top-p"],
897
+ "TopP sampling parameter for LLM (currently unused)",
898
+ True
899
+ ),
900
+ Option(
901
+ "agent_data_strategy_name",
902
+ ["--agent-data-strategy-name", "--strategy-name"],
903
+ "Name of the reasoning strategy to use",
904
+ True
905
+ ),
906
+ Option(
907
+ "agent_data_model_name",
908
+ ["--agent-data-model-name", "--adm-name"],
909
+ "Name of the LLM model (e.g., 'gpt-4o' or 'openai/gpt-4o'), at least one valid model required for publication",
910
+ True
911
+ ),
912
+ Option(
913
+ "agent_data_resource_pools",
914
+ ["--agent-data-resource-pools", "--adr-pools"],
915
+ "Resource pools in JSON format (e.g., '[{\"name\": \"pool_name\", \"tools\": [{\"name\": \"tool_name\", \"revision\": int}], \"agents\": [{\"name\": \"agent_name\", \"revision\": int}]}]'), "
916
+ "as a list of dictionaries with 'name' (required) and optional 'tools' and 'agents' lists",
917
+ False
918
+ ),
919
+ Option(
920
+ "automatic_publish",
921
+ ["--automatic-publish", "--ap"],
922
+ "Whether to publish the agent after creation (0: create as draft, 1: create and publish)",
923
+ True
924
+ ),
925
+ Option(
926
+ "upsert",
927
+ ["--upsert"],
928
+ "Define if agent must be created if it doesn't exist (0: Update only if it exists. 1: Insert if doesn't exists)",
929
+ True
930
+ ),
931
+
932
+ ]
933
+
934
+
935
+ def create_tool(option_list: list):
936
+ project_id = None
937
+ name = None
938
+ description = None
939
+ scope = None
940
+ access_scope = "private"
941
+ public_name = None
942
+ icon = None
943
+ open_api = None
944
+ open_api_json = None
945
+ report_events = "None"
946
+ parameters = list()
947
+ automatic_publish = False
948
+
949
+ for option_flag, option_arg in option_list:
950
+ if option_flag.name == "project_id":
951
+ project_id = option_arg
952
+ if option_flag.name == "name":
953
+ name = option_arg
954
+ if option_flag.name == "description":
955
+ description = option_arg
956
+ if option_flag.name == "scope":
957
+ scope = option_arg
958
+ if option_flag.name == "access_scope":
959
+ access_scope = option_arg
960
+ if option_flag.name == "public_name":
961
+ public_name = option_arg
962
+ if option_flag.name == "icon":
963
+ icon = option_arg
964
+ if option_flag.name == "open_api":
965
+ open_api = option_arg
966
+ if option_flag.name == "open_api_json":
967
+ try:
968
+ open_api_json = json.loads(option_arg)
969
+ if not isinstance(open_api_json, dict):
970
+ raise ValueError
971
+ except Exception as e:
972
+ raise WrongArgumentError(
973
+ "open_api_json must be a valid JSON object (e.g., '{\"openapi\": \"3.0.0\", \"info\": {\"title\": \"example\", \"version\": \"1.0.0\"}, ...}')"
974
+ )
975
+ if option_flag.name == "report_events":
976
+ report_events = option_arg
977
+ if option_flag.name == "parameter":
978
+ try:
979
+ param_json = json.loads(option_arg)
980
+ if not isinstance(param_json, dict):
981
+ raise ValueError
982
+ parameters.append(param_json)
983
+ except Exception as e:
984
+ raise WrongArgumentError(
985
+ "Each parameter must be in JSON format (e.g., "
986
+ "'{\"key\": \"param_name\", \"description\": \"param description\", \"isRequired\": true, \"type\": \"app\"}' "
987
+ "or for config parameters: "
988
+ "'{\"key\": \"config_name\", \"description\": \"config description\", \"isRequired\": true, \"type\": \"config\", \"value\": \"config_value\", \"fromSecret\": false}')"
989
+ )
990
+ if option_flag.name == "automatic_publish":
991
+ automatic_publish = get_boolean_value(option_arg)
992
+
993
+ if not name:
994
+ raise MissingRequirementException("Tool name must be specified.")
995
+ if access_scope == "public" and not public_name:
996
+ raise MissingRequirementException("Public name is required when access_scope is 'public'.")
997
+ if scope == "api" and not (open_api or open_api_json):
998
+ raise MissingRequirementException(
999
+ "For tools with scope 'api', either open_api or open_api_json must be provided."
1000
+ )
1001
+
1002
+ tool_parameters = get_tool_parameters(parameters)
1003
+
1004
+ client = ToolClient(project_id=project_id)
1005
+ result = client.create_tool(
1006
+ name=name,
1007
+ description=description,
1008
+ scope=scope,
1009
+ access_scope=access_scope,
1010
+ public_name=public_name,
1011
+ icon=icon,
1012
+ open_api=open_api,
1013
+ open_api_json=open_api_json,
1014
+ report_events=report_events,
1015
+ parameters=tool_parameters,
1016
+ automatic_publish=automatic_publish
1017
+ )
1018
+ Console.write_stdout(f"New tool detail: \n{result}")
1019
+
1020
+
1021
+ create_tool_options = [
1022
+ PROJECT_ID_OPTION,
1023
+ Option(
1024
+ "name",
1025
+ ["--name", "-n"],
1026
+ "Name of the tool, must be unique within the project and exclude ':' or '/'",
1027
+ True
1028
+ ),
1029
+ Option(
1030
+ "description",
1031
+ ["--description", "-d"],
1032
+ "Description of the tool’s purpose, helps agents decide when to use it",
1033
+ True
1034
+ ),
1035
+ Option(
1036
+ "scope",
1037
+ ["--scope", "-s"],
1038
+ "Scope of the tool, one of 'builtin', 'external', or 'api'",
1039
+ True
1040
+ ),
1041
+ Option(
1042
+ "access_scope",
1043
+ ["--access-scope", "--as"],
1044
+ "Access scope of the tool, either 'public' or 'private' (defaults to 'private')",
1045
+ True
1046
+ ),
1047
+ Option(
1048
+ "public_name",
1049
+ ["--public-name", "--pn"],
1050
+ "Public name of the tool, required if access_scope is 'public', must be unique and follow a domain/library convention (e.g., 'com.globant.geai.web-search') with only alphanumeric characters, periods, dashes, or underscores",
1051
+ True
1052
+ ),
1053
+ Option(
1054
+ "icon",
1055
+ ["--icon", "-i"],
1056
+ "URL for the tool’s icon or avatar image",
1057
+ True
1058
+ ),
1059
+ Option(
1060
+ "open_api",
1061
+ ["--open-api", "--oa"],
1062
+ "URL where the OpenAPI specification can be loaded, required for 'api' scope if open_api_json is not provided",
1063
+ True
1064
+ ),
1065
+ Option(
1066
+ "open_api_json",
1067
+ ["--open-api-json", "--oaj"],
1068
+ "OpenAPI specification in JSON format (e.g., '{\"openapi\": \"3.0.0\", \"info\": {\"title\": \"example\", \"version\": \"1.0.0\"}, ...}'), required for 'api' scope if open_api is not provided",
1069
+ True
1070
+ ),
1071
+ Option(
1072
+ "report_events",
1073
+ ["--report-events", "--re"],
1074
+ "Event reporting mode for tool progress, one of 'None', 'All', 'Start', 'Finish', 'Progress' (defaults to 'None')",
1075
+ True
1076
+ ),
1077
+ Option(
1078
+ "parameter",
1079
+ ["--parameter", "-p"],
1080
+ "Tool parameter in JSON format (e.g., '{\"key\": \"param_name\", \"description\": \"param description\", \"isRequired\": true, \"type\": \"app\"}' or for config parameters: '{\"key\": \"config_name\", \"description\": \"config description\", \"isRequired\": true, \"type\": \"config\", \"value\": \"config_value\", \"fromSecret\": false}'). Multiple parameters can be specified by using this option multiple times",
1081
+ True
1082
+ ),
1083
+ Option(
1084
+ "automatic_publish",
1085
+ ["--automatic-publish", "--ap"],
1086
+ "Whether to publish the tool after creation (0: create as draft, 1: create and publish)",
1087
+ True
1088
+ ),
1089
+ ]
1090
+
1091
+
1092
+ def list_tools(option_list: list):
1093
+ project_id = None
1094
+ id = ""
1095
+ count = "100"
1096
+ access_scope = "public"
1097
+ allow_drafts = True
1098
+ scope = "api"
1099
+ allow_external = True
1100
+
1101
+ for option_flag, option_arg in option_list:
1102
+ if option_flag.name == "project_id":
1103
+ project_id = option_arg
1104
+ if option_flag.name == "id":
1105
+ id = option_arg
1106
+ if option_flag.name == "count":
1107
+ count = option_arg
1108
+ if option_flag.name == "access_scope":
1109
+ access_scope = option_arg
1110
+ if option_flag.name == "allow_drafts":
1111
+ allow_drafts = get_boolean_value(option_arg)
1112
+ if option_flag.name == "scope":
1113
+ scope = option_arg
1114
+ if option_flag.name == "allow_external":
1115
+ allow_external = get_boolean_value(option_arg)
1116
+
1117
+ if scope and scope not in VALID_SCOPES:
1118
+ raise ValueError(f"Scope must be one of {', '.join(VALID_SCOPES)}.")
1119
+
1120
+ client = ToolClient(project_id=project_id)
1121
+ result = client.list_tools(
1122
+ id=id,
1123
+ count=count,
1124
+ access_scope=access_scope,
1125
+ allow_drafts=allow_drafts,
1126
+ scope=scope,
1127
+ allow_external=allow_external,
1128
+ )
1129
+ Console.write_stdout(f"Tool list: \n{result}")
1130
+
1131
+
1132
+ list_tools_options = [
1133
+ PROJECT_ID_OPTION,
1134
+ Option(
1135
+ "id",
1136
+ ["--id"],
1137
+ "ID of the tool to filter by. Defaults to an empty string (no filtering).",
1138
+ True
1139
+ ),
1140
+ Option(
1141
+ "count",
1142
+ ["--count"],
1143
+ "Number of tools to retrieve. Defaults to '100'.",
1144
+ True
1145
+ ),
1146
+ Option(
1147
+ "access_scope",
1148
+ ["--access-scope"],
1149
+ 'Access scope of the tools, either "public" or "private". Defaults to "public".',
1150
+ True
1151
+ ),
1152
+ Option(
1153
+ "allow_drafts",
1154
+ ["--allow-drafts"],
1155
+ "Whether to include draft tools. Defaults to 1 (True).",
1156
+ True
1157
+ ),
1158
+ Option(
1159
+ "scope",
1160
+ ["--scope"],
1161
+ "Scope of the tools, must be 'builtin', 'external', or 'api'. Defaults to 'api'.",
1162
+ True
1163
+ ),
1164
+ Option(
1165
+ "allow_external",
1166
+ ["--allow-external"],
1167
+ "Whether to include external tools. Defaults to 1 (True).",
1168
+ True
1169
+ )
1170
+ ]
1171
+
1172
+
1173
+ def get_tool(option_list: list):
1174
+ project_id = None
1175
+ tool_id = None
1176
+ revision = 0
1177
+ version = 0
1178
+ allow_drafts = True
1179
+
1180
+ for option_flag, option_arg in option_list:
1181
+ if option_flag.name == "project_id":
1182
+ project_id = option_arg
1183
+ if option_flag.name == "tool_id":
1184
+ tool_id = option_arg
1185
+ if option_flag.name == "revision":
1186
+ revision = option_arg
1187
+ if option_flag.name == "version":
1188
+ version = option_arg
1189
+ if option_flag.name == "allow_drafts":
1190
+ allow_drafts = get_boolean_value(option_arg)
1191
+
1192
+ if not tool_id:
1193
+ raise MissingRequirementException("Tool ID must be specified.")
1194
+
1195
+ client = ToolClient(project_id=project_id)
1196
+ result = client.get_tool(
1197
+ tool_id=tool_id,
1198
+ revision=revision,
1199
+ version=version,
1200
+ allow_drafts=allow_drafts,
1201
+ )
1202
+ Console.write_stdout(f"Tool detail: \n{result}")
1203
+
1204
+
1205
+ get_tool_options = [
1206
+ PROJECT_ID_OPTION,
1207
+ Option(
1208
+ "tool_id",
1209
+ ["--tool-id", "--tid"],
1210
+ "ID of the tool to retrieve",
1211
+ True
1212
+ ),
1213
+ Option(
1214
+ "revision",
1215
+ ["--revision", "-r"],
1216
+ "Revision of agent.",
1217
+ True
1218
+ ),
1219
+ Option(
1220
+ "version",
1221
+ ["--version", "-v"],
1222
+ 'Version of agent.',
1223
+ True
1224
+ ),
1225
+ Option(
1226
+ "allow_drafts",
1227
+ ["--allow-drafts"],
1228
+ "Whether to include draft agents. Defaults to 1 (True).",
1229
+ True
1230
+ ),
1231
+ ]
1232
+
1233
+
1234
+ def export_tool(option_list: list):
1235
+ project_id = None
1236
+ tool_id = None
1237
+ file = None
1238
+
1239
+ for option_flag, option_arg in option_list:
1240
+ if option_flag.name == "project_id":
1241
+ project_id = option_arg
1242
+ if option_flag.name == "tool_id":
1243
+ tool_id = option_arg
1244
+ if option_flag.name == "file":
1245
+ file = option_arg
1246
+
1247
+ if not tool_id:
1248
+ raise MissingRequirementException("Tool ID must be specified.")
1249
+
1250
+ client = ToolClient(project_id=project_id)
1251
+ result = client.export_tool(
1252
+ tool_id=tool_id,
1253
+ )
1254
+ Console.write_stdout(f"Tool spec: \n{result}")
1255
+ if file:
1256
+ try:
1257
+ data = json.loads(result) if isinstance(result, str) else result
1258
+ with open(file, "w") as f:
1259
+ json.dump(data, f, indent=4)
1260
+ Console.write_stdout(f"Result from API saved to {file}.")
1261
+ except json.JSONDecodeError as e:
1262
+ logger.error(f"Result from API endpoint is not in JSON format: {e}")
1263
+ Console.write_stderr(f"Result from API endpoint is not in JSON format.")
1264
+
1265
+
1266
+
1267
+ export_tool_options = [
1268
+ PROJECT_ID_OPTION,
1269
+ Option(
1270
+ "tool_id",
1271
+ ["--tool-id", "--tid"],
1272
+ "ID of the tool to retrieve",
1273
+ True
1274
+ ),
1275
+ Option(
1276
+ "file",
1277
+ ["--file", "-f"],
1278
+ "File path to save export specification for tool",
1279
+ True
1280
+ ),
1281
+ ]
1282
+
1283
+
1284
+
1285
+ def delete_tool(option_list: list):
1286
+ project_id = None
1287
+ tool_id = None
1288
+ tool_name = None
1289
+
1290
+ for option_flag, option_arg in option_list:
1291
+ if option_flag.name == "project_id":
1292
+ project_id = option_arg
1293
+ if option_flag.name == "tool_id":
1294
+ tool_id = option_arg
1295
+ elif option_flag.name == "tool_name":
1296
+ tool_name = option_arg
1297
+
1298
+ if not (tool_id or tool_name):
1299
+ raise MissingRequirementException("Either Tool ID or Tool Name must be specified.")
1300
+
1301
+ client = ToolClient(project_id=project_id)
1302
+ result = client.delete_tool(
1303
+ tool_id=tool_id,
1304
+ tool_name=tool_name
1305
+ )
1306
+ Console.write_stdout(f"Deleted tool detail: \n{result}")
1307
+
1308
+
1309
+ delete_tool_options = [
1310
+ PROJECT_ID_OPTION,
1311
+ Option(
1312
+ "tool_id",
1313
+ ["--tool-id", "--tid"],
1314
+ "ID of the tool to delete",
1315
+ True
1316
+ ),
1317
+ Option(
1318
+ "tool_name",
1319
+ ["--tool-name", "--tname"],
1320
+ "Name of the tool to delete",
1321
+ True
1322
+ ),
1323
+ ]
1324
+
1325
+
1326
+ def update_tool(option_list: list):
1327
+ project_id = None
1328
+ tool_id = None
1329
+ name = None
1330
+ description = None
1331
+ scope = None
1332
+ access_scope = None
1333
+ public_name = None
1334
+ icon = None
1335
+ open_api = None
1336
+ open_api_json = None
1337
+ report_events = "None"
1338
+ parameters = list()
1339
+ automatic_publish = False
1340
+ upsert = False
1341
+
1342
+ for option_flag, option_arg in option_list:
1343
+ if option_flag.name == "project_id":
1344
+ project_id = option_arg
1345
+ if option_flag.name == "tool_id":
1346
+ tool_id = option_arg
1347
+ if option_flag.name == "name":
1348
+ name = option_arg
1349
+ if option_flag.name == "description":
1350
+ description = option_arg
1351
+ if option_flag.name == "scope":
1352
+ scope = option_arg
1353
+ if option_flag.name == "access_scope":
1354
+ access_scope = option_arg
1355
+ if option_flag.name == "public_name":
1356
+ public_name = option_arg
1357
+ if option_flag.name == "icon":
1358
+ icon = option_arg
1359
+ if option_flag.name == "open_api":
1360
+ open_api = option_arg
1361
+ if option_flag.name == "open_api_json":
1362
+ try:
1363
+ open_api_json = json.loads(option_arg)
1364
+ if not isinstance(open_api_json, dict):
1365
+ raise ValueError
1366
+ except Exception as e:
1367
+ raise WrongArgumentError(
1368
+ "open_api_json must be a valid JSON object (e.g., '{\"openapi\": \"3.0.0\", \"info\": {\"title\": \"example\", \"version\": \"1.0.0\"}, ...}')"
1369
+ )
1370
+ if option_flag.name == "report_events":
1371
+ report_events = option_arg
1372
+ if option_flag.name == "parameter":
1373
+ try:
1374
+ param_json = json.loads(option_arg)
1375
+ if not isinstance(param_json, dict):
1376
+ raise ValueError
1377
+ parameters.append(param_json)
1378
+ except Exception as e:
1379
+ raise WrongArgumentError(
1380
+ "Each parameter must be in JSON format (e.g., "
1381
+ "'{\"key\": \"param_name\", \"description\": \"param description\", \"isRequired\": true, \"type\": \"app\"}' "
1382
+ "or for config parameters: "
1383
+ "'{\"key\": \"config_name\", \"description\": \"config description\", \"isRequired\": true, \"type\": \"config\", \"value\": \"config_value\", \"fromSecret\": false}')"
1384
+ )
1385
+ if option_flag.name == "automatic_publish":
1386
+ automatic_publish = get_boolean_value(option_arg)
1387
+ if option_flag.name == "upsert":
1388
+ upsert = get_boolean_value(option_arg)
1389
+
1390
+ if not tool_id:
1391
+ raise MissingRequirementException("Tool ID must be specified.")
1392
+ if access_scope == "public" and not public_name:
1393
+ raise MissingRequirementException("Public name is required when access_scope is 'public'.")
1394
+ if upsert and scope == "api" and not (open_api or open_api_json):
1395
+ raise MissingRequirementException(
1396
+ "For tools with scope 'api' in upsert mode, either open_api or open_api_json must be provided."
1397
+ )
1398
+
1399
+ tool_parameters = get_tool_parameters(parameters)
1400
+
1401
+ client = ToolClient(project_id=project_id)
1402
+ result = client.update_tool(
1403
+ tool_id=tool_id,
1404
+ name=name,
1405
+ description=description,
1406
+ scope=scope,
1407
+ access_scope=access_scope,
1408
+ public_name=public_name,
1409
+ icon=icon,
1410
+ open_api=open_api,
1411
+ open_api_json=open_api_json,
1412
+ report_events=report_events,
1413
+ parameters=tool_parameters,
1414
+ automatic_publish=automatic_publish,
1415
+ upsert=upsert
1416
+ )
1417
+ Console.write_stdout(f"Updated tool detail: \n{result}")
1418
+
1419
+
1420
+ update_tool_options = [
1421
+ PROJECT_ID_OPTION,
1422
+ Option(
1423
+ "tool_id",
1424
+ ["--tool-id", "--tid"],
1425
+ "Unique identifier of the tool to update",
1426
+ True
1427
+ ),
1428
+ Option(
1429
+ "name",
1430
+ ["--name", "-n"],
1431
+ "Updated name of the tool, must be unique within the project and exclude ':' or '/' if provided",
1432
+ True
1433
+ ),
1434
+ Option(
1435
+ "description",
1436
+ ["--description", "-d"],
1437
+ "Updated description of the tool’s purpose, helps agents decide when to use it",
1438
+ True
1439
+ ),
1440
+ Option(
1441
+ "scope",
1442
+ ["--scope", "-s"],
1443
+ "Updated scope of the tool, one of 'builtin', 'external', or 'api'",
1444
+ True
1445
+ ),
1446
+ Option(
1447
+ "access_scope",
1448
+ ["--access-scope", "--as"],
1449
+ "Updated access scope of the tool, either 'public' or 'private'",
1450
+ True
1451
+ ),
1452
+ Option(
1453
+ "public_name",
1454
+ ["--public-name", "--pn"],
1455
+ "Updated public name of the tool, required if access_scope is 'public', must be unique and follow a domain/library convention (e.g., 'com.globant.geai.web-search') with only alphanumeric characters, periods, dashes, or underscores",
1456
+ True
1457
+ ),
1458
+ Option(
1459
+ "icon",
1460
+ ["--icon", "-i"],
1461
+ "Updated URL for the tool’s icon or avatar image",
1462
+ True
1463
+ ),
1464
+ Option(
1465
+ "open_api",
1466
+ ["--open-api", "--oa"],
1467
+ "Updated URL where the OpenAPI specification can be loaded, required for 'api' scope in upsert mode if open_api_json is not provided",
1468
+ True
1469
+ ),
1470
+ Option(
1471
+ "open_api_json",
1472
+ ["--open-api-json", "--oaj"],
1473
+ "Updated OpenAPI specification in JSON format (e.g., '{\"openapi\": \"3.0.0\", \"info\": {\"title\": \"example\", \"version\": \"1.0.0\"}, ...}'), required for 'api' scope in upsert mode if open_api is not provided",
1474
+ True
1475
+ ),
1476
+ Option(
1477
+ "report_events",
1478
+ ["--report-events", "--re"],
1479
+ "Updated event reporting mode for tool progress, one of 'None', 'All', 'Start', 'Finish', 'Progress'",
1480
+ True
1481
+ ),
1482
+ Option(
1483
+ "parameter",
1484
+ ["--parameter", "-p"],
1485
+ "Updated tool parameter in JSON format (e.g., '{\"key\": \"param_name\", \"description\": \"param description\", \"isRequired\": true, \"type\": \"app\"}' or for config parameters: '{\"key\": \"config_name\", \"description\": \"config description\", \"isRequired\": true, \"type\": \"config\", \"value\": \"config_value\", \"fromSecret\": false}'). Multiple parameters can be specified by using this option multiple times",
1486
+ True
1487
+ ),
1488
+ Option(
1489
+ "automatic_publish",
1490
+ ["--automatic-publish", "--ap"],
1491
+ "Whether to publish the tool after updating (0: update as draft, 1: update and publish)",
1492
+ True
1493
+ ),
1494
+ Option(
1495
+ "upsert",
1496
+ ["--upsert"],
1497
+ "Whether to create the tool if it doesn’t exist (0: update only if exists, 1: insert if doesn’t exist)",
1498
+ True
1499
+ ),
1500
+ ]
1501
+
1502
+
1503
+ def publish_tool_revision(option_list: list):
1504
+ project_id = None
1505
+ tool_id = None
1506
+ revision = None
1507
+
1508
+ for option_flag, option_arg in option_list:
1509
+ if option_flag.name == "project_id":
1510
+ project_id = option_arg
1511
+ if option_flag.name == "tool_id":
1512
+ tool_id = option_arg
1513
+ if option_flag.name == "revision":
1514
+ revision = option_arg
1515
+
1516
+ if not (tool_id and revision):
1517
+ raise MissingRequirementException("Tool ID and revision must be specified.")
1518
+
1519
+ client = ToolClient(project_id=project_id)
1520
+ result = client.publish_tool_revision(
1521
+ tool_id=tool_id,
1522
+ revision=revision
1523
+ )
1524
+ Console.write_stdout(f"Published revision detail: \n{result}")
1525
+
1526
+
1527
+ publish_tool_revision_options = [
1528
+ PROJECT_ID_OPTION,
1529
+ Option(
1530
+ "tool_id",
1531
+ ["--tool-id", "--tid"],
1532
+ "ID of the tool to retrieve",
1533
+ True
1534
+ ),
1535
+ Option(
1536
+ "revision",
1537
+ ["--revision", "-r"],
1538
+ "Revision of tool. Use 0 to retrieve the latest revision.",
1539
+ True
1540
+ ),
1541
+ ]
1542
+
1543
+
1544
+ def get_parameter(option_list: list):
1545
+ project_id = None
1546
+ tool_id = None
1547
+ tool_public_name = None
1548
+ allow_drafts = True
1549
+ revision = 0
1550
+ version = 0
1551
+
1552
+ for option_flag, option_arg in option_list:
1553
+ if option_flag.name == "project_id":
1554
+ project_id = option_arg
1555
+ if option_flag.name == "tool_id":
1556
+ tool_id = option_arg
1557
+ if option_flag.name == "tool_public_name":
1558
+ tool_public_name = option_arg
1559
+ if option_flag.name == "allow_drafts":
1560
+ allow_drafts = get_boolean_value(option_arg)
1561
+ if option_flag.name == "revision":
1562
+ revision = option_arg
1563
+ if option_flag.name == "version":
1564
+ version = option_arg
1565
+
1566
+ if not (tool_public_name or tool_id):
1567
+ raise MissingRequirementException("Tool public name or ID must be specified.")
1568
+
1569
+ client = ToolClient(project_id=project_id)
1570
+ result = client.get_parameter(
1571
+ tool_id=tool_id,
1572
+ tool_public_name=tool_public_name,
1573
+ revision=revision,
1574
+ version=version,
1575
+ allow_drafts=allow_drafts,
1576
+ )
1577
+ Console.write_stdout(f"Parameter detail: \n{result}")
1578
+
1579
+
1580
+ get_parameter_options = [
1581
+ PROJECT_ID_OPTION,
1582
+ Option(
1583
+ "tool_id",
1584
+ ["--tool-id", "--tid"],
1585
+ "ID of the tool to set parameters for",
1586
+ True
1587
+ ),
1588
+ Option(
1589
+ "tool_public_name",
1590
+ ["--tool-public-name", "--tpn"],
1591
+ "Public name of the tool",
1592
+ True
1593
+ ),
1594
+ Option(
1595
+ "revision",
1596
+ ["--revision", "-r"],
1597
+ "Revision of the parameter. Use 0 to retrieve the latest revision.",
1598
+ True
1599
+ ),
1600
+ Option(
1601
+ "version",
1602
+ ["--version", "-v"],
1603
+ "Version of the parameter. Use 0 to retrieve the latest version.",
1604
+ True
1605
+ ),
1606
+ Option(
1607
+ "allow_drafts",
1608
+ ["--allow-drafts"],
1609
+ "Whether to include draft parameters. Defaults to 1 (True).",
1610
+ True
1611
+ ),
1612
+ ]
1613
+
1614
+
1615
+ def set_parameter(option_list: list):
1616
+ project_id = None
1617
+ tool_public_name = None
1618
+ tool_id = None
1619
+ parameters = list()
1620
+
1621
+ for option_flag, option_arg in option_list:
1622
+ if option_flag.name == "project_id":
1623
+ project_id = option_arg
1624
+ if option_flag.name == "tool_id":
1625
+ tool_id = option_arg
1626
+ if option_flag.name == "tool_public_name":
1627
+ tool_public_name = option_arg
1628
+ if option_flag.name == "parameter":
1629
+ try:
1630
+ param_json = json.loads(option_arg)
1631
+ if not isinstance(param_json, dict):
1632
+ raise ValueError
1633
+ parameters.append(param_json)
1634
+ except Exception as e:
1635
+ raise WrongArgumentError(
1636
+ "Each parameter must be in JSON format: "
1637
+ "'{\"key\": \"param_name\", \"dataType\": \"String\", \"description\": \"param description\", \"isRequired\": true}' "
1638
+ "or for config parameters: "
1639
+ "'{\"key\": \"config_name\", \"dataType\": \"String\", \"description\": \"config description\", "
1640
+ "\"isRequired\": true, \"type\": \"config\", \"fromSecret\": false, \"value\": \"config_value\"}'"
1641
+ )
1642
+
1643
+ if not (tool_public_name or tool_id):
1644
+ raise MissingRequirementException("Tool public name or ID must be specified.")
1645
+ if not parameters:
1646
+ raise MissingRequirementException("At least one parameter must be specified.")
1647
+
1648
+ tool_parameters = get_tool_parameters(parameters)
1649
+
1650
+ client = ToolClient(project_id=project_id)
1651
+ result = client.set_parameter(
1652
+ tool_id=tool_id,
1653
+ tool_public_name=tool_public_name,
1654
+ parameters=tool_parameters
1655
+ )
1656
+ Console.write_stdout(f"Set parameter detail: \n{result}")
1657
+
1658
+
1659
+ set_parameter_options = [
1660
+ PROJECT_ID_OPTION,
1661
+ Option(
1662
+ "tool_id",
1663
+ ["--tool-id", "--tid"],
1664
+ "ID of the tool to set parameters for",
1665
+ True
1666
+ ),
1667
+ Option(
1668
+ "tool_public_name",
1669
+ ["--tool-public-name", "--tpn"],
1670
+ "Public name of the tool",
1671
+ True
1672
+ ),
1673
+ Option(
1674
+ "parameter",
1675
+ ["--parameter", "-p"],
1676
+ "Tool parameter in JSON format. "
1677
+ "For regular parameters: '{\"key\": \"param_name\", \"dataType\": \"String\", \"description\": \"param description\", \"isRequired\": true}' "
1678
+ "For config parameters: '{\"key\": \"config_name\", \"dataType\": \"String\", \"description\": \"config description\", "
1679
+ "\"isRequired\": true, \"type\": \"config\", \"fromSecret\": false, \"value\": \"config_value\"}' "
1680
+ "Multiple parameters can be specified by using this option multiple times.",
1681
+ True
1682
+ ),
1683
+ ]
1684
+
1685
+ # REASONING STRATEGIES
1686
+
1687
+
1688
+ def list_reasoning_strategies(option_list: list):
1689
+ name = ""
1690
+ start = "0"
1691
+ count = "100"
1692
+ allow_external = True
1693
+ access_scope = "public"
1694
+
1695
+ for option_flag, option_arg in option_list:
1696
+ if option_flag.name == "name":
1697
+ name = option_arg
1698
+ if option_flag.name == "start":
1699
+ start = option_arg
1700
+ if option_flag.name == "count":
1701
+ count = option_arg
1702
+ if option_flag.name == "allow_external":
1703
+ allow_external = get_boolean_value(option_arg)
1704
+ if option_flag.name == "access_scope":
1705
+ access_scope = option_arg
1706
+
1707
+ valid_access_scopes = ["public", "private"]
1708
+ if access_scope not in valid_access_scopes:
1709
+ raise WrongArgumentError(
1710
+ "Access scope must be either 'public' or 'private'."
1711
+ )
1712
+
1713
+ client = ReasoningStrategyClient()
1714
+ result = client.list_reasoning_strategies(
1715
+ name=name,
1716
+ start=start,
1717
+ count=count,
1718
+ allow_external=allow_external,
1719
+ access_scope=access_scope,
1720
+ )
1721
+ Console.write_stdout(f"Reasoning strategies list: \n{result}")
1722
+
1723
+
1724
+ list_reasoning_strategies_options = [
1725
+ Option(
1726
+ "name",
1727
+ ["--name", "-n"],
1728
+ "Name of the reasoning strategy to filter by. Defaults to an empty string (no filtering).",
1729
+ True
1730
+ ),
1731
+ Option(
1732
+ "start",
1733
+ ["--start"],
1734
+ "Starting index for pagination. Defaults to '0'.",
1735
+ True
1736
+ ),
1737
+ Option(
1738
+ "count",
1739
+ ["--count"],
1740
+ "Number of reasoning strategies to retrieve. Defaults to '100'.",
1741
+ True
1742
+ ),
1743
+ Option(
1744
+ "allow_external",
1745
+ ["--allow-external"],
1746
+ "Whether to include external reasoning strategies. Defaults to 1 (True).",
1747
+ True
1748
+ ),
1749
+ Option(
1750
+ "access_scope",
1751
+ ["--access-scope"],
1752
+ "Access scope of the reasoning strategies, either 'public' or 'private'. Defaults to 'public'.",
1753
+ True
1754
+ ),
1755
+ ]
1756
+
1757
+
1758
+ def create_reasoning_strategy(option_list: list):
1759
+ name = None
1760
+ system_prompt = None
1761
+ access_scope = "public"
1762
+ strategy_type = "addendum"
1763
+ localized_descriptions = list()
1764
+ automatic_publish = False
1765
+
1766
+ for option_flag, option_arg in option_list:
1767
+ if option_flag.name == "name":
1768
+ name = option_arg
1769
+ if option_flag.name == "system_prompt":
1770
+ system_prompt = option_arg
1771
+ if option_flag.name == "access_scope":
1772
+ access_scope = option_arg
1773
+ if option_flag.name == "type":
1774
+ strategy_type = option_arg
1775
+ if option_flag.name == "localized_description":
1776
+ try:
1777
+ desc_json = json.loads(option_arg)
1778
+ if not isinstance(desc_json, dict) or "language" not in desc_json or "description" not in desc_json:
1779
+ raise ValueError
1780
+ localized_descriptions.append(desc_json)
1781
+ except Exception as e:
1782
+ raise WrongArgumentError(
1783
+ "Each localized description must be in JSON format: "
1784
+ "'{\"language\": \"english\", \"description\": \"description text\"}'"
1785
+ )
1786
+ if option_flag.name == "automatic_publish":
1787
+ automatic_publish = get_boolean_value(option_arg)
1788
+
1789
+ if not name:
1790
+ raise MissingRequirementException("Name must be specified.")
1791
+ if not system_prompt:
1792
+ raise MissingRequirementException("System prompt must be specified.")
1793
+
1794
+ valid_access_scopes = ["public", "private"]
1795
+ if access_scope not in valid_access_scopes:
1796
+ raise WrongArgumentError(
1797
+ "Access scope must be either 'public' or 'private'."
1798
+ )
1799
+
1800
+ valid_types = ["addendum"]
1801
+ if strategy_type not in valid_types:
1802
+ raise WrongArgumentError(
1803
+ "Type must be 'addendum'."
1804
+ )
1805
+
1806
+ client = ReasoningStrategyClient()
1807
+ result = client.create_reasoning_strategy(
1808
+ name=name,
1809
+ system_prompt=system_prompt,
1810
+ access_scope=access_scope,
1811
+ strategy_type=strategy_type,
1812
+ localized_descriptions=localized_descriptions,
1813
+ automatic_publish=automatic_publish
1814
+ )
1815
+ Console.write_stdout(f"Created reasoning strategy detail: \n{result}")
1816
+
1817
+
1818
+ create_reasoning_strategy_options = [
1819
+ Option(
1820
+ "name",
1821
+ ["--name", "-n"],
1822
+ "Name of the reasoning strategy",
1823
+ True
1824
+ ),
1825
+ Option(
1826
+ "system_prompt",
1827
+ ["--system-prompt", "--sp"],
1828
+ "System prompt for the reasoning strategy",
1829
+ True
1830
+ ),
1831
+ Option(
1832
+ "access_scope",
1833
+ ["--access-scope", "--as"],
1834
+ "Access scope of the reasoning strategy, either 'public' or 'private'. Defaults to 'public'.",
1835
+ True
1836
+ ),
1837
+ Option(
1838
+ "type",
1839
+ ["--type", "-t"],
1840
+ "Type of the reasoning strategy, e.g., 'addendum'. Defaults to 'addendum'.",
1841
+ True
1842
+ ),
1843
+ Option(
1844
+ "localized_description",
1845
+ ["--localized-description", "--ld"],
1846
+ "Localized description in JSON format: "
1847
+ "'{\"language\": \"english\", \"description\": \"description text\"}'. "
1848
+ "Multiple descriptions can be specified by using this option multiple times.",
1849
+ True
1850
+ ),
1851
+ Option(
1852
+ "automatic_publish",
1853
+ ["--automatic-publish", "--ap"],
1854
+ "Define if reasoning strategy must be published besides being created. 0: Create as draft. 1: Create and publish.",
1855
+ True
1856
+ ),
1857
+ ]
1858
+
1859
+
1860
+ def update_reasoning_strategy(option_list: list):
1861
+ reasoning_strategy_id = None
1862
+ name = None
1863
+ system_prompt = None
1864
+ access_scope = None
1865
+ strategy_type = None
1866
+ localized_descriptions = list()
1867
+ automatic_publish = False
1868
+ upsert = False
1869
+
1870
+ for option_flag, option_arg in option_list:
1871
+ if option_flag.name == "reasoning_strategy_id":
1872
+ reasoning_strategy_id = option_arg
1873
+ if option_flag.name == "name":
1874
+ name = option_arg
1875
+ if option_flag.name == "system_prompt":
1876
+ system_prompt = option_arg
1877
+ if option_flag.name == "access_scope":
1878
+ access_scope = option_arg
1879
+ if option_flag.name == "type":
1880
+ strategy_type = option_arg
1881
+ if option_flag.name == "localized_description":
1882
+ try:
1883
+ desc_json = json.loads(option_arg)
1884
+ if not isinstance(desc_json, dict) or "language" not in desc_json or "description" not in desc_json:
1885
+ raise ValueError
1886
+ localized_descriptions.append(desc_json)
1887
+ except Exception as e:
1888
+ raise WrongArgumentError(
1889
+ "Each localized description must be in JSON format: "
1890
+ "'{\"language\": \"english\", \"description\": \"description text\"}'"
1891
+ )
1892
+ if option_flag.name == "automatic_publish":
1893
+ automatic_publish = get_boolean_value(option_arg)
1894
+ if option_flag.name == "upsert":
1895
+ # upsert = get_boolean_value(option_arg)
1896
+ Console.write_stdout("Upsert is not yet supported for reasoning strategies. Coming soon.")
1897
+
1898
+ if not reasoning_strategy_id:
1899
+ raise MissingRequirementException("Reasoning strategy ID must be specified.")
1900
+
1901
+ if access_scope is not None:
1902
+ valid_access_scopes = ["public", "private"]
1903
+ if access_scope not in valid_access_scopes:
1904
+ raise WrongArgumentError(
1905
+ "Access scope must be either 'public' or 'private'."
1906
+ )
1907
+
1908
+ if strategy_type is not None:
1909
+ valid_types = ["addendum"]
1910
+ if strategy_type not in valid_types:
1911
+ raise WrongArgumentError(
1912
+ "Type must be 'addendum'."
1913
+ )
1914
+
1915
+ client = ReasoningStrategyClient()
1916
+ result = client.update_reasoning_strategy(
1917
+ reasoning_strategy_id=reasoning_strategy_id,
1918
+ name=name,
1919
+ system_prompt=system_prompt,
1920
+ access_scope=access_scope,
1921
+ strategy_type=strategy_type,
1922
+ localized_descriptions=localized_descriptions if localized_descriptions else None,
1923
+ automatic_publish=automatic_publish,
1924
+ upsert=upsert
1925
+ )
1926
+ Console.write_stdout(f"Updated reasoning strategy detail: \n{result}")
1927
+
1928
+
1929
+ update_reasoning_strategy_options = [
1930
+ Option(
1931
+ "reasoning_strategy_id",
1932
+ ["--reasoning-strategy-id", "--rsid"],
1933
+ "ID of the reasoning strategy to update",
1934
+ True
1935
+ ),
1936
+ Option(
1937
+ "name",
1938
+ ["--name", "-n"],
1939
+ "Name of the reasoning strategy (optional for update)",
1940
+ True
1941
+ ),
1942
+ Option(
1943
+ "system_prompt",
1944
+ ["--system-prompt", "--sp"],
1945
+ "System prompt for the reasoning strategy (optional for update)",
1946
+ True
1947
+ ),
1948
+ Option(
1949
+ "access_scope",
1950
+ ["--access-scope", "--as"],
1951
+ "Access scope of the reasoning strategy, either 'public' or 'private' (optional for update)",
1952
+ True
1953
+ ),
1954
+ Option(
1955
+ "type",
1956
+ ["--type", "-t"],
1957
+ "Type of the reasoning strategy, e.g., 'addendum' (optional for update)",
1958
+ True
1959
+ ),
1960
+ Option(
1961
+ "localized_description",
1962
+ ["--localized-description", "--ld"],
1963
+ "Localized description in JSON format: "
1964
+ "'{\"language\": \"english\", \"description\": \"description text\"}'. "
1965
+ "Multiple descriptions can be specified by using this option multiple times (optional for update).",
1966
+ True
1967
+ ),
1968
+ Option(
1969
+ "automatic_publish",
1970
+ ["--automatic-publish", "--ap"],
1971
+ "Define if reasoning strategy must be published after being updated. 0: Update as draft. 1: Update and publish. Defaults to 0.",
1972
+ True
1973
+ ),
1974
+ Option(
1975
+ "upsert",
1976
+ ["--upsert"],
1977
+ "Define if reasoning strategy must be created if it doesn't exist. 0: Update only if it exists. 1: Insert if it doesn't exist. Defaults to 0.",
1978
+ True
1979
+ ),
1980
+ ]
1981
+
1982
+
1983
+ def get_reasoning_strategy(option_list: list):
1984
+ reasoning_strategy_id = None
1985
+ reasoning_strategy_name = None
1986
+
1987
+ for option_flag, option_arg in option_list:
1988
+ if option_flag.name == "reasoning_strategy_id":
1989
+ reasoning_strategy_id = option_arg
1990
+ if option_flag.name == "reasoning_strategy_name":
1991
+ reasoning_strategy_name = option_arg
1992
+
1993
+ if not (reasoning_strategy_id or reasoning_strategy_name):
1994
+ raise MissingRequirementException("Either reasoning strategy ID or name must be specified.")
1995
+
1996
+ client = ReasoningStrategyClient()
1997
+ result = client.get_reasoning_strategy(
1998
+ reasoning_strategy_id=reasoning_strategy_id,
1999
+ reasoning_strategy_name=reasoning_strategy_name
2000
+ )
2001
+ Console.write_stdout(f"Reasoning strategy detail: \n{result}")
2002
+
2003
+
2004
+ get_reasoning_strategy_options = [
2005
+ Option(
2006
+ "reasoning_strategy_id",
2007
+ ["--reasoning-strategy-id", "--rsid"],
2008
+ "ID of the reasoning strategy to retrieve (optional if name is provided)",
2009
+ True
2010
+ ),
2011
+ Option(
2012
+ "reasoning_strategy_name",
2013
+ ["--reasoning-strategy-name", "--rsn"],
2014
+ "Name of the reasoning strategy to retrieve (optional if ID is provided)",
2015
+ True
2016
+ ),
2017
+ ]
2018
+
2019
+ # AGENTIC PROCESS DEFINITION
2020
+ # PROCESSES
2021
+
2022
+
2023
+ def create_process(option_list: list):
2024
+ project_id = None
2025
+ key = None
2026
+ name = None
2027
+ description = None
2028
+ kb = None
2029
+ agentic_activities = list()
2030
+ artifact_signals = list()
2031
+ user_signals = list()
2032
+ start_event = None
2033
+ end_event = None
2034
+ sequence_flows = list()
2035
+ automatic_publish = False
2036
+
2037
+ for option_flag, option_arg in option_list:
2038
+ if option_flag.name == "project_id":
2039
+ project_id = option_arg
2040
+ if option_flag.name == "key":
2041
+ key = option_arg
2042
+ if option_flag.name == "name":
2043
+ name = option_arg
2044
+ if option_flag.name == "description":
2045
+ description = option_arg
2046
+ if option_flag.name == "kb":
2047
+ try:
2048
+ kb = json.loads(option_arg)
2049
+ if not isinstance(kb, dict) or "name" not in kb or "artifactTypeName" not in kb:
2050
+ raise ValueError
2051
+ except Exception as e:
2052
+ raise WrongArgumentError(
2053
+ "KB must be in JSON format: "
2054
+ "'{\"name\": \"basic-sample\", \"artifactTypeName\": [\"sample-artifact\"]}'"
2055
+ )
2056
+ if option_flag.name == "agentic_activity":
2057
+ try:
2058
+ activity_json = json.loads(option_arg)
2059
+ if isinstance(activity_json, list) and not activity_json:
2060
+ agentic_activities = []
2061
+ elif not isinstance(activity_json, dict) or "key" not in activity_json or "name" not in activity_json:
2062
+ raise ValueError
2063
+ agentic_activities.append(activity_json)
2064
+ except Exception as e:
2065
+ raise WrongArgumentError(
2066
+ "Each agentic activity must be in JSON format: "
2067
+ "'{\"key\": \"activityOne\", \"name\": \"First Step\", \"taskName\": \"basic-task\", "
2068
+ "\"agentName\": \"sample-translator\", \"agentRevisionId\": 0}'"
2069
+ )
2070
+ if option_flag.name == "artifact_signal":
2071
+ try:
2072
+ signal_json = json.loads(option_arg)
2073
+ if not isinstance(signal_json, dict) or "key" not in signal_json or "name" not in signal_json:
2074
+ raise ValueError
2075
+ artifact_signals.append(signal_json)
2076
+ except Exception as e:
2077
+ raise WrongArgumentError(
2078
+ "Each artifact signal must be in JSON format: "
2079
+ "'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\", \"handlingType\": \"C\", "
2080
+ "\"artifactTypeName\": [\"sample-artifact\"]}'"
2081
+ )
2082
+ if option_flag.name == "user_signal":
2083
+ try:
2084
+ signal_json = json.loads(option_arg)
2085
+ if not isinstance(signal_json, dict) or "key" not in signal_json or "name" not in signal_json:
2086
+ raise ValueError
2087
+ user_signals.append(signal_json)
2088
+ except Exception as e:
2089
+ raise WrongArgumentError(
2090
+ "Each user signal must be in JSON format: "
2091
+ "'{\"key\": \"signal_done\", \"name\": \"process-completed\"}'"
2092
+ )
2093
+ if option_flag.name == "start_event":
2094
+ try:
2095
+ start_event = json.loads(option_arg)
2096
+ if not isinstance(start_event, dict) or "key" not in start_event or "name" not in start_event:
2097
+ raise ValueError
2098
+ except Exception as e:
2099
+ raise WrongArgumentError(
2100
+ "Start event must be in JSON format: "
2101
+ "'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\"}'"
2102
+ )
2103
+ if option_flag.name == "end_event":
2104
+ try:
2105
+ end_event = json.loads(option_arg)
2106
+ if not isinstance(end_event, dict) or "key" not in end_event or "name" not in end_event:
2107
+ raise ValueError
2108
+ except Exception as e:
2109
+ raise WrongArgumentError(
2110
+ "End event must be in JSON format: "
2111
+ "'{\"key\": \"end\", \"name\": \"Done\"}'"
2112
+ )
2113
+ if option_flag.name == "sequence_flow":
2114
+ try:
2115
+ flow_json = json.loads(option_arg)
2116
+ if not isinstance(flow_json, dict) or "key" not in flow_json or "sourceKey" not in flow_json or "targetKey" not in flow_json:
2117
+ raise ValueError
2118
+ sequence_flows.append(flow_json)
2119
+ except Exception as e:
2120
+ raise WrongArgumentError(
2121
+ "Each sequence flow must be in JSON format: "
2122
+ "'{\"key\": \"step1\", \"sourceKey\": \"artifact.upload.1\", \"targetKey\": \"activityOne\"}'"
2123
+ )
2124
+ if option_flag.name == "automatic_publish":
2125
+ automatic_publish = get_boolean_value(option_arg)
2126
+
2127
+ if not key:
2128
+ raise MissingRequirementException("Key must be specified.")
2129
+ if not name:
2130
+ raise MissingRequirementException("Name must be specified.")
2131
+
2132
+ client = AgenticProcessClient(project_id=project_id)
2133
+ result = client.create_process(
2134
+ key=key,
2135
+ name=name,
2136
+ description=description,
2137
+ kb=kb,
2138
+ agentic_activities=agentic_activities if agentic_activities else None,
2139
+ artifact_signals=artifact_signals if artifact_signals else None,
2140
+ user_signals=user_signals if user_signals else None,
2141
+ start_event=start_event,
2142
+ end_event=end_event,
2143
+ sequence_flows=sequence_flows if sequence_flows else None,
2144
+ automatic_publish=automatic_publish
2145
+ )
2146
+ Console.write_stdout(f"Created process detail: \n{result}")
2147
+
2148
+
2149
+ create_process_options = [
2150
+ PROJECT_ID_OPTION,
2151
+ Option(
2152
+ "key",
2153
+ ["--key", "-k"],
2154
+ "Unique key for the process",
2155
+ True
2156
+ ),
2157
+ Option(
2158
+ "name",
2159
+ ["--name", "-n"],
2160
+ "Name of the process",
2161
+ True
2162
+ ),
2163
+ Option(
2164
+ "description",
2165
+ ["--description", "-d"],
2166
+ "Description of the process (optional)",
2167
+ True
2168
+ ),
2169
+ Option(
2170
+ "kb",
2171
+ ["--kb"],
2172
+ "Knowledge base in JSON format: "
2173
+ "'{\"name\": \"basic-sample\", \"artifactTypeName\": [\"sample-artifact\"]}' (optional)",
2174
+ True
2175
+ ),
2176
+ Option(
2177
+ "agentic_activity",
2178
+ ["--agentic-activity", "--aa"],
2179
+ "Agentic activity in JSON format: "
2180
+ "'{\"key\": \"activityOne\", \"name\": \"First Step\", \"taskName\": \"basic-task\", "
2181
+ "\"agentName\": \"sample-translator\", \"agentRevisionId\": 0}' "
2182
+ "or '[]' to clear all activities. "
2183
+ "Multiple activities can be specified by using this option multiple times.",
2184
+ True
2185
+ ),
2186
+ Option(
2187
+ "artifact_signal",
2188
+ ["--artifact-signal", "--as"],
2189
+ "Artifact signal in JSON format: "
2190
+ "'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\", \"handlingType\": \"C\", "
2191
+ "\"artifactTypeName\": [\"sample-artifact\"]}'. "
2192
+ "Multiple signals can be specified by using this option multiple times (optional).",
2193
+ True
2194
+ ),
2195
+ Option(
2196
+ "user_signal",
2197
+ ["--user-signal", "--us"],
2198
+ "User signal in JSON format: "
2199
+ "'{\"key\": \"signal_done\", \"name\": \"process-completed\"}'. "
2200
+ "Multiple signals can be specified by using this option multiple times (optional).",
2201
+ True
2202
+ ),
2203
+ Option(
2204
+ "start_event",
2205
+ ["--start-event", "--se"],
2206
+ "Start event in JSON format: "
2207
+ "'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\"}' (optional)",
2208
+ True
2209
+ ),
2210
+ Option(
2211
+ "end_event",
2212
+ ["--end-event", "--ee"],
2213
+ "End event in JSON format: "
2214
+ "'{\"key\": \"end\", \"name\": \"Done\"}' (optional)",
2215
+ True
2216
+ ),
2217
+ Option(
2218
+ "sequence_flow",
2219
+ ["--sequence-flow", "--sf"],
2220
+ "Sequence flow in JSON format: "
2221
+ "'{\"key\": \"step1\", \"sourceKey\": \"artifact.upload.1\", \"targetKey\": \"activityOne\"}'. "
2222
+ "Multiple flows can be specified by using this option multiple times (optional).",
2223
+ True
2224
+ ),
2225
+ Option(
2226
+ "automatic_publish",
2227
+ ["--automatic-publish", "--ap"],
2228
+ "Define if process must be published after being created. 0: Create as draft. 1: Create and publish. Defaults to 0.",
2229
+ True
2230
+ ),
2231
+ ]
2232
+
2233
+
2234
+ def update_process(option_list: list):
2235
+ project_id = None
2236
+ process_id = None
2237
+ name = None
2238
+ key = None
2239
+ description = None
2240
+ kb = None
2241
+ agentic_activities = list()
2242
+ artifact_signals = list()
2243
+ user_signals = list()
2244
+ start_event = None
2245
+ end_event = None
2246
+ sequence_flows = list()
2247
+ automatic_publish = False
2248
+ upsert = False
2249
+
2250
+ for option_flag, option_arg in option_list:
2251
+ if option_flag.name == "project_id":
2252
+ project_id = option_arg
2253
+ if option_flag.name == "process_id":
2254
+ process_id = option_arg
2255
+ if option_flag.name == "name":
2256
+ name = option_arg
2257
+ if option_flag.name == "key":
2258
+ key = option_arg
2259
+ if option_flag.name == "description":
2260
+ description = option_arg
2261
+ if option_flag.name == "kb":
2262
+ try:
2263
+ kb = json.loads(option_arg)
2264
+ if not isinstance(kb, dict) or "name" not in kb or "artifactTypeName" not in kb:
2265
+ raise ValueError
2266
+ except Exception as e:
2267
+ raise WrongArgumentError(
2268
+ "KB must be in JSON format: "
2269
+ "'{\"name\": \"basic-sample\", \"artifactTypeName\": [\"sample-artifact\"]}'"
2270
+ )
2271
+ if option_flag.name == "agentic_activity":
2272
+ try:
2273
+ activity_json = json.loads(option_arg)
2274
+ if isinstance(activity_json, list) and not activity_json:
2275
+ agentic_activities = []
2276
+ elif not isinstance(activity_json, dict) or "key" not in activity_json or "name" not in activity_json:
2277
+ raise ValueError
2278
+ agentic_activities.append(activity_json)
2279
+ except Exception as e:
2280
+ raise WrongArgumentError(
2281
+ "Each agentic activity must be in JSON format: "
2282
+ "'{\"key\": \"activityOne\", \"name\": \"First Step\", \"taskName\": \"basic-task\", "
2283
+ "\"agentName\": \"sample-translator\", \"agentRevisionId\": 0}'"
2284
+ )
2285
+ if option_flag.name == "artifact_signal":
2286
+ try:
2287
+ signal_json = json.loads(option_arg)
2288
+ if not isinstance(signal_json, dict) or "key" not in signal_json or "name" not in signal_json:
2289
+ raise ValueError
2290
+ artifact_signals.append(signal_json)
2291
+ except Exception as e:
2292
+ raise WrongArgumentError(
2293
+ "Each artifact signal must be in JSON format: "
2294
+ "'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\", \"handlingType\": \"C\", "
2295
+ "\"artifactTypeName\": [\"sample-artifact\"]}'"
2296
+ )
2297
+ if option_flag.name == "user_signal":
2298
+ try:
2299
+ signal_json = json.loads(option_arg)
2300
+ if not isinstance(signal_json, dict) or "key" not in signal_json or "name" not in signal_json:
2301
+ raise ValueError
2302
+ user_signals.append(signal_json)
2303
+ except Exception as e:
2304
+ raise WrongArgumentError(
2305
+ "Each user signal must be in JSON format: "
2306
+ "'{\"key\": \"signal_done\", \"name\": \"process-completed\"}'"
2307
+ )
2308
+ if option_flag.name == "start_event":
2309
+ try:
2310
+ start_event = json.loads(option_arg)
2311
+ if not isinstance(start_event, dict) or "key" not in start_event or "name" not in start_event:
2312
+ raise ValueError
2313
+ except Exception as e:
2314
+ raise WrongArgumentError(
2315
+ "Start event must be in JSON format: "
2316
+ "'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\"}'"
2317
+ )
2318
+ if option_flag.name == "end_event":
2319
+ try:
2320
+ end_event = json.loads(option_arg)
2321
+ if not isinstance(end_event, dict) or "key" not in end_event or "name" not in end_event:
2322
+ raise ValueError
2323
+ except Exception as e:
2324
+ raise WrongArgumentError(
2325
+ "End event must be in JSON format: "
2326
+ "'{\"key\": \"end\", \"name\": \"Done\"}'"
2327
+ )
2328
+ if option_flag.name == "sequence_flow":
2329
+ try:
2330
+ flow_json = json.loads(option_arg)
2331
+ if not isinstance(flow_json, dict) or "key" not in flow_json or "sourceKey" not in flow_json or "targetKey" not in flow_json:
2332
+ raise ValueError
2333
+ sequence_flows.append(flow_json)
2334
+ except Exception as e:
2335
+ raise WrongArgumentError(
2336
+ "Each sequence flow must be in JSON format: "
2337
+ "'{\"key\": \"step1\", \"sourceKey\": \"artifact.upload.1\", \"targetKey\": \"activityOne\"}'"
2338
+ )
2339
+ if option_flag.name == "automatic_publish":
2340
+ automatic_publish = get_boolean_value(option_arg)
2341
+ if option_flag.name == "upsert":
2342
+ upsert = get_boolean_value(option_arg)
2343
+
2344
+ if not (process_id or name):
2345
+ raise MissingRequirementException("Either process ID or name must be specified.")
2346
+
2347
+ client = AgenticProcessClient(project_id=project_id)
2348
+ result = client.update_process(
2349
+ process_id=process_id,
2350
+ name=name,
2351
+ key=key,
2352
+ description=description,
2353
+ kb=kb,
2354
+ agentic_activities=agentic_activities if agentic_activities else None,
2355
+ artifact_signals=artifact_signals if artifact_signals else None,
2356
+ user_signals=user_signals if user_signals else None,
2357
+ start_event=start_event,
2358
+ end_event=end_event,
2359
+ sequence_flows=sequence_flows if sequence_flows else None,
2360
+ automatic_publish=automatic_publish,
2361
+ upsert=upsert
2362
+ )
2363
+ Console.write_stdout(f"Updated process detail: \n{result}")
2364
+
2365
+
2366
+ update_process_options = [
2367
+ PROJECT_ID_OPTION,
2368
+ Option(
2369
+ "process_id",
2370
+ ["--process-id", "--pid"],
2371
+ "ID of the process to update (optional if name is provided)",
2372
+ True
2373
+ ),
2374
+ Option(
2375
+ "name",
2376
+ ["--name", "-n"],
2377
+ "Name of the process to update (optional if process_id is provided)",
2378
+ True
2379
+ ),
2380
+ Option(
2381
+ "key",
2382
+ ["--key", "-k"],
2383
+ "Unique key for the process (optional for update)",
2384
+ True
2385
+ ),
2386
+ Option(
2387
+ "description",
2388
+ ["--description", "-d"],
2389
+ "Description of the process (optional for update)",
2390
+ True
2391
+ ),
2392
+ Option(
2393
+ "kb",
2394
+ ["--kb"],
2395
+ "Knowledge base in JSON format: "
2396
+ "'{\"name\": \"basic-sample\", \"artifactTypeName\": [\"sample-artifact\"]}' (optional for update)",
2397
+ True
2398
+ ),
2399
+ Option(
2400
+ "agentic_activity",
2401
+ ["--agentic-activity", "--aa"],
2402
+ "Agentic activity in JSON format: "
2403
+ "'{\"key\": \"activityOne\", \"name\": \"First Step\", \"taskName\": \"basic-task\", "
2404
+ "\"agentName\": \"sample-translator\", \"agentRevisionId\": 0}' "
2405
+ "or '[]' to clear all activities. "
2406
+ "Multiple activities can be specified by using this option multiple times (optional for update).",
2407
+ True
2408
+ ),
2409
+ Option(
2410
+ "artifact_signal",
2411
+ ["--artifact-signal", "--as"],
2412
+ "Artifact signal in JSON format: "
2413
+ "'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\", \"handlingType\": \"C\", "
2414
+ "\"artifactTypeName\": [\"sample-artifact\"]}'. "
2415
+ "Multiple signals can be specified by using this option multiple times (optional for update).",
2416
+ True
2417
+ ),
2418
+ Option(
2419
+ "user_signal",
2420
+ ["--user-signal", "--us"],
2421
+ "User signal in JSON format: "
2422
+ "'{\"key\": \"signal_done\", \"name\": \"process-completed\"}'. "
2423
+ "Multiple signals can be specified by using this option multiple times (optional for update).",
2424
+ True
2425
+ ),
2426
+ Option(
2427
+ "start_event",
2428
+ ["--start-event", "--se"],
2429
+ "Start event in JSON format: "
2430
+ "'{\"key\": \"artifact.upload.1\", \"name\": \"artifact.upload\"}' (optional for update)",
2431
+ True
2432
+ ),
2433
+ Option(
2434
+ "end_event",
2435
+ ["--end-event", "--ee"],
2436
+ "End event in JSON format: "
2437
+ "'{\"key\": \"end\", \"name\": \"Done\"}' (optional for update)",
2438
+ True
2439
+ ),
2440
+ Option(
2441
+ "sequence_flow",
2442
+ ["--sequence-flow", "--sf"],
2443
+ "Sequence flow in JSON format: "
2444
+ "'{\"key\": \"step1\", \"sourceKey\": \"artifact.upload.1\", \"targetKey\": \"activityOne\"}'. "
2445
+ "Multiple flows can be specified by using this option multiple times (optional for update).",
2446
+ True
2447
+ ),
2448
+ Option(
2449
+ "automatic_publish",
2450
+ ["--automatic-publish", "--ap"],
2451
+ "Define if process must be published after being updated. 0: Update as draft. 1: Update and publish. Defaults to 0.",
2452
+ True
2453
+ ),
2454
+ Option(
2455
+ "upsert",
2456
+ ["--upsert"],
2457
+ "Define if process must be created if it doesn't exist. 0: Update only if it exists. 1: Insert if it doesn't exist. Defaults to 0.",
2458
+ True
2459
+ ),
2460
+ ]
2461
+
2462
+
2463
+ def get_process(option_list: list):
2464
+ project_id = None
2465
+ process_id = None
2466
+ process_name = None
2467
+ revision = "0"
2468
+ version = 0
2469
+ allow_drafts = True
2470
+
2471
+ for option_flag, option_arg in option_list:
2472
+ if option_flag.name == "project_id":
2473
+ project_id = option_arg
2474
+ if option_flag.name == "process_id":
2475
+ process_id = option_arg
2476
+ if option_flag.name == "process_name":
2477
+ process_name = option_arg
2478
+ if option_flag.name == "revision":
2479
+ revision = option_arg
2480
+ if option_flag.name == "version":
2481
+ version = int(option_arg)
2482
+ if option_flag.name == "allow_drafts":
2483
+ allow_drafts = get_boolean_value(option_arg)
2484
+
2485
+ if not (process_id or process_name):
2486
+ raise MissingRequirementException("Either process ID or process name must be specified.")
2487
+
2488
+ client = AgenticProcessClient(project_id=project_id)
2489
+ result = client.get_process(
2490
+ process_id=process_id,
2491
+ process_name=process_name,
2492
+ revision=revision,
2493
+ version=version,
2494
+ allow_drafts=allow_drafts
2495
+ )
2496
+ Console.write_stdout(f"Process detail: \n{result}")
2497
+
2498
+
2499
+ get_process_options = [
2500
+ PROJECT_ID_OPTION,
2501
+ Option(
2502
+ "process_id",
2503
+ ["--process-id", "--pid"],
2504
+ "ID of the process to retrieve (optional if process_name is provided)",
2505
+ True
2506
+ ),
2507
+ Option(
2508
+ "process_name",
2509
+ ["--process-name", "--pn"],
2510
+ "Name of the process to retrieve (optional if process_id is provided)",
2511
+ True
2512
+ ),
2513
+ Option(
2514
+ "revision",
2515
+ ["--revision", "-r"],
2516
+ "Revision of the process to retrieve. Defaults to '0' (latest revision).",
2517
+ True
2518
+ ),
2519
+ Option(
2520
+ "version",
2521
+ ["--version", "-v"],
2522
+ "Version of the process to retrieve. Defaults to 0 (latest version).",
2523
+ True
2524
+ ),
2525
+ Option(
2526
+ "allow_drafts",
2527
+ ["--allow-drafts", "--ad"],
2528
+ "Whether to include draft processes in the retrieval. Defaults to 1 (True).",
2529
+ True
2530
+ ),
2531
+ ]
2532
+
2533
+
2534
+ def list_processes(option_list: list):
2535
+ project_id = None
2536
+ id = None
2537
+ name = None
2538
+ status = None
2539
+ start = "0"
2540
+ count = "100"
2541
+ allow_draft = True
2542
+
2543
+ for option_flag, option_arg in option_list:
2544
+ if option_flag.name == "project_id":
2545
+ project_id = option_arg
2546
+ if option_flag.name == "id":
2547
+ id = option_arg
2548
+ if option_flag.name == "name":
2549
+ name = option_arg
2550
+ if option_flag.name == "status":
2551
+ status = option_arg
2552
+ if option_flag.name == "start":
2553
+ start = option_arg
2554
+ if option_flag.name == "count":
2555
+ count = option_arg
2556
+ if option_flag.name == "allow_draft":
2557
+ allow_draft = get_boolean_value(option_arg)
2558
+
2559
+ client = AgenticProcessClient(project_id=project_id)
2560
+ result = client.list_processes(
2561
+ id=id,
2562
+ name=name,
2563
+ status=status,
2564
+ start=start,
2565
+ count=count,
2566
+ allow_draft=allow_draft
2567
+ )
2568
+ Console.write_stdout(f"Process list: \n{result}")
2569
+
2570
+
2571
+ list_processes_options = [
2572
+ PROJECT_ID_OPTION,
2573
+ Option(
2574
+ "id",
2575
+ ["--id"],
2576
+ "ID of the process to filter by (optional)",
2577
+ True
2578
+ ),
2579
+ Option(
2580
+ "name",
2581
+ ["--name", "-n"],
2582
+ "Name of the process to filter by (optional)",
2583
+ True
2584
+ ),
2585
+ Option(
2586
+ "status",
2587
+ ["--status", "-s"],
2588
+ "Status of the processes to filter by (e.g., 'active', 'inactive') (optional)",
2589
+ True
2590
+ ),
2591
+ Option(
2592
+ "start",
2593
+ ["--start"],
2594
+ "Starting index for pagination. Defaults to '0'.",
2595
+ True
2596
+ ),
2597
+ Option(
2598
+ "count",
2599
+ ["--count"],
2600
+ "Number of processes to retrieve. Defaults to '100'.",
2601
+ True
2602
+ ),
2603
+ Option(
2604
+ "allow_draft",
2605
+ ["--allow-draft", "--ad"],
2606
+ "Whether to include draft processes in the list. Defaults to 1 (True).",
2607
+ True
2608
+ ),
2609
+ ]
2610
+
2611
+
2612
+ def list_processes_instances(option_list: list):
2613
+ project_id = None
2614
+ process_id = None
2615
+ is_active = True
2616
+ start = "0"
2617
+ count = "10"
2618
+
2619
+ for option_flag, option_arg in option_list:
2620
+ if option_flag.name == "project_id":
2621
+ project_id = option_arg
2622
+ if option_flag.name == "process_id":
2623
+ process_id = option_arg
2624
+ if option_flag.name == "is_active":
2625
+ is_active = get_boolean_value(option_arg)
2626
+ if option_flag.name == "start":
2627
+ start = option_arg
2628
+ if option_flag.name == "count":
2629
+ count = option_arg
2630
+
2631
+ if not process_id:
2632
+ raise MissingRequirementException("Process ID must be specified.")
2633
+
2634
+ client = AgenticProcessClient(project_id=project_id)
2635
+ result = client.list_process_instances(
2636
+ process_id=process_id,
2637
+ is_active=is_active,
2638
+ start=start,
2639
+ count=count
2640
+ )
2641
+ Console.write_stdout(f"Process instances list: \n{result}")
2642
+
2643
+
2644
+ list_processes_instances_options = [
2645
+ PROJECT_ID_OPTION,
2646
+ Option(
2647
+ "process_id",
2648
+ ["--process-id", "--pid"],
2649
+ "ID of the process to list instances for",
2650
+ True
2651
+ ),
2652
+ Option(
2653
+ "is_active",
2654
+ ["--is-active", "--ia"],
2655
+ "Whether to list only active process instances. Defaults to 1 (True).",
2656
+ True
2657
+ ),
2658
+ Option(
2659
+ "start",
2660
+ ["--start"],
2661
+ "Starting index for pagination. Defaults to '0'.",
2662
+ True
2663
+ ),
2664
+ Option(
2665
+ "count",
2666
+ ["--count"],
2667
+ "Number of process instances to retrieve. Defaults to '10'.",
2668
+ True
2669
+ ),
2670
+ ]
2671
+
2672
+
2673
+ def delete_process(option_list: list):
2674
+ project_id = None
2675
+ process_id = None
2676
+ process_name = None
2677
+
2678
+ for option_flag, option_arg in option_list:
2679
+ if option_flag.name == "project_id":
2680
+ project_id = option_arg
2681
+ if option_flag.name == "process_id":
2682
+ process_id = option_arg
2683
+ if option_flag.name == "process_name":
2684
+ process_name = option_arg
2685
+
2686
+ if not (process_id or process_name):
2687
+ raise MissingRequirementException("Either process ID or process name must be specified.")
2688
+
2689
+ client = AgenticProcessClient(project_id=project_id)
2690
+ result = client.delete_process(
2691
+ process_id=process_id,
2692
+ process_name=process_name
2693
+ )
2694
+ Console.write_stdout(f"Delete process result: \n{result}")
2695
+
2696
+
2697
+ delete_process_options = [
2698
+ PROJECT_ID_OPTION,
2699
+ Option(
2700
+ "process_id",
2701
+ ["--process-id", "--pid"],
2702
+ "ID of the process to delete (optional if process_name is provided)",
2703
+ True
2704
+ ),
2705
+ Option(
2706
+ "process_name",
2707
+ ["--process-name", "--pn"],
2708
+ "Name of the process to delete (optional if process_id is provided)",
2709
+ True
2710
+ ),
2711
+ ]
2712
+
2713
+
2714
+ def publish_process_revision(option_list: list):
2715
+ project_id = None
2716
+ process_id = None
2717
+ process_name = None
2718
+ revision = None
2719
+
2720
+ for option_flag, option_arg in option_list:
2721
+ if option_flag.name == "project_id":
2722
+ project_id = option_arg
2723
+ if option_flag.name == "process_id":
2724
+ process_id = option_arg
2725
+ if option_flag.name == "process_name":
2726
+ process_name = option_arg
2727
+ if option_flag.name == "revision":
2728
+ revision = option_arg
2729
+
2730
+ if not (process_id or process_name):
2731
+ raise MissingRequirementException("Either process ID or process name must be specified.")
2732
+ if not revision:
2733
+ raise MissingRequirementException("Revision must be specified.")
2734
+
2735
+ client = AgenticProcessClient(project_id=project_id)
2736
+ result = client.publish_process_revision(
2737
+ process_id=process_id,
2738
+ process_name=process_name,
2739
+ revision=revision
2740
+ )
2741
+ Console.write_stdout(f"Published process revision detail: \n{result}")
2742
+
2743
+
2744
+ publish_process_revision_options = [
2745
+ PROJECT_ID_OPTION,
2746
+ Option(
2747
+ "process_id",
2748
+ ["--process-id", "--pid"],
2749
+ "ID of the process to publish (optional if process_name is provided)",
2750
+ True
2751
+ ),
2752
+ Option(
2753
+ "process_name",
2754
+ ["--process-name", "--pn"],
2755
+ "Name of the process to publish (optional if process_id is provided)",
2756
+ True
2757
+ ),
2758
+ Option(
2759
+ "revision",
2760
+ ["--revision", "-r"],
2761
+ "Revision of the process to publish",
2762
+ True
2763
+ ),
2764
+ ]
2765
+
2766
+
2767
+ # TASKS
2768
+
2769
+
2770
+ def create_task(option_list: list):
2771
+ project_id = None
2772
+ name = None
2773
+ description = None
2774
+ title_template = None
2775
+ id = None
2776
+ prompt_data = None
2777
+ artifact_types = None
2778
+ automatic_publish = False
2779
+
2780
+ for option_flag, option_arg in option_list:
2781
+ if option_flag.name == "project_id":
2782
+ project_id = option_arg
2783
+ if option_flag.name == "name":
2784
+ name = option_arg
2785
+ if option_flag.name == "description":
2786
+ description = option_arg
2787
+ if option_flag.name == "title_template":
2788
+ title_template = option_arg
2789
+ if option_flag.name == "id":
2790
+ id = option_arg
2791
+ if option_flag.name == "prompt_data":
2792
+ try:
2793
+ prompt_data = json.loads(option_arg)
2794
+ if not isinstance(prompt_data, dict):
2795
+ raise ValueError("prompt_data must be a JSON object")
2796
+ except json.JSONDecodeError:
2797
+ raise ValueError("prompt_data must be a valid JSON string")
2798
+ if option_flag.name == "artifact_types":
2799
+ try:
2800
+ artifact_types = json.loads(option_arg)
2801
+ if not isinstance(artifact_types, list):
2802
+ raise ValueError("artifact_types must be a JSON array")
2803
+ except json.JSONDecodeError:
2804
+ raise ValueError("artifact_types must be a valid JSON string")
2805
+ if option_flag.name == "automatic_publish":
2806
+ automatic_publish = get_boolean_value(option_arg)
2807
+
2808
+ if not name:
2809
+ raise MissingRequirementException("Task name must be specified.")
2810
+
2811
+ client = AgenticProcessClient(project_id=project_id)
2812
+ result = client.create_task(
2813
+ name=name,
2814
+ description=description,
2815
+ title_template=title_template,
2816
+ id=id,
2817
+ prompt_data=prompt_data,
2818
+ artifact_types=artifact_types,
2819
+ automatic_publish=automatic_publish
2820
+ )
2821
+ Console.write_stdout(f"Created task detail: \n{result}")
2822
+
2823
+
2824
+ create_task_options = [
2825
+ PROJECT_ID_OPTION,
2826
+ Option(
2827
+ "name",
2828
+ ["--name", "-n"],
2829
+ "Name of the task (required, must be unique within the project, no ':' or '/')",
2830
+ True
2831
+ ),
2832
+ Option(
2833
+ "description",
2834
+ ["--description", "-d"],
2835
+ "Description of what the task does (optional)",
2836
+ True
2837
+ ),
2838
+ Option(
2839
+ "title_template",
2840
+ ["--title-template", "--tt"],
2841
+ "Title template for task instances (optional, e.g., 'specs for {{issue}}')",
2842
+ True
2843
+ ),
2844
+ Option(
2845
+ "id",
2846
+ ["--id"],
2847
+ "Custom ID for the task (optional, used instead of system-assigned ID)",
2848
+ True
2849
+ ),
2850
+ Option(
2851
+ "prompt_data",
2852
+ ["--prompt-data", "--pd"],
2853
+ "Prompt configuration as JSON (optional, e.g., '{\"instructions\": \"Do this\", \"inputs\": [\"x\"]}')",
2854
+ True
2855
+ ),
2856
+ Option(
2857
+ "artifact_types",
2858
+ ["--artifact-types", "--at"],
2859
+ "Artifact types as JSON array (optional, e.g., '[{\"name\": \"doc\", \"description\": \"Docs\", \"isRequired\": true, \"usageType\": \"output\", \"artifactVariableKey\": \"doc_prefix\"}]')",
2860
+ True
2861
+ ),
2862
+ Option(
2863
+ "automatic_publish",
2864
+ ["--automatic-publish", "--ap"],
2865
+ "Define if task must be published after creation. 0: Create as draft. 1: Create and publish. Defaults to 0.",
2866
+ True
2867
+ ),
2868
+ ]
2869
+
2870
+
2871
+ def get_task(option_list: list):
2872
+ project_id = None
2873
+ task_id = None
2874
+ task_name = None
2875
+
2876
+ for option_flag, option_arg in option_list:
2877
+ if option_flag.name == "project_id":
2878
+ project_id = option_arg
2879
+ if option_flag.name == "task_id":
2880
+ task_id = option_arg
2881
+ if option_flag.name == "task_name":
2882
+ task_name = option_arg
2883
+
2884
+ if not (task_id or task_name):
2885
+ raise MissingRequirementException("Either task ID or task name must be specified.")
2886
+
2887
+ client = AgenticProcessClient(project_id=project_id)
2888
+ result = client.get_task(
2889
+ task_id=task_id,
2890
+ task_name=task_name
2891
+ )
2892
+ Console.write_stdout(f"Task detail: \n{result}")
2893
+
2894
+
2895
+ get_task_options = [
2896
+ PROJECT_ID_OPTION,
2897
+ Option(
2898
+ "task_id",
2899
+ ["--task-id", "--tid"],
2900
+ "ID of the task to retrieve",
2901
+ True
2902
+ ),
2903
+ Option(
2904
+ "task_name",
2905
+ ["--task-name", "--tn"],
2906
+ "Name of the task to retrieve (optional if task_id is provided)",
2907
+ True
2908
+ ),
2909
+ ]
2910
+
2911
+
2912
+ def list_tasks(option_list: list):
2913
+ project_id = None
2914
+ id = None
2915
+ start = "0"
2916
+ count = "100"
2917
+ allow_drafts = True
2918
+
2919
+ for option_flag, option_arg in option_list:
2920
+ if option_flag.name == "project_id":
2921
+ project_id = option_arg
2922
+ if option_flag.name == "id":
2923
+ id = option_arg
2924
+ if option_flag.name == "start":
2925
+ start = option_arg
2926
+ if option_flag.name == "count":
2927
+ count = option_arg
2928
+ if option_flag.name == "allow_drafts":
2929
+ allow_drafts = get_boolean_value(option_arg)
2930
+
2931
+ client = AgenticProcessClient(project_id=project_id)
2932
+ result = client.list_tasks(
2933
+ id=id,
2934
+ start=start,
2935
+ count=count,
2936
+ allow_drafts=allow_drafts
2937
+ )
2938
+ Console.write_stdout(f"Task list: \n{result}")
2939
+
2940
+
2941
+ list_tasks_options = [
2942
+ PROJECT_ID_OPTION,
2943
+ Option(
2944
+ "id",
2945
+ ["--id"],
2946
+ "ID of the task to filter by (optional)",
2947
+ True
2948
+ ),
2949
+ Option(
2950
+ "start",
2951
+ ["--start"],
2952
+ "Starting index for pagination. Defaults to '0'.",
2953
+ True
2954
+ ),
2955
+ Option(
2956
+ "count",
2957
+ ["--count"],
2958
+ "Number of tasks to retrieve. Defaults to '100'.",
2959
+ True
2960
+ ),
2961
+ Option(
2962
+ "allow_drafts",
2963
+ ["--allow-drafts", "--ad"],
2964
+ "Whether to include draft tasks in the list. Defaults to 1 (True).",
2965
+ True
2966
+ ),
2967
+ ]
2968
+
2969
+
2970
+ def update_task(option_list: list):
2971
+ project_id = None
2972
+ task_id = None
2973
+ name = None
2974
+ description = None
2975
+ title_template = None
2976
+ id = None
2977
+ prompt_data = None
2978
+ artifact_types = None
2979
+ automatic_publish = False
2980
+ upsert = False
2981
+
2982
+ for option_flag, option_arg in option_list:
2983
+ if option_flag.name == "project_id":
2984
+ project_id = option_arg
2985
+ if option_flag.name == "task_id":
2986
+ task_id = option_arg
2987
+ if option_flag.name == "name":
2988
+ name = option_arg
2989
+ if option_flag.name == "description":
2990
+ description = option_arg
2991
+ if option_flag.name == "title_template":
2992
+ title_template = option_arg
2993
+ if option_flag.name == "id":
2994
+ id = option_arg
2995
+ if option_flag.name == "prompt_data":
2996
+ try:
2997
+ prompt_data = json.loads(option_arg)
2998
+ if not isinstance(prompt_data, dict):
2999
+ raise ValueError("prompt_data must be a JSON object")
3000
+ except json.JSONDecodeError:
3001
+ raise ValueError("prompt_data must be a valid JSON string")
3002
+ if option_flag.name == "artifact_types":
3003
+ try:
3004
+ artifact_types = json.loads(option_arg)
3005
+ if not isinstance(artifact_types, list):
3006
+ raise ValueError("artifact_types must be a JSON array")
3007
+ except json.JSONDecodeError:
3008
+ raise ValueError("artifact_types must be a valid JSON string")
3009
+ if option_flag.name == "automatic_publish":
3010
+ automatic_publish = get_boolean_value(option_arg)
3011
+ if option_flag.name == "upsert":
3012
+ upsert = get_boolean_value(option_arg)
3013
+
3014
+ if not (task_id or name):
3015
+ raise MissingRequirementException("Either task ID or name must be specified.")
3016
+
3017
+ client = AgenticProcessClient(project_id=project_id)
3018
+ result = client.update_task(
3019
+ task_id=task_id,
3020
+ name=name,
3021
+ description=description,
3022
+ title_template=title_template,
3023
+ id=id,
3024
+ prompt_data=prompt_data,
3025
+ artifact_types=artifact_types,
3026
+ automatic_publish=automatic_publish,
3027
+ upsert=upsert
3028
+ )
3029
+ Console.write_stdout(f"Updated task detail: \n{result}")
3030
+
3031
+
3032
+ update_task_options = [
3033
+ PROJECT_ID_OPTION,
3034
+ Option(
3035
+ "task_id",
3036
+ ["--task-id", "--tid"],
3037
+ "ID of the task to update",
3038
+ True
3039
+ ),
3040
+ Option(
3041
+ "name",
3042
+ ["--name", "-n"],
3043
+ "Updated name of the task (optional, must be unique within the project, no ':' or '/' if provided)",
3044
+ True
3045
+ ),
3046
+ Option(
3047
+ "description",
3048
+ ["--description", "-d"],
3049
+ "Updated description of what the task does (optional)",
3050
+ True
3051
+ ),
3052
+ Option(
3053
+ "title_template",
3054
+ ["--title-template", "--tt"],
3055
+ "Updated title template for task instances (optional, e.g., 'specs for {{issue}}')",
3056
+ True
3057
+ ),
3058
+ Option(
3059
+ "id",
3060
+ ["--id"],
3061
+ "Custom ID for the task (optional, used in upsert mode if creating a new task)",
3062
+ True
3063
+ ),
3064
+ Option(
3065
+ "prompt_data",
3066
+ ["--prompt-data", "--pd"],
3067
+ "Updated prompt configuration as JSON (optional, e.g., '{\"instructions\": \"Do this\", \"inputs\": [\"x\"]}')",
3068
+ True
3069
+ ),
3070
+ Option(
3071
+ "artifact_types",
3072
+ ["--artifact-types", "--at"],
3073
+ "Updated artifact types as JSON array (optional, e.g., '[{\"name\": \"doc\", \"description\": \"Docs\", \"isRequired\": true, \"usageType\": \"output\", \"artifactVariableKey\": \"doc_prefix\"}]')",
3074
+ True
3075
+ ),
3076
+ Option(
3077
+ "automatic_publish",
3078
+ ["--automatic-publish", "--ap"],
3079
+ "Define if task must be published after update. 0: Update as draft. 1: Update and publish. Defaults to 0.",
3080
+ True
3081
+ ),
3082
+ Option(
3083
+ "upsert",
3084
+ ["--upsert"],
3085
+ "Define if task must be created if it doesn't exist. 0: Update only if exists. 1: Insert if doesn't exist. Defaults to 0.",
3086
+ True
3087
+ ),
3088
+ ]
3089
+
3090
+
3091
+ def delete_task(option_list: list):
3092
+ project_id = None
3093
+ task_id = None
3094
+ task_name = None
3095
+
3096
+ for option_flag, option_arg in option_list:
3097
+ if option_flag.name == "project_id":
3098
+ project_id = option_arg
3099
+ if option_flag.name == "task_id":
3100
+ task_id = option_arg
3101
+ if option_flag.name == "task_name":
3102
+ task_name = option_arg
3103
+
3104
+ if not (task_id or task_name):
3105
+ raise MissingRequirementException("Either task ID or task name must be specified.")
3106
+
3107
+ client = AgenticProcessClient(project_id=project_id)
3108
+ result = client.delete_task(
3109
+ task_id=task_id,
3110
+ task_name = task_name
3111
+ )
3112
+ Console.write_stdout(f"Delete task result: \n{result}")
3113
+
3114
+
3115
+ delete_task_options = [
3116
+ PROJECT_ID_OPTION,
3117
+ Option(
3118
+ "task_id",
3119
+ ["--task-id", "--tid"],
3120
+ "ID of the task to delete",
3121
+ True
3122
+ ),
3123
+ Option(
3124
+ "task_name",
3125
+ ["--task-name", "--tn"],
3126
+ "Name of the task to delete (optional if task_id is provided)",
3127
+ True
3128
+ ),
3129
+ ]
3130
+
3131
+
3132
+ def publish_task_revision(option_list: list):
3133
+ project_id = None
3134
+ task_id = None
3135
+ task_name = None
3136
+ revision = None
3137
+
3138
+ for option_flag, option_arg in option_list:
3139
+ if option_flag.name == "project_id":
3140
+ project_id = option_arg
3141
+ if option_flag.name == "task_id":
3142
+ task_id = option_arg
3143
+ if option_flag.name == "task_name":
3144
+ task_name = option_arg
3145
+ if option_flag.name == "revision":
3146
+ revision = option_arg
3147
+
3148
+ if not (task_id or task_name):
3149
+ raise MissingRequirementException("Either task ID or task name must be specified.")
3150
+ if not revision:
3151
+ raise MissingRequirementException("Revision must be specified.")
3152
+
3153
+ client = AgenticProcessClient(project_id=project_id)
3154
+ result = client.publish_task_revision(
3155
+ task_id=task_id,
3156
+ task_name=task_name,
3157
+ revision=revision
3158
+ )
3159
+ Console.write_stdout(f"Published task revision detail: \n{result}")
3160
+
3161
+
3162
+ publish_task_revision_options = [
3163
+ PROJECT_ID_OPTION,
3164
+ Option(
3165
+ "task_id",
3166
+ ["--task-id", "--tid"],
3167
+ "ID of the task to publish",
3168
+ True
3169
+ ),
3170
+ Option(
3171
+ "task_name",
3172
+ ["--task-name", "--tn"],
3173
+ "Name of the task to publish (optional if task_id is provided)",
3174
+ True
3175
+ ),
3176
+ Option(
3177
+ "revision",
3178
+ ["--revision", "-r"],
3179
+ "Revision of the task to publish",
3180
+ True
3181
+ ),
3182
+ ]
3183
+
3184
+
3185
+ # RUNTIME - Process instances
3186
+ def start_instance(option_list: list):
3187
+ project_id = None
3188
+ process_name = None
3189
+ subject = None
3190
+ variables = None
3191
+
3192
+ for option_flag, option_arg in option_list:
3193
+ if option_flag.name == "project_id":
3194
+ project_id = option_arg
3195
+ if option_flag.name == "process_name":
3196
+ process_name = option_arg
3197
+ if option_flag.name == "subject":
3198
+ subject = option_arg
3199
+ if option_flag.name == "variables":
3200
+ try:
3201
+ variables = json.loads(option_arg)
3202
+ if not isinstance(variables, list):
3203
+ raise ValueError
3204
+ except Exception:
3205
+ raise WrongArgumentError(
3206
+ "Variables must be a JSON list: '[{\"key\": \"location\", \"value\": \"Paris\"}]'"
3207
+ )
3208
+
3209
+ if not process_name:
3210
+ raise MissingRequirementException("Process name must be specified.")
3211
+
3212
+ client = AgenticProcessClient(project_id=project_id)
3213
+ result = client.start_instance(
3214
+ process_name=process_name,
3215
+ subject=subject,
3216
+ variables=variables
3217
+ )
3218
+ Console.write_stdout(f"Started instance detail: \n{result}")
3219
+
3220
+
3221
+ start_instance_options = [
3222
+ PROJECT_ID_OPTION,
3223
+ Option(
3224
+ "process_name",
3225
+ ["--process-name", "--pn"],
3226
+ "Name of the process to start an instance for",
3227
+ True
3228
+ ),
3229
+ Option(
3230
+ "subject",
3231
+ ["--subject", "-s"],
3232
+ "Subject of the process instance (optional)",
3233
+ True
3234
+ ),
3235
+ Option(
3236
+ "variables",
3237
+ ["--variables", "-v"],
3238
+ "Variables for the process instance in JSON list format: '[{\"key\": \"location\", \"value\": \"Paris\"}]' (optional)",
3239
+ True
3240
+ ),
3241
+ ]
3242
+
3243
+
3244
+ def abort_instance(option_list: list):
3245
+ project_id = None
3246
+ instance_id = None
3247
+
3248
+ for option_flag, option_arg in option_list:
3249
+ if option_flag.name == "project_id":
3250
+ project_id = option_arg
3251
+ if option_flag.name == "instance_id":
3252
+ instance_id = option_arg
3253
+
3254
+ if not instance_id:
3255
+ raise MissingRequirementException("Instance ID must be specified.")
3256
+
3257
+ client = AgenticProcessClient(project_id=project_id)
3258
+ result = client.abort_instance(
3259
+ instance_id=instance_id
3260
+ )
3261
+ Console.write_stdout(f"Abort instance result: \n{result}")
3262
+
3263
+
3264
+ abort_instance_options = [
3265
+ PROJECT_ID_OPTION,
3266
+ Option(
3267
+ "instance_id",
3268
+ ["--instance-id", "--iid"],
3269
+ "ID of the instance to abort",
3270
+ True
3271
+ ),
3272
+ ]
3273
+
3274
+
3275
+ def get_instance(option_list: list):
3276
+ project_id = None
3277
+ instance_id = None
3278
+
3279
+ for option_flag, option_arg in option_list:
3280
+ if option_flag.name == "project_id":
3281
+ project_id = option_arg
3282
+ if option_flag.name == "instance_id":
3283
+ instance_id = option_arg
3284
+
3285
+ if not instance_id:
3286
+ raise MissingRequirementException("Instance ID must be specified.")
3287
+
3288
+ client = AgenticProcessClient(project_id=project_id)
3289
+ result = client.get_instance(
3290
+ instance_id=instance_id
3291
+ )
3292
+ Console.write_stdout(f"Instance detail: \n{result}")
3293
+
3294
+
3295
+ get_instance_options = [
3296
+ PROJECT_ID_OPTION,
3297
+ Option(
3298
+ "instance_id",
3299
+ ["--instance-id", "--iid"],
3300
+ "ID of the instance to retrieve",
3301
+ True
3302
+ ),
3303
+ ]
3304
+
3305
+
3306
+ def get_instance_history(option_list: list):
3307
+ project_id = None
3308
+ instance_id = None
3309
+
3310
+ for option_flag, option_arg in option_list:
3311
+ if option_flag.name == "project_id":
3312
+ project_id = option_arg
3313
+ if option_flag.name == "instance_id":
3314
+ instance_id = option_arg
3315
+
3316
+ if not instance_id:
3317
+ raise MissingRequirementException("Instance ID must be specified.")
3318
+
3319
+ client = AgenticProcessClient(project_id=project_id)
3320
+ result = client.get_instance_history(
3321
+ instance_id=instance_id
3322
+ )
3323
+ Console.write_stdout(f"Instance history: \n{result}")
3324
+
3325
+
3326
+ get_instance_history_options = [
3327
+ PROJECT_ID_OPTION,
3328
+ Option(
3329
+ "instance_id",
3330
+ ["--instance-id", "--iid"],
3331
+ "ID of the instance to retrieve history for",
3332
+ True
3333
+ ),
3334
+ ]
3335
+
3336
+ def get_thread_information(option_list: list):
3337
+ project_id = None
3338
+ thread_id = None
3339
+
3340
+ for option_flag, option_arg in option_list:
3341
+ if option_flag.name == "project_id":
3342
+ project_id = option_arg
3343
+ if option_flag.name == "thread_id":
3344
+ thread_id = option_arg
3345
+
3346
+ if not thread_id:
3347
+ raise MissingRequirementException("Thread ID must be specified.")
3348
+
3349
+ client = AgenticProcessClient(project_id=project_id)
3350
+ result = client.get_thread_information(
3351
+ thread_id=thread_id
3352
+ )
3353
+ Console.write_stdout(f"Thread information: \n{result}")
3354
+
3355
+
3356
+ get_thread_information_options = [
3357
+ PROJECT_ID_OPTION,
3358
+ Option(
3359
+ "thread_id",
3360
+ ["--thread-id", "--tid"],
3361
+ "ID of the thread to retrieve information for",
3362
+ True
3363
+ ),
3364
+ ]
3365
+
3366
+
3367
+ def send_user_signal(option_list: list):
3368
+ project_id = None
3369
+ instance_id = None
3370
+ signal_name = None
3371
+
3372
+ for option_flag, option_arg in option_list:
3373
+ if option_flag.name == "project_id":
3374
+ project_id = option_arg
3375
+ if option_flag.name == "instance_id":
3376
+ instance_id = option_arg
3377
+ if option_flag.name == "signal_name":
3378
+ signal_name = option_arg
3379
+
3380
+ if not instance_id:
3381
+ raise MissingRequirementException("Instance ID must be specified.")
3382
+ if not signal_name:
3383
+ raise MissingRequirementException("Signal name must be specified.")
3384
+
3385
+ client = AgenticProcessClient(project_id=project_id)
3386
+ result = client.send_user_signal(
3387
+ instance_id=instance_id,
3388
+ signal_name=signal_name
3389
+ )
3390
+ Console.write_stdout(f"Send user signal result: \n{result}")
3391
+
3392
+
3393
+ send_user_signal_options = [
3394
+ PROJECT_ID_OPTION,
3395
+ Option(
3396
+ "instance_id",
3397
+ ["--instance-id", "--iid"],
3398
+ "ID of the instance to send the signal to",
3399
+ True
3400
+ ),
3401
+ Option(
3402
+ "signal_name",
3403
+ ["--signal-name", "--sn"],
3404
+ "Name of the user signal to send (e.g., 'approval')",
3405
+ True
3406
+ ),
3407
+ ]
3408
+
3409
+ # KNOWLEDGE BASES
3410
+
3411
+
3412
+ def create_kb(option_list: list):
3413
+ project_id = None
3414
+ name = None
3415
+ artifacts = None
3416
+ metadata = None
3417
+
3418
+ for option_flag, option_arg in option_list:
3419
+ if option_flag.name == "project_id":
3420
+ project_id = option_arg
3421
+ if option_flag.name == "name":
3422
+ name = option_arg
3423
+ if option_flag.name == "artifacts":
3424
+ try:
3425
+ artifacts = json.loads(option_arg)
3426
+ if not isinstance(artifacts, list):
3427
+ raise ValueError
3428
+ except Exception as e:
3429
+ raise WrongArgumentError(
3430
+ "Artifacts must be a JSON list of strings: '[\"artifact1\", \"artifact2\"]'"
3431
+ )
3432
+ if option_flag.name == "metadata":
3433
+ try:
3434
+ metadata = json.loads(option_arg)
3435
+ if not isinstance(metadata, list):
3436
+ raise ValueError
3437
+ except Exception as e:
3438
+ raise WrongArgumentError(
3439
+ "Metadata must be a JSON list of strings: '[\"meta1\", \"meta2\"]'"
3440
+ )
3441
+
3442
+ if not name:
3443
+ raise MissingRequirementException("Name must be specified.")
3444
+
3445
+ client = AgenticProcessClient(project_id=project_id)
3446
+ result = client.create_kb(
3447
+ name=name,
3448
+ artifacts=artifacts,
3449
+ metadata=metadata
3450
+ )
3451
+ Console.write_stdout(f"Created knowledge base detail: \n{result}")
3452
+
3453
+
3454
+ create_kb_options = [
3455
+ PROJECT_ID_OPTION,
3456
+ Option(
3457
+ "name",
3458
+ ["--name", "-n"],
3459
+ "Name of the knowledge base",
3460
+ True
3461
+ ),
3462
+ Option(
3463
+ "artifacts",
3464
+ ["--artifacts", "-a"],
3465
+ "List of artifact names in JSON format: '[\"artifact1\", \"artifact2\"]'. Optional.",
3466
+ True
3467
+ ),
3468
+ Option(
3469
+ "metadata",
3470
+ ["--metadata", "-m"],
3471
+ "List of metadata fields in JSON format: '[\"meta1\", \"meta2\"]'. Optional.",
3472
+ True
3473
+ ),
3474
+ ]
3475
+
3476
+
3477
+ def get_kb(option_list: list):
3478
+ project_id = None
3479
+ kb_id = None
3480
+ kb_name = None
3481
+
3482
+ for option_flag, option_arg in option_list:
3483
+ if option_flag.name == "project_id":
3484
+ project_id = option_arg
3485
+ if option_flag.name == "kb_id":
3486
+ kb_id = option_arg
3487
+ if option_flag.name == "kb_name":
3488
+ kb_name = option_arg
3489
+
3490
+ if not (kb_id or kb_name):
3491
+ raise MissingRequirementException("Either KB ID or KB name must be specified.")
3492
+
3493
+ client = AgenticProcessClient(project_id=project_id)
3494
+ result = client.get_kb(
3495
+ kb_id=kb_id,
3496
+ kb_name=kb_name
3497
+ )
3498
+ Console.write_stdout(f"Knowledge base detail: \n{result}")
3499
+
3500
+
3501
+ get_kb_options = [
3502
+ PROJECT_ID_OPTION,
3503
+ Option(
3504
+ "kb_id",
3505
+ ["--kb-id", "--kid"],
3506
+ "ID of the knowledge base to retrieve (optional if kb_name is provided)",
3507
+ True
3508
+ ),
3509
+ Option(
3510
+ "kb_name",
3511
+ ["--kb-name", "--kn"],
3512
+ "Name of the knowledge base to retrieve (optional if kb_id is provided)",
3513
+ True
3514
+ ),
3515
+ ]
3516
+
3517
+
3518
+ def list_kbs(option_list: list):
3519
+ project_id = None
3520
+ name = None
3521
+ start = "0"
3522
+ count = "100"
3523
+
3524
+ for option_flag, option_arg in option_list:
3525
+ if option_flag.name == "project_id":
3526
+ project_id = option_arg
3527
+ if option_flag.name == "name":
3528
+ name = option_arg
3529
+ if option_flag.name == "start":
3530
+ start = option_arg
3531
+ if option_flag.name == "count":
3532
+ count = option_arg
3533
+
3534
+ client = AgenticProcessClient(project_id=project_id)
3535
+ result = client.list_kbs(
3536
+ name=name,
3537
+ start=start,
3538
+ count=count
3539
+ )
3540
+ Console.write_stdout(f"Knowledge base list: \n{result}")
3541
+
3542
+
3543
+ list_kbs_options = [
3544
+ PROJECT_ID_OPTION,
3545
+ Option(
3546
+ "name",
3547
+ ["--name", "-n"],
3548
+ "Name of the knowledge base to filter by (optional)",
3549
+ True
3550
+ ),
3551
+ Option(
3552
+ "start",
3553
+ ["--start"],
3554
+ "Starting index for pagination. Defaults to '0'.",
3555
+ True
3556
+ ),
3557
+ Option(
3558
+ "count",
3559
+ ["--count"],
3560
+ "Number of knowledge bases to retrieve. Defaults to '100'.",
3561
+ True
3562
+ ),
3563
+ ]
3564
+
3565
+
3566
+ def delete_kb(option_list: list):
3567
+ project_id = None
3568
+ kb_id = None
3569
+ kb_name = None
3570
+
3571
+ for option_flag, option_arg in option_list:
3572
+ if option_flag.name == "project_id":
3573
+ project_id = option_arg
3574
+ if option_flag.name == "kb_id":
3575
+ kb_id = option_arg
3576
+ if option_flag.name == "kb_name":
3577
+ kb_name = option_arg
3578
+
3579
+ if not (kb_id or kb_name):
3580
+ raise MissingRequirementException("Either KB ID or KB name must be specified.")
3581
+
3582
+ client = AgenticProcessClient(project_id=project_id)
3583
+ result = client.delete_kb(
3584
+ kb_id=kb_id,
3585
+ kb_name=kb_name
3586
+ )
3587
+ Console.write_stdout(f"Delete knowledge base result: \n{result}")
3588
+
3589
+
3590
+ delete_kb_options = [
3591
+ PROJECT_ID_OPTION,
3592
+ Option(
3593
+ "kb_id",
3594
+ ["--kb-id", "--kid"],
3595
+ "ID of the knowledge base to delete (optional if kb_name is provided)",
3596
+ True
3597
+ ),
3598
+ Option(
3599
+ "kb_name",
3600
+ ["--kb-name", "--kn"],
3601
+ "Name of the knowledge base to delete (optional if kb_id is provided)",
3602
+ True
3603
+ ),
3604
+ ]
3605
+
3606
+ # JOBS
3607
+
3608
+
3609
+ def list_jobs(option_list: list):
3610
+ project_id = None
3611
+ start = "0"
3612
+ count = "100"
3613
+ topic = None
3614
+ token = None
3615
+ name = None
3616
+
3617
+ for option_flag, option_arg in option_list:
3618
+ if option_flag.name == "project_id":
3619
+ project_id = option_arg
3620
+ if option_flag.name == "start":
3621
+ start = option_arg
3622
+ if option_flag.name == "count":
3623
+ count = option_arg
3624
+ if option_flag.name == "topic":
3625
+ topic = option_arg
3626
+ if option_flag.name == "token":
3627
+ token = option_arg
3628
+ if option_flag.name == "name":
3629
+ name = option_arg
3630
+
3631
+ client = AgenticProcessClient(project_id=project_id)
3632
+ result = client.list_jobs(
3633
+ start=start,
3634
+ count=count,
3635
+ topic=topic,
3636
+ token=token,
3637
+ name=name
3638
+ )
3639
+ Console.write_stdout(f"Job list: \n{result}")
3640
+
3641
+
3642
+ list_jobs_options = [
3643
+ PROJECT_ID_OPTION,
3644
+ Option(
3645
+ "start",
3646
+ ["--start", "-s"],
3647
+ "Starting index for pagination. Defaults to '0'.",
3648
+ True
3649
+ ),
3650
+ Option(
3651
+ "count",
3652
+ ["--count", "-c"],
3653
+ "Number of jobs to retrieve. Defaults to '100'.",
3654
+ True
3655
+ ),
3656
+ Option(
3657
+ "topic",
3658
+ ["--topic"],
3659
+ "Topic of the jobs to filter by (optional).",
3660
+ True
3661
+ ),
3662
+ Option(
3663
+ "token",
3664
+ ["--token", "-t"],
3665
+ "Token of the jobs to filter by (optional).",
3666
+ True
3667
+ ),
3668
+ Option(
3669
+ "name",
3670
+ ["--name", "-n"],
3671
+ "Name of the jobs to filter by (optional).",
3672
+ True
3673
+ )
3674
+ ]
3675
+ # COMMANDS
3676
+
3677
+
3678
+ ai_lab_commands = [
3679
+ Command(
3680
+ "help",
3681
+ ["help", "h"],
3682
+ "Display help text",
3683
+ show_help,
3684
+ ArgumentsEnum.NOT_AVAILABLE,
3685
+ [],
3686
+ []
3687
+ ),
3688
+ # Agents
3689
+ Command(
3690
+ "list_agents",
3691
+ ["list-agents", "la"],
3692
+ "List agents",
3693
+ list_agents,
3694
+ ArgumentsEnum.REQUIRED,
3695
+ [],
3696
+ list_agents_options
3697
+ ),
3698
+ Command(
3699
+ "create_agent",
3700
+ ["create-agent", "ca"],
3701
+ "Create agent",
3702
+ create_agent,
3703
+ ArgumentsEnum.REQUIRED,
3704
+ [],
3705
+ create_agent_options
3706
+ ),
3707
+ Command(
3708
+ "get_agent",
3709
+ ["get-agent", "ga"],
3710
+ "Get agent",
3711
+ get_agent,
3712
+ ArgumentsEnum.REQUIRED,
3713
+ [],
3714
+ get_agent_options
3715
+ ),
3716
+ Command(
3717
+ "export_agent",
3718
+ ["export-agent", "ea"],
3719
+ "Export agent",
3720
+ export_agent,
3721
+ ArgumentsEnum.REQUIRED,
3722
+ [],
3723
+ export_agent_options
3724
+ ),
3725
+ Command(
3726
+ "import_agent",
3727
+ ["import-agent", "ia"],
3728
+ "Import agent",
3729
+ import_agent,
3730
+ ArgumentsEnum.REQUIRED,
3731
+ [],
3732
+ import_agent_options
3733
+ ),
3734
+ Command(
3735
+ "create_sharing_link",
3736
+ ["create-sharing-link", "csl"],
3737
+ "Create sharing link",
3738
+ create_sharing_link,
3739
+ ArgumentsEnum.REQUIRED,
3740
+ [],
3741
+ create_sharing_link_options
3742
+ ),
3743
+ Command(
3744
+ "publish_agent_revision",
3745
+ ["publish-agent-revision", "par"],
3746
+ "Publish agent revision",
3747
+ publish_agent_revision,
3748
+ ArgumentsEnum.REQUIRED,
3749
+ [],
3750
+ publish_agent_revision_options
3751
+ ),
3752
+ Command(
3753
+ "delete_agent",
3754
+ ["delete-agent", "da"],
3755
+ "Delete agent",
3756
+ delete_agent,
3757
+ ArgumentsEnum.REQUIRED,
3758
+ [],
3759
+ delete_agent_options
3760
+ ),
3761
+ Command(
3762
+ "update_agent",
3763
+ ["update-agent", "ua"],
3764
+ "Update agent by ID or name",
3765
+ update_agent,
3766
+ ArgumentsEnum.REQUIRED,
3767
+ [],
3768
+ update_agent_options
3769
+ ),
3770
+ # Tools
3771
+ Command(
3772
+ "create_tool",
3773
+ ["create-tool", "ct"],
3774
+ "Create tool",
3775
+ create_tool,
3776
+ ArgumentsEnum.REQUIRED,
3777
+ [],
3778
+ create_tool_options
3779
+ ),
3780
+ Command(
3781
+ "list_tools",
3782
+ ["list-tools", "lt"],
3783
+ "List tools",
3784
+ list_tools,
3785
+ ArgumentsEnum.REQUIRED,
3786
+ [],
3787
+ list_tools_options
3788
+ ),
3789
+ Command(
3790
+ "get_tool",
3791
+ ["get-tool", "gt"],
3792
+ "Get tool",
3793
+ get_tool,
3794
+ ArgumentsEnum.REQUIRED,
3795
+ [],
3796
+ get_tool_options
3797
+ ),
3798
+ #Command(
3799
+ # "export_tool",
3800
+ # ["export-tool", "et"],
3801
+ # "Export tool",
3802
+ # export_tool,
3803
+ # ArgumentsEnum.REQUIRED,
3804
+ # [],
3805
+ # export_tool_options
3806
+ #),
3807
+ Command(
3808
+ "delete_tool",
3809
+ ["delete-tool", "dt"],
3810
+ "Delete tool",
3811
+ delete_tool,
3812
+ ArgumentsEnum.REQUIRED,
3813
+ [],
3814
+ delete_tool_options
3815
+ ),
3816
+ Command(
3817
+ "update_tool",
3818
+ ["update-tool", "ut"],
3819
+ "Update tool",
3820
+ update_tool,
3821
+ ArgumentsEnum.REQUIRED,
3822
+ [],
3823
+ update_tool_options
3824
+ ),
3825
+ Command(
3826
+ "publish_tool_revision",
3827
+ ["publish-tool-revision", "ptr"],
3828
+ "Publish tool revision",
3829
+ publish_tool_revision,
3830
+ ArgumentsEnum.REQUIRED,
3831
+ [],
3832
+ publish_tool_revision_options
3833
+ ),
3834
+ Command(
3835
+ "get_parameter",
3836
+ ["get-parameter", "gp"],
3837
+ "Get tool parameter",
3838
+ get_parameter,
3839
+ ArgumentsEnum.REQUIRED,
3840
+ [],
3841
+ get_parameter_options
3842
+ ),
3843
+ Command(
3844
+ "set_parameter",
3845
+ ["set-parameter", "sp"],
3846
+ "Set tool parameter",
3847
+ set_parameter,
3848
+ ArgumentsEnum.REQUIRED,
3849
+ [],
3850
+ set_parameter_options
3851
+ ),
3852
+ # reasoning-strategies
3853
+ Command(
3854
+ "list_reasoning_strategies",
3855
+ ["list-reasoning-strategies", "lrs"],
3856
+ "List reasoning strategies",
3857
+ list_reasoning_strategies,
3858
+ ArgumentsEnum.REQUIRED,
3859
+ [],
3860
+ list_reasoning_strategies_options
3861
+ ),
3862
+ Command(
3863
+ "create_reasoning_strategy",
3864
+ ["create-reasoning-strategy", "crs"],
3865
+ "Create reasoning strategy",
3866
+ create_reasoning_strategy,
3867
+ ArgumentsEnum.REQUIRED,
3868
+ [],
3869
+ create_reasoning_strategy_options
3870
+ ),
3871
+ Command(
3872
+ "update_reasoning_strategy",
3873
+ ["update-reasoning-strategy", "urs"],
3874
+ "Update reasoning strategy",
3875
+ update_reasoning_strategy,
3876
+ ArgumentsEnum.REQUIRED,
3877
+ [],
3878
+ update_reasoning_strategy_options
3879
+ ),
3880
+ Command(
3881
+ "get_reasoning_strategy",
3882
+ ["get-reasoning-strategy", "grs"],
3883
+ "Get reasoning strategy",
3884
+ get_reasoning_strategy,
3885
+ ArgumentsEnum.REQUIRED,
3886
+ [],
3887
+ get_reasoning_strategy_options
3888
+ ),
3889
+ # Agentic process definition
3890
+ # processes
3891
+ Command(
3892
+ "create_process",
3893
+ ["create-process", "cp"],
3894
+ "Create process",
3895
+ create_process,
3896
+ ArgumentsEnum.REQUIRED,
3897
+ [],
3898
+ create_process_options
3899
+ ),
3900
+ Command(
3901
+ "update_process",
3902
+ ["update-process", "up"],
3903
+ "Update process",
3904
+ update_process,
3905
+ ArgumentsEnum.REQUIRED,
3906
+ [],
3907
+ update_process_options
3908
+ ),
3909
+ Command(
3910
+ "get_process",
3911
+ ["get-process", "gp"],
3912
+ "Get process",
3913
+ get_process,
3914
+ ArgumentsEnum.REQUIRED,
3915
+ [],
3916
+ get_process_options
3917
+ ),
3918
+ Command(
3919
+ "list_processes",
3920
+ ["list-processes", "lp"],
3921
+ "List processes",
3922
+ list_processes,
3923
+ ArgumentsEnum.REQUIRED,
3924
+ [],
3925
+ list_processes_options
3926
+ ),
3927
+ Command(
3928
+ "list_processes_instances",
3929
+ ["list-processes-instances", "lpi"],
3930
+ "List processes instances",
3931
+ list_processes_instances,
3932
+ ArgumentsEnum.REQUIRED,
3933
+ [],
3934
+ list_processes_instances_options
3935
+ ),
3936
+ Command(
3937
+ "delete_process",
3938
+ ["delete-process", "dp"],
3939
+ "Delete process",
3940
+ delete_process,
3941
+ ArgumentsEnum.REQUIRED,
3942
+ [],
3943
+ delete_process_options
3944
+ ),
3945
+ Command(
3946
+ "publish_process_revision",
3947
+ ["publish-process-revision", "ppr"],
3948
+ "Publish process revision",
3949
+ publish_process_revision,
3950
+ ArgumentsEnum.REQUIRED,
3951
+ [],
3952
+ publish_process_revision_options
3953
+ ),
3954
+ # tasks
3955
+ Command(
3956
+ "create_task",
3957
+ ["create-task", "ctsk"],
3958
+ "Create task",
3959
+ create_task,
3960
+ ArgumentsEnum.REQUIRED,
3961
+ [],
3962
+ create_task_options
3963
+ ),
3964
+ Command(
3965
+ "get_task",
3966
+ ["get-task", "gtsk"],
3967
+ "Get task",
3968
+ get_task,
3969
+ ArgumentsEnum.REQUIRED,
3970
+ [],
3971
+ get_task_options
3972
+ ),
3973
+ Command(
3974
+ "list_tasks",
3975
+ ["list-tasks", "ltsk"],
3976
+ "List tasks",
3977
+ list_tasks,
3978
+ ArgumentsEnum.REQUIRED,
3979
+ [],
3980
+ list_tasks_options
3981
+ ),
3982
+ Command(
3983
+ "update_task",
3984
+ ["update-task", "utsk"],
3985
+ "Update task",
3986
+ update_task,
3987
+ ArgumentsEnum.REQUIRED,
3988
+ [],
3989
+ update_task_options
3990
+ ),
3991
+ Command(
3992
+ "delete_task",
3993
+ ["delete-task", "dtsk"],
3994
+ "Delete task",
3995
+ delete_task,
3996
+ ArgumentsEnum.REQUIRED,
3997
+ [],
3998
+ delete_task_options
3999
+ ),
4000
+ Command(
4001
+ "publish_task_revision",
4002
+ ["publish-task-revision", "ptskr"],
4003
+ "Publish task revision",
4004
+ publish_task_revision,
4005
+ ArgumentsEnum.REQUIRED,
4006
+ [],
4007
+ publish_task_revision_options
4008
+ ),
4009
+ # process instances
4010
+ Command(
4011
+ "start_instance",
4012
+ ["start-instance", "si"],
4013
+ "Start process instance",
4014
+ start_instance,
4015
+ ArgumentsEnum.REQUIRED,
4016
+ [],
4017
+ start_instance_options
4018
+ ),
4019
+ Command(
4020
+ "abort_instance",
4021
+ ["abort-instance", "ai"],
4022
+ "Abort process instance",
4023
+ abort_instance,
4024
+ ArgumentsEnum.REQUIRED,
4025
+ [],
4026
+ abort_instance_options
4027
+ ),
4028
+ Command(
4029
+ "get_instance",
4030
+ ["get-instance", "gi"],
4031
+ "Get process instance",
4032
+ get_instance,
4033
+ ArgumentsEnum.REQUIRED,
4034
+ [],
4035
+ get_instance_options
4036
+ ),
4037
+ Command(
4038
+ "get_instance_history",
4039
+ ["get-instance-history", "gih"],
4040
+ "Get process instance history",
4041
+ get_instance_history,
4042
+ ArgumentsEnum.REQUIRED,
4043
+ [],
4044
+ get_instance_history_options
4045
+ ),
4046
+ Command(
4047
+ "get_thread_information",
4048
+ ["get-thread-information", "gti"],
4049
+ "Get thread information",
4050
+ get_thread_information,
4051
+ ArgumentsEnum.REQUIRED,
4052
+ [],
4053
+ get_thread_information_options
4054
+ ),
4055
+ Command(
4056
+ "send_user_signal",
4057
+ ["send-user-signal", "sus"],
4058
+ "Send user signal to process instance",
4059
+ send_user_signal,
4060
+ ArgumentsEnum.REQUIRED,
4061
+ [],
4062
+ send_user_signal_options
4063
+ ),
4064
+ # knowledge bases
4065
+ Command(
4066
+ "create_kb",
4067
+ ["create-kb", "ckb"],
4068
+ "Create knowledge base",
4069
+ create_kb,
4070
+ ArgumentsEnum.REQUIRED,
4071
+ [],
4072
+ create_kb_options
4073
+ ),
4074
+ Command(
4075
+ "get_kb",
4076
+ ["get-kb", "gkb"],
4077
+ "Get knowledge base",
4078
+ get_kb,
4079
+ ArgumentsEnum.REQUIRED,
4080
+ [],
4081
+ get_kb_options
4082
+ ),
4083
+ Command(
4084
+ "list_kbs",
4085
+ ["list-kbs", "lkb"],
4086
+ "List knowledge bases",
4087
+ list_kbs,
4088
+ ArgumentsEnum.REQUIRED,
4089
+ [],
4090
+ list_kbs_options
4091
+ ),
4092
+ Command(
4093
+ "delete_kb",
4094
+ ["delete-kb", "dkb"],
4095
+ "Delete knowledge base",
4096
+ delete_kb,
4097
+ ArgumentsEnum.REQUIRED,
4098
+ [],
4099
+ delete_kb_options
4100
+ ),
4101
+ Command(
4102
+ "list_jobs",
4103
+ ["list-jobs", "lj"],
4104
+ "List runtime jobs",
4105
+ list_jobs,
4106
+ ArgumentsEnum.REQUIRED,
4107
+ [],
4108
+ list_jobs_options
4109
+ ),
4110
+ ]