pygeai 0.3.2__py3-none-any.whl → 0.4.0__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.
Files changed (45) hide show
  1. pygeai/__init__.py +1 -1
  2. pygeai/chat/ui.py +0 -1
  3. pygeai/cli/__init__.py +1 -1
  4. pygeai/cli/commands/chat.py +54 -56
  5. pygeai/cli/commands/lab/ai_lab.py +129 -466
  6. pygeai/cli/commands/lab/options.py +8 -0
  7. pygeai/cli/commands/lab/utils.py +13 -0
  8. pygeai/cli/geai.py +5 -2
  9. pygeai/cli/texts/help.py +12 -0
  10. pygeai/core/common/config.py +0 -2
  11. pygeai/core/common/exceptions.py +6 -0
  12. pygeai/lab/agents/clients.py +30 -61
  13. pygeai/lab/clients.py +20 -0
  14. pygeai/lab/managers.py +6 -58
  15. pygeai/lab/processes/clients.py +81 -129
  16. pygeai/lab/strategies/clients.py +11 -17
  17. pygeai/lab/tools/clients.py +59 -59
  18. pygeai/tests/integration/assistants/__init__.py +0 -0
  19. pygeai/tests/integration/assistants/rag/__init__.py +0 -0
  20. pygeai/tests/integration/assistants/rag/test_create_rag.py +72 -0
  21. pygeai/tests/integration/chat/__init__.py +0 -0
  22. pygeai/tests/integration/chat/test_generate_image.py +162 -0
  23. pygeai/tests/integration/lab/agents/test_create_agent.py +9 -13
  24. pygeai/tests/integration/lab/agents/test_publish_agent_revision.py +0 -1
  25. pygeai/tests/integration/lab/agents/test_update_agent.py +6 -15
  26. pygeai/tests/integration/lab/tools/__init__.py +0 -0
  27. pygeai/tests/integration/lab/tools/test_create_tool.py +292 -0
  28. pygeai/tests/integration/lab/tools/test_delete_tool.py +87 -0
  29. pygeai/tests/integration/lab/tools/test_get_parameter.py +98 -0
  30. pygeai/tests/integration/lab/tools/test_get_tool.py +91 -0
  31. pygeai/tests/integration/lab/tools/test_list_tools.py +106 -0
  32. pygeai/tests/integration/lab/tools/test_publish_tool_revision.py +119 -0
  33. pygeai/tests/integration/lab/tools/test_set_parameter.py +114 -0
  34. pygeai/tests/integration/lab/tools/test_update_tool.py +268 -0
  35. pygeai/tests/snippets/lab/agents/create_agent_edge_case.py +48 -0
  36. pygeai/tests/snippets/lab/agents/create_agent_without_instructions.py +48 -0
  37. pygeai/tests/snippets/lab/agents/get_sharing_link.py +1 -2
  38. pygeai/tests/snippets/lab/tools/create_tool.py +1 -1
  39. pygeai/tests/snippets/lab/tools/create_tool_edge_case.py +50 -0
  40. {pygeai-0.3.2.dist-info → pygeai-0.4.0.dist-info}/METADATA +1 -1
  41. {pygeai-0.3.2.dist-info → pygeai-0.4.0.dist-info}/RECORD +45 -25
  42. {pygeai-0.3.2.dist-info → pygeai-0.4.0.dist-info}/WHEEL +0 -0
  43. {pygeai-0.3.2.dist-info → pygeai-0.4.0.dist-info}/entry_points.txt +0 -0
  44. {pygeai-0.3.2.dist-info → pygeai-0.4.0.dist-info}/licenses/LICENSE +0 -0
  45. {pygeai-0.3.2.dist-info → pygeai-0.4.0.dist-info}/top_level.txt +0 -0
@@ -9,6 +9,7 @@ from pygeai.cli.commands.lab.common import get_agent_data_prompt_inputs, get_age
9
9
  from pygeai.cli.texts.help import AI_LAB_HELP_TEXT
10
10
  from pygeai.core.common.exceptions import MissingRequirementException, WrongArgumentError
11
11
  from pygeai.core.utils.console import Console
12
+ from pygeai.cli.commands.lab.options import PROJECT_ID_OPTION
12
13
  from pygeai.lab.agents.clients import AgentClient
13
14
  from pygeai.lab.processes.clients import AgenticProcessClient
14
15
  from pygeai.lab.strategies.clients import ReasoningStrategyClient
@@ -49,12 +50,8 @@ def list_agents(option_list: list):
49
50
  if option_flag.name == "allow_external":
50
51
  allow_external = get_boolean_value(option_arg)
51
52
 
52
- if not project_id:
53
- raise MissingRequirementException("Project ID must be specified.")
54
-
55
- client = AgentClient()
53
+ client = AgentClient(project_id=project_id)
56
54
  result = client.list_agents(
57
- project_id=project_id,
58
55
  status=status,
59
56
  start=start,
60
57
  count=count,
@@ -66,12 +63,7 @@ def list_agents(option_list: list):
66
63
 
67
64
 
68
65
  list_agents_options = [
69
- Option(
70
- "project_id",
71
- ["--project-id", "--pid"],
72
- "ID of the project",
73
- True
74
- ),
66
+ PROJECT_ID_OPTION,
75
67
  Option(
76
68
  "status",
77
69
  ["--status"],
@@ -128,6 +120,7 @@ def create_agent(option_list: list):
128
120
  agent_data_llm_temperature = None
129
121
  agent_data_llm_top_k = None
130
122
  agent_data_llm_top_p = None
123
+ agent_data_strategy_name = None
131
124
  agent_data_model_name = None
132
125
  agent_data_resource_pools = None
133
126
  automatic_publish = False
@@ -202,6 +195,8 @@ def create_agent(option_list: list):
202
195
  agent_data_llm_top_k = option_arg
203
196
  if option_flag.name == "agent_data_llm_top_p":
204
197
  agent_data_llm_top_p = option_arg
198
+ if option_flag.name == "agent_data_strategy_name":
199
+ agent_data_strategy_name = option_arg
205
200
  if option_flag.name == "agent_data_model_name":
206
201
  agent_data_model_name = option_arg
207
202
  if option_flag.name == "agent_data_resource_pools":
@@ -218,8 +213,6 @@ def create_agent(option_list: list):
218
213
  if option_flag.name == "automatic_publish":
219
214
  automatic_publish = get_boolean_value(option_arg)
220
215
 
221
- if not project_id:
222
- raise MissingRequirementException("Project ID must be specified.")
223
216
  if not (name and access_scope and public_name):
224
217
  raise MissingRequirementException("Cannot create assistant without specifying name, access scope and public name")
225
218
 
@@ -246,9 +239,8 @@ def create_agent(option_list: list):
246
239
  {"name": agent_data_model_name}
247
240
  ]
248
241
 
249
- client = AgentClient()
242
+ client = AgentClient(project_id=project_id)
250
243
  result = client.create_agent(
251
- project_id=project_id,
252
244
  name=name,
253
245
  access_scope=access_scope,
254
246
  public_name=public_name,
@@ -257,6 +249,7 @@ def create_agent(option_list: list):
257
249
  description=description,
258
250
  agent_data_prompt=agent_data_prompt,
259
251
  agent_data_llm_config=agent_data_llm_config,
252
+ agent_data_strategy_name=agent_data_strategy_name,
260
253
  agent_data_models=agent_data_models,
261
254
  agent_data_resource_pools=agent_data_resource_pools,
262
255
  automatic_publish=automatic_publish
@@ -265,12 +258,7 @@ def create_agent(option_list: list):
265
258
 
266
259
 
267
260
  create_agent_options = [
268
- Option(
269
- "project_id",
270
- ["--project-id", "--pid"],
271
- "Unique identifier of the project where the agent will be created",
272
- True
273
- ),
261
+ PROJECT_ID_OPTION,
274
262
  Option(
275
263
  "name",
276
264
  ["--name", "-n"],
@@ -362,6 +350,12 @@ create_agent_options = [
362
350
  "TopP sampling parameter for LLM (currently unused)",
363
351
  True
364
352
  ),
353
+ Option(
354
+ "agent_data_strategy_name",
355
+ ["--agent-data-strategy-name", "--strategy-name"],
356
+ "Name of the reasoning strategy to use",
357
+ True
358
+ ),
365
359
  Option(
366
360
  "agent_data_model_name",
367
361
  ["--agent-data-model-name", "--adm-name"],
@@ -403,12 +397,11 @@ def get_agent(option_list: list):
403
397
  if option_flag.name == "allow_drafts":
404
398
  allow_drafts = get_boolean_value(option_arg)
405
399
 
406
- if not (project_id and agent_id):
407
- raise MissingRequirementException("Project ID and Agent id must be specified.")
400
+ if not agent_id:
401
+ raise MissingRequirementException("Agent ID must be specified.")
408
402
 
409
- client = AgentClient()
403
+ client = AgentClient(project_id=project_id)
410
404
  result = client.get_agent(
411
- project_id=project_id,
412
405
  agent_id=agent_id,
413
406
  revision=revision,
414
407
  version=version,
@@ -418,12 +411,7 @@ def get_agent(option_list: list):
418
411
 
419
412
 
420
413
  get_agent_options = [
421
- Option(
422
- "project_id",
423
- ["--project-id", "--pid"],
424
- "ID of the project",
425
- True
426
- ),
414
+ PROJECT_ID_OPTION,
427
415
  Option(
428
416
  "agent_id",
429
417
  ["--agent-id", "--aid"],
@@ -464,13 +452,11 @@ def export_agent(option_list: list):
464
452
  if option_flag.name == "file":
465
453
  file = option_arg
466
454
 
455
+ if not agent_id:
456
+ raise MissingRequirementException("Agent ID must be specified.")
467
457
 
468
- if not (project_id and agent_id):
469
- raise MissingRequirementException("Project ID and Agent id must be specified.")
470
-
471
- client = AgentClient()
458
+ client = AgentClient(project_id=project_id)
472
459
  result = client.export_agent(
473
- project_id=project_id,
474
460
  agent_id=agent_id,
475
461
  )
476
462
  if file:
@@ -488,12 +474,7 @@ def export_agent(option_list: list):
488
474
 
489
475
 
490
476
  export_agent_options = [
491
- Option(
492
- "project_id",
493
- ["--project-id", "--pid"],
494
- "ID of the project",
495
- True
496
- ),
477
+ PROJECT_ID_OPTION,
497
478
  Option(
498
479
  "agent_id",
499
480
  ["--agent-id", "--aid"],
@@ -520,8 +501,8 @@ def import_agent(option_list: list):
520
501
  file = option_arg
521
502
 
522
503
 
523
- if not (project_id and file):
524
- raise MissingRequirementException("Project ID and file path to spec must be specified.")
504
+ if not file:
505
+ raise MissingRequirementException("File path to spec must be specified.")
525
506
 
526
507
  try:
527
508
  with open(file, "r") as f:
@@ -530,9 +511,8 @@ def import_agent(option_list: list):
530
511
  logger.error(f"File is not in JSON format: {e}")
531
512
  Console.write_stderr(f"File is not in JSON format.")
532
513
 
533
- client = AgentClient()
514
+ client = AgentClient(project_id=project_id)
534
515
  result = client.import_agent(
535
- project_id=project_id,
536
516
  data=agent_data
537
517
  )
538
518
 
@@ -541,12 +521,7 @@ def import_agent(option_list: list):
541
521
 
542
522
 
543
523
  import_agent_options = [
544
- Option(
545
- "project_id",
546
- ["--project-id", "--pid"],
547
- "ID of the project",
548
- True
549
- ),
524
+ PROJECT_ID_OPTION,
550
525
  Option(
551
526
  "file",
552
527
  ["--file", "-f"],
@@ -566,24 +541,18 @@ def create_sharing_link(option_list: list):
566
541
  if option_flag.name == "agent_id":
567
542
  agent_id = option_arg
568
543
 
569
- if not (project_id and agent_id):
570
- raise MissingRequirementException("Project ID and Agent id must be specified.")
544
+ if not agent_id:
545
+ raise MissingRequirementException("Agent ID must be specified.")
571
546
 
572
- client = AgentClient()
547
+ client = AgentClient(project_id=project_id)
573
548
  result = client.create_sharing_link(
574
- project_id=project_id,
575
549
  agent_id=agent_id,
576
550
  )
577
551
  Console.write_stdout(f"Sharing token: \n{result}")
578
552
 
579
553
 
580
554
  create_sharing_link_options = [
581
- Option(
582
- "project_id",
583
- ["--project-id", "--pid"],
584
- "ID of the project",
585
- True
586
- ),
555
+ PROJECT_ID_OPTION,
587
556
  Option(
588
557
  "agent_id",
589
558
  ["--agent-id", "--aid"],
@@ -606,12 +575,11 @@ def publish_agent_revision(option_list: list):
606
575
  if option_flag.name == "revision":
607
576
  revision = option_arg
608
577
 
609
- if not (project_id and agent_id and revision):
610
- raise MissingRequirementException("Project ID, Agent ID and revision must be specified.")
578
+ if not (agent_id and revision):
579
+ raise MissingRequirementException("Agent ID and revision must be specified.")
611
580
 
612
- client = AgentClient()
581
+ client = AgentClient(project_id=project_id)
613
582
  result = client.publish_agent_revision(
614
- project_id=project_id,
615
583
  agent_id=agent_id,
616
584
  revision=revision
617
585
  )
@@ -619,12 +587,7 @@ def publish_agent_revision(option_list: list):
619
587
 
620
588
 
621
589
  publish_agent_revision_options = [
622
- Option(
623
- "project_id",
624
- ["--project-id", "--pid"],
625
- "ID of the project",
626
- True
627
- ),
590
+ PROJECT_ID_OPTION,
628
591
  Option(
629
592
  "agent_id",
630
593
  ["--agent-id", "--aid"],
@@ -650,24 +613,18 @@ def delete_agent(option_list: list):
650
613
  if option_flag.name == "agent_id":
651
614
  agent_id = option_arg
652
615
 
653
- if not (project_id and agent_id):
654
- raise MissingRequirementException("Project ID and Agent ID must be specified.")
616
+ if not agent_id:
617
+ raise MissingRequirementException("Agent ID must be specified.")
655
618
 
656
- client = AgentClient()
619
+ client = AgentClient(project_id=project_id)
657
620
  result = client.delete_agent(
658
- project_id=project_id,
659
621
  agent_id=agent_id,
660
622
  )
661
623
  Console.write_stdout(f"Deleted agent detail: \n{result}")
662
624
 
663
625
 
664
626
  delete_agent_options = [
665
- Option(
666
- "project_id",
667
- ["--project-id", "--pid"],
668
- "ID of the project",
669
- True
670
- ),
627
+ PROJECT_ID_OPTION,
671
628
  Option(
672
629
  "agent_id",
673
630
  ["--agent-id", "--aid"],
@@ -695,6 +652,7 @@ def update_agent(option_list: list):
695
652
  agent_data_llm_temperature = None
696
653
  agent_data_llm_top_k = None
697
654
  agent_data_llm_top_p = None
655
+ agent_data_strategy_name = None
698
656
  agent_data_model_name = None
699
657
  agent_data_resource_pools = None
700
658
  automatic_publish = False
@@ -771,7 +729,9 @@ def update_agent(option_list: list):
771
729
  if option_flag.name == "agent_data_llm_top_k":
772
730
  agent_data_llm_top_k = option_arg
773
731
  if option_flag.name == "agent_data_llm_top_p":
774
- agent_data_llm_top_p = option_arg
732
+ agent_data_llm_top_k = option_arg
733
+ if option_flag.name == "agent_data_strategy_name":
734
+ agent_data_strategy_name = option_arg
775
735
  if option_flag.name == "agent_data_model_name":
776
736
  agent_data_model_name = option_arg
777
737
  if option_flag.name == "agent_data_resource_pools":
@@ -790,9 +750,6 @@ def update_agent(option_list: list):
790
750
  if option_flag.name == "upsert":
791
751
  upsert = get_boolean_value(option_arg)
792
752
 
793
- if not project_id:
794
- raise MissingRequirementException("Project ID must be specified.")
795
-
796
753
  if not (name and access_scope and public_name):
797
754
  raise MissingRequirementException("Cannot update assistant without specifying name, access scope and public name")
798
755
 
@@ -819,9 +776,8 @@ def update_agent(option_list: list):
819
776
  {"name": agent_data_model_name}
820
777
  ]
821
778
 
822
- client = AgentClient()
779
+ client = AgentClient(project_id=project_id)
823
780
  result = client.update_agent(
824
- project_id=project_id,
825
781
  agent_id=agent_id,
826
782
  name=name,
827
783
  access_scope=access_scope,
@@ -831,6 +787,7 @@ def update_agent(option_list: list):
831
787
  description=description,
832
788
  agent_data_prompt=agent_data_prompt,
833
789
  agent_data_llm_config=agent_data_llm_config,
790
+ agent_data_strategy_name=agent_data_strategy_name,
834
791
  agent_data_models=agent_data_models,
835
792
  agent_data_resource_pools=agent_data_resource_pools,
836
793
  automatic_publish=automatic_publish,
@@ -840,12 +797,7 @@ def update_agent(option_list: list):
840
797
 
841
798
 
842
799
  update_agent_options = [
843
- Option(
844
- "project_id",
845
- ["--project-id", "--pid"],
846
- "Unique identifier of the project where the agent will be created",
847
- True
848
- ),
800
+ PROJECT_ID_OPTION,
849
801
  Option(
850
802
  "agent_id",
851
803
  ["--agent-id", "--aid"],
@@ -943,6 +895,12 @@ update_agent_options = [
943
895
  "TopP sampling parameter for LLM (currently unused)",
944
896
  True
945
897
  ),
898
+ Option(
899
+ "agent_data_strategy_name",
900
+ ["--agent-data-strategy-name", "--strategy-name"],
901
+ "Name of the reasoning strategy to use",
902
+ True
903
+ ),
946
904
  Option(
947
905
  "agent_data_model_name",
948
906
  ["--agent-data-model-name", "--adm-name"],
@@ -1030,8 +988,6 @@ def create_tool(option_list: list):
1030
988
  if option_flag.name == "automatic_publish":
1031
989
  automatic_publish = get_boolean_value(option_arg)
1032
990
 
1033
- if not project_id:
1034
- raise MissingRequirementException("Project ID must be specified.")
1035
991
  if not name:
1036
992
  raise MissingRequirementException("Tool name must be specified.")
1037
993
  if access_scope == "public" and not public_name:
@@ -1043,9 +999,8 @@ def create_tool(option_list: list):
1043
999
 
1044
1000
  tool_parameters = get_tool_parameters(parameters)
1045
1001
 
1046
- client = ToolClient()
1002
+ client = ToolClient(project_id=project_id)
1047
1003
  result = client.create_tool(
1048
- project_id=project_id,
1049
1004
  name=name,
1050
1005
  description=description,
1051
1006
  scope=scope,
@@ -1062,12 +1017,7 @@ def create_tool(option_list: list):
1062
1017
 
1063
1018
 
1064
1019
  create_tool_options = [
1065
- Option(
1066
- "project_id",
1067
- ["--project-id", "--pid"],
1068
- "Unique identifier of the project where the tool will be created",
1069
- True
1070
- ),
1020
+ PROJECT_ID_OPTION,
1071
1021
  Option(
1072
1022
  "name",
1073
1023
  ["--name", "-n"],
@@ -1162,15 +1112,11 @@ def list_tools(option_list: list):
1162
1112
  if option_flag.name == "allow_external":
1163
1113
  allow_external = get_boolean_value(option_arg)
1164
1114
 
1165
- if not project_id:
1166
- raise MissingRequirementException("Project ID must be specified.")
1167
-
1168
1115
  if scope and scope not in VALID_SCOPES:
1169
1116
  raise ValueError(f"Scope must be one of {', '.join(VALID_SCOPES)}.")
1170
1117
 
1171
- client = ToolClient()
1118
+ client = ToolClient(project_id=project_id)
1172
1119
  result = client.list_tools(
1173
- project_id=project_id,
1174
1120
  id=id,
1175
1121
  count=count,
1176
1122
  access_scope=access_scope,
@@ -1182,12 +1128,7 @@ def list_tools(option_list: list):
1182
1128
 
1183
1129
 
1184
1130
  list_tools_options = [
1185
- Option(
1186
- "project_id",
1187
- ["--project-id", "--pid"],
1188
- "ID of the project",
1189
- True
1190
- ),
1131
+ PROJECT_ID_OPTION,
1191
1132
  Option(
1192
1133
  "id",
1193
1134
  ["--id"],
@@ -1246,12 +1187,11 @@ def get_tool(option_list: list):
1246
1187
  if option_flag.name == "allow_drafts":
1247
1188
  allow_drafts = get_boolean_value(option_arg)
1248
1189
 
1249
- if not (project_id and tool_id):
1250
- raise MissingRequirementException("Project ID and Tool id must be specified.")
1190
+ if not tool_id:
1191
+ raise MissingRequirementException("Tool ID must be specified.")
1251
1192
 
1252
- client = ToolClient()
1193
+ client = ToolClient(project_id=project_id)
1253
1194
  result = client.get_tool(
1254
- project_id=project_id,
1255
1195
  tool_id=tool_id,
1256
1196
  revision=revision,
1257
1197
  version=version,
@@ -1261,12 +1201,7 @@ def get_tool(option_list: list):
1261
1201
 
1262
1202
 
1263
1203
  get_tool_options = [
1264
- Option(
1265
- "project_id",
1266
- ["--project-id", "--pid"],
1267
- "ID of the project",
1268
- True
1269
- ),
1204
+ PROJECT_ID_OPTION,
1270
1205
  Option(
1271
1206
  "tool_id",
1272
1207
  ["--tool-id", "--tid"],
@@ -1308,12 +1243,11 @@ def export_tool(option_list: list):
1308
1243
  file = option_arg
1309
1244
 
1310
1245
 
1311
- if not (project_id and tool_id):
1312
- raise MissingRequirementException("Project ID and Tool id must be specified.")
1246
+ if not tool_id:
1247
+ raise MissingRequirementException("Tool ID must be specified.")
1313
1248
 
1314
- client = ToolClient()
1249
+ client = ToolClient(project_id=project_id)
1315
1250
  result = client.export_tool(
1316
- project_id=project_id,
1317
1251
  tool_id=tool_id,
1318
1252
  )
1319
1253
  Console.write_stdout(f"Tool spec: \n{result}")
@@ -1330,12 +1264,7 @@ def export_tool(option_list: list):
1330
1264
 
1331
1265
 
1332
1266
  export_tool_options = [
1333
- Option(
1334
- "project_id",
1335
- ["--project-id", "--pid"],
1336
- "ID of the project",
1337
- True
1338
- ),
1267
+ PROJECT_ID_OPTION,
1339
1268
  Option(
1340
1269
  "tool_id",
1341
1270
  ["--tool-id", "--tid"],
@@ -1360,17 +1289,16 @@ def delete_tool(option_list: list):
1360
1289
  for option_flag, option_arg in option_list:
1361
1290
  if option_flag.name == "project_id":
1362
1291
  project_id = option_arg
1363
- elif option_flag.name == "tool_id":
1292
+ if option_flag.name == "tool_id":
1364
1293
  tool_id = option_arg
1365
1294
  elif option_flag.name == "tool_name":
1366
1295
  tool_name = option_arg
1367
1296
 
1368
- if not project_id or not (tool_id or tool_name):
1369
- raise MissingRequirementException("Project ID and either Tool ID or Tool Name must be specified.")
1297
+ if not (tool_id or tool_name):
1298
+ raise MissingRequirementException("Either Tool ID or Tool Name must be specified.")
1370
1299
 
1371
- client = ToolClient()
1300
+ client = ToolClient(project_id=project_id)
1372
1301
  result = client.delete_tool(
1373
- project_id=project_id,
1374
1302
  tool_id=tool_id,
1375
1303
  tool_name=tool_name
1376
1304
  )
@@ -1378,12 +1306,7 @@ def delete_tool(option_list: list):
1378
1306
 
1379
1307
 
1380
1308
  delete_tool_options = [
1381
- Option(
1382
- "project_id",
1383
- ["--project-id", "--pid"],
1384
- "ID of the project",
1385
- True
1386
- ),
1309
+ PROJECT_ID_OPTION,
1387
1310
  Option(
1388
1311
  "tool_id",
1389
1312
  ["--tool-id", "--tid"],
@@ -1463,8 +1386,6 @@ def update_tool(option_list: list):
1463
1386
  if option_flag.name == "upsert":
1464
1387
  upsert = get_boolean_value(option_arg)
1465
1388
 
1466
- if not project_id:
1467
- raise MissingRequirementException("Project ID must be specified.")
1468
1389
  if not tool_id:
1469
1390
  raise MissingRequirementException("Tool ID must be specified.")
1470
1391
  if access_scope == "public" and not public_name:
@@ -1476,9 +1397,8 @@ def update_tool(option_list: list):
1476
1397
 
1477
1398
  tool_parameters = get_tool_parameters(parameters)
1478
1399
 
1479
- client = ToolClient()
1400
+ client = ToolClient(project_id=project_id)
1480
1401
  result = client.update_tool(
1481
- project_id=project_id,
1482
1402
  tool_id=tool_id,
1483
1403
  name=name,
1484
1404
  description=description,
@@ -1497,12 +1417,7 @@ def update_tool(option_list: list):
1497
1417
 
1498
1418
 
1499
1419
  update_tool_options = [
1500
- Option(
1501
- "project_id",
1502
- ["--project-id", "--pid"],
1503
- "Unique identifier of the project containing the tool",
1504
- True
1505
- ),
1420
+ PROJECT_ID_OPTION,
1506
1421
  Option(
1507
1422
  "tool_id",
1508
1423
  ["--tool-id", "--tid"],
@@ -1597,12 +1512,11 @@ def publish_tool_revision(option_list: list):
1597
1512
  if option_flag.name == "revision":
1598
1513
  revision = option_arg
1599
1514
 
1600
- if not (project_id and tool_id and revision):
1601
- raise MissingRequirementException("Project ID, Tool ID and revision must be specified.")
1515
+ if not (tool_id and revision):
1516
+ raise MissingRequirementException("Tool ID and revision must be specified.")
1602
1517
 
1603
- client = ToolClient()
1518
+ client = ToolClient(project_id=project_id)
1604
1519
  result = client.publish_tool_revision(
1605
- project_id=project_id,
1606
1520
  tool_id=tool_id,
1607
1521
  revision=revision
1608
1522
  )
@@ -1610,12 +1524,7 @@ def publish_tool_revision(option_list: list):
1610
1524
 
1611
1525
 
1612
1526
  publish_tool_revision_options = [
1613
- Option(
1614
- "project_id",
1615
- ["--project-id", "--pid"],
1616
- "ID of the project",
1617
- True
1618
- ),
1527
+ PROJECT_ID_OPTION,
1619
1528
  Option(
1620
1529
  "tool_id",
1621
1530
  ["--tool-id", "--tid"],
@@ -1653,12 +1562,11 @@ def get_parameter(option_list: list):
1653
1562
  if option_flag.name == "version":
1654
1563
  version = option_arg
1655
1564
 
1656
- if not (project_id and (tool_public_name or tool_id)):
1657
- raise MissingRequirementException("Project ID and Tool public name or ID must be specified.")
1565
+ if not (tool_public_name or tool_id):
1566
+ raise MissingRequirementException("Tool public name or ID must be specified.")
1658
1567
 
1659
- client = ToolClient()
1568
+ client = ToolClient(project_id=project_id)
1660
1569
  result = client.get_parameter(
1661
- project_id=project_id,
1662
1570
  tool_id=tool_id,
1663
1571
  tool_public_name=tool_public_name,
1664
1572
  revision=revision,
@@ -1669,12 +1577,7 @@ def get_parameter(option_list: list):
1669
1577
 
1670
1578
 
1671
1579
  get_parameter_options = [
1672
- Option(
1673
- "project_id",
1674
- ["--project-id", "--pid"],
1675
- "ID of the project",
1676
- True
1677
- ),
1580
+ PROJECT_ID_OPTION,
1678
1581
  Option(
1679
1582
  "tool_id",
1680
1583
  ["--tool-id", "--tid"],
@@ -1736,8 +1639,6 @@ def set_parameter(option_list: list):
1736
1639
  "\"isRequired\": true, \"type\": \"config\", \"fromSecret\": false, \"value\": \"config_value\"}'"
1737
1640
  )
1738
1641
 
1739
- if not project_id:
1740
- raise MissingRequirementException("Project ID must be specified.")
1741
1642
  if not (tool_public_name or tool_id):
1742
1643
  raise MissingRequirementException("Tool public name or ID must be specified.")
1743
1644
  if not parameters:
@@ -1745,9 +1646,8 @@ def set_parameter(option_list: list):
1745
1646
 
1746
1647
  tool_parameters = get_tool_parameters(parameters)
1747
1648
 
1748
- client = ToolClient()
1649
+ client = ToolClient(project_id=project_id)
1749
1650
  result = client.set_parameter(
1750
- project_id=project_id,
1751
1651
  tool_id=tool_id,
1752
1652
  tool_public_name=tool_public_name,
1753
1653
  parameters=tool_parameters
@@ -1756,12 +1656,7 @@ def set_parameter(option_list: list):
1756
1656
 
1757
1657
 
1758
1658
  set_parameter_options = [
1759
- Option(
1760
- "project_id",
1761
- ["--project-id", "--pid"],
1762
- "ID of the project",
1763
- True
1764
- ),
1659
+ PROJECT_ID_OPTION,
1765
1660
  Option(
1766
1661
  "tool_id",
1767
1662
  ["--tool-id", "--tid"],
@@ -1860,7 +1755,6 @@ list_reasoning_strategies_options = [
1860
1755
 
1861
1756
 
1862
1757
  def create_reasoning_strategy(option_list: list):
1863
- project_id = None
1864
1758
  name = None
1865
1759
  system_prompt = None
1866
1760
  access_scope = "public"
@@ -1869,8 +1763,6 @@ def create_reasoning_strategy(option_list: list):
1869
1763
  automatic_publish = False
1870
1764
 
1871
1765
  for option_flag, option_arg in option_list:
1872
- if option_flag.name == "project_id":
1873
- project_id = option_arg
1874
1766
  if option_flag.name == "name":
1875
1767
  name = option_arg
1876
1768
  if option_flag.name == "system_prompt":
@@ -1893,8 +1785,6 @@ def create_reasoning_strategy(option_list: list):
1893
1785
  if option_flag.name == "automatic_publish":
1894
1786
  automatic_publish = get_boolean_value(option_arg)
1895
1787
 
1896
- if not project_id:
1897
- raise MissingRequirementException("Project ID must be specified.")
1898
1788
  if not name:
1899
1789
  raise MissingRequirementException("Name must be specified.")
1900
1790
  if not system_prompt:
@@ -1914,7 +1804,6 @@ def create_reasoning_strategy(option_list: list):
1914
1804
 
1915
1805
  client = ReasoningStrategyClient()
1916
1806
  result = client.create_reasoning_strategy(
1917
- project_id=project_id,
1918
1807
  name=name,
1919
1808
  system_prompt=system_prompt,
1920
1809
  access_scope=access_scope,
@@ -1926,12 +1815,6 @@ def create_reasoning_strategy(option_list: list):
1926
1815
 
1927
1816
 
1928
1817
  create_reasoning_strategy_options = [
1929
- Option(
1930
- "project_id",
1931
- ["--project-id", "--pid"],
1932
- "ID of the project",
1933
- True
1934
- ),
1935
1818
  Option(
1936
1819
  "name",
1937
1820
  ["--name", "-n"],
@@ -1974,7 +1857,6 @@ create_reasoning_strategy_options = [
1974
1857
 
1975
1858
 
1976
1859
  def update_reasoning_strategy(option_list: list):
1977
- project_id = None
1978
1860
  reasoning_strategy_id = None
1979
1861
  name = None
1980
1862
  system_prompt = None
@@ -1985,8 +1867,6 @@ def update_reasoning_strategy(option_list: list):
1985
1867
  upsert = False
1986
1868
 
1987
1869
  for option_flag, option_arg in option_list:
1988
- if option_flag.name == "project_id":
1989
- project_id = option_arg
1990
1870
  if option_flag.name == "reasoning_strategy_id":
1991
1871
  reasoning_strategy_id = option_arg
1992
1872
  if option_flag.name == "name":
@@ -2014,8 +1894,6 @@ def update_reasoning_strategy(option_list: list):
2014
1894
  # upsert = get_boolean_value(option_arg)
2015
1895
  Console.write_stdout("Upsert is not yet supported for reasoning strategies. Coming soon.")
2016
1896
 
2017
- if not project_id:
2018
- raise MissingRequirementException("Project ID must be specified.")
2019
1897
  if not reasoning_strategy_id:
2020
1898
  raise MissingRequirementException("Reasoning strategy ID must be specified.")
2021
1899
 
@@ -2035,7 +1913,6 @@ def update_reasoning_strategy(option_list: list):
2035
1913
 
2036
1914
  client = ReasoningStrategyClient()
2037
1915
  result = client.update_reasoning_strategy(
2038
- project_id=project_id,
2039
1916
  reasoning_strategy_id=reasoning_strategy_id,
2040
1917
  name=name,
2041
1918
  system_prompt=system_prompt,
@@ -2049,12 +1926,6 @@ def update_reasoning_strategy(option_list: list):
2049
1926
 
2050
1927
 
2051
1928
  update_reasoning_strategy_options = [
2052
- Option(
2053
- "project_id",
2054
- ["--project-id", "--pid"],
2055
- "ID of the project",
2056
- True
2057
- ),
2058
1929
  Option(
2059
1930
  "reasoning_strategy_id",
2060
1931
  ["--reasoning-strategy-id", "--rsid"],
@@ -2109,26 +1980,20 @@ update_reasoning_strategy_options = [
2109
1980
 
2110
1981
 
2111
1982
  def get_reasoning_strategy(option_list: list):
2112
- project_id = None
2113
1983
  reasoning_strategy_id = None
2114
1984
  reasoning_strategy_name = None
2115
1985
 
2116
1986
  for option_flag, option_arg in option_list:
2117
- if option_flag.name == "project_id":
2118
- project_id = option_arg
2119
1987
  if option_flag.name == "reasoning_strategy_id":
2120
1988
  reasoning_strategy_id = option_arg
2121
1989
  if option_flag.name == "reasoning_strategy_name":
2122
1990
  reasoning_strategy_name = option_arg
2123
1991
 
2124
- if not project_id:
2125
- raise MissingRequirementException("Project ID must be specified.")
2126
1992
  if not (reasoning_strategy_id or reasoning_strategy_name):
2127
1993
  raise MissingRequirementException("Either reasoning strategy ID or name must be specified.")
2128
1994
 
2129
1995
  client = ReasoningStrategyClient()
2130
1996
  result = client.get_reasoning_strategy(
2131
- project_id=project_id,
2132
1997
  reasoning_strategy_id=reasoning_strategy_id,
2133
1998
  reasoning_strategy_name=reasoning_strategy_name
2134
1999
  )
@@ -2136,12 +2001,6 @@ def get_reasoning_strategy(option_list: list):
2136
2001
 
2137
2002
 
2138
2003
  get_reasoning_strategy_options = [
2139
- Option(
2140
- "project_id",
2141
- ["--project-id", "--pid"],
2142
- "ID of the project",
2143
- True
2144
- ),
2145
2004
  Option(
2146
2005
  "reasoning_strategy_id",
2147
2006
  ["--reasoning-strategy-id", "--rsid"],
@@ -2264,16 +2123,13 @@ def create_process(option_list: list):
2264
2123
  if option_flag.name == "automatic_publish":
2265
2124
  automatic_publish = get_boolean_value(option_arg)
2266
2125
 
2267
- if not project_id:
2268
- raise MissingRequirementException("Project ID must be specified.")
2269
2126
  if not key:
2270
2127
  raise MissingRequirementException("Key must be specified.")
2271
2128
  if not name:
2272
2129
  raise MissingRequirementException("Name must be specified.")
2273
2130
 
2274
- client = AgenticProcessClient()
2131
+ client = AgenticProcessClient(project_id=project_id)
2275
2132
  result = client.create_process(
2276
- project_id=project_id,
2277
2133
  key=key,
2278
2134
  name=name,
2279
2135
  description=description,
@@ -2290,12 +2146,7 @@ def create_process(option_list: list):
2290
2146
 
2291
2147
 
2292
2148
  create_process_options = [
2293
- Option(
2294
- "project_id",
2295
- ["--project-id", "--pid"],
2296
- "ID of the project",
2297
- True
2298
- ),
2149
+ PROJECT_ID_OPTION,
2299
2150
  Option(
2300
2151
  "key",
2301
2152
  ["--key", "-k"],
@@ -2489,14 +2340,11 @@ def update_process(option_list: list):
2489
2340
  if option_flag.name == "upsert":
2490
2341
  upsert = get_boolean_value(option_arg)
2491
2342
 
2492
- if not project_id:
2493
- raise MissingRequirementException("Project ID must be specified.")
2494
2343
  if not (process_id or name):
2495
2344
  raise MissingRequirementException("Either process ID or name must be specified.")
2496
2345
 
2497
- client = AgenticProcessClient()
2346
+ client = AgenticProcessClient(project_id=project_id)
2498
2347
  result = client.update_process(
2499
- project_id=project_id,
2500
2348
  process_id=process_id,
2501
2349
  name=name,
2502
2350
  key=key,
@@ -2515,12 +2363,7 @@ def update_process(option_list: list):
2515
2363
 
2516
2364
 
2517
2365
  update_process_options = [
2518
- Option(
2519
- "project_id",
2520
- ["--project-id", "--pid"],
2521
- "ID of the project",
2522
- True
2523
- ),
2366
+ PROJECT_ID_OPTION,
2524
2367
  Option(
2525
2368
  "process_id",
2526
2369
  ["--process-id", "--pid"],
@@ -2638,14 +2481,11 @@ def get_process(option_list: list):
2638
2481
  if option_flag.name == "allow_drafts":
2639
2482
  allow_drafts = get_boolean_value(option_arg)
2640
2483
 
2641
- if not project_id:
2642
- raise MissingRequirementException("Project ID must be specified.")
2643
2484
  if not (process_id or process_name):
2644
2485
  raise MissingRequirementException("Either process ID or process name must be specified.")
2645
2486
 
2646
- client = AgenticProcessClient()
2487
+ client = AgenticProcessClient(project_id=project_id)
2647
2488
  result = client.get_process(
2648
- project_id=project_id,
2649
2489
  process_id=process_id,
2650
2490
  process_name=process_name,
2651
2491
  revision=revision,
@@ -2656,12 +2496,7 @@ def get_process(option_list: list):
2656
2496
 
2657
2497
 
2658
2498
  get_process_options = [
2659
- Option(
2660
- "project_id",
2661
- ["--project-id", "--pid"],
2662
- "ID of the project",
2663
- True
2664
- ),
2499
+ PROJECT_ID_OPTION,
2665
2500
  Option(
2666
2501
  "process_id",
2667
2502
  ["--process-id", "--pid"],
@@ -2720,12 +2555,8 @@ def list_processes(option_list: list):
2720
2555
  if option_flag.name == "allow_draft":
2721
2556
  allow_draft = get_boolean_value(option_arg)
2722
2557
 
2723
- if not project_id:
2724
- raise MissingRequirementException("Project ID must be specified.")
2725
-
2726
- client = AgenticProcessClient()
2558
+ client = AgenticProcessClient(project_id=project_id)
2727
2559
  result = client.list_processes(
2728
- project_id=project_id,
2729
2560
  id=id,
2730
2561
  name=name,
2731
2562
  status=status,
@@ -2737,12 +2568,7 @@ def list_processes(option_list: list):
2737
2568
 
2738
2569
 
2739
2570
  list_processes_options = [
2740
- Option(
2741
- "project_id",
2742
- ["--project-id", "--pid"],
2743
- "ID of the project",
2744
- True
2745
- ),
2571
+ PROJECT_ID_OPTION,
2746
2572
  Option(
2747
2573
  "id",
2748
2574
  ["--id"],
@@ -2801,14 +2627,11 @@ def list_processes_instances(option_list: list):
2801
2627
  if option_flag.name == "count":
2802
2628
  count = option_arg
2803
2629
 
2804
- if not project_id:
2805
- raise MissingRequirementException("Project ID must be specified.")
2806
2630
  if not process_id:
2807
2631
  raise MissingRequirementException("Process ID must be specified.")
2808
2632
 
2809
- client = AgenticProcessClient()
2633
+ client = AgenticProcessClient(project_id=project_id)
2810
2634
  result = client.list_process_instances(
2811
- project_id=project_id,
2812
2635
  process_id=process_id,
2813
2636
  is_active=is_active,
2814
2637
  start=start,
@@ -2818,12 +2641,7 @@ def list_processes_instances(option_list: list):
2818
2641
 
2819
2642
 
2820
2643
  list_processes_instances_options = [
2821
- Option(
2822
- "project_id",
2823
- ["--project-id", "--pid"],
2824
- "ID of the project",
2825
- True
2826
- ),
2644
+ PROJECT_ID_OPTION,
2827
2645
  Option(
2828
2646
  "process_id",
2829
2647
  ["--process-id", "--pid"],
@@ -2864,14 +2682,11 @@ def delete_process(option_list: list):
2864
2682
  if option_flag.name == "process_name":
2865
2683
  process_name = option_arg
2866
2684
 
2867
- if not project_id:
2868
- raise MissingRequirementException("Project ID must be specified.")
2869
2685
  if not (process_id or process_name):
2870
2686
  raise MissingRequirementException("Either process ID or process name must be specified.")
2871
2687
 
2872
- client = AgenticProcessClient()
2688
+ client = AgenticProcessClient(project_id=project_id)
2873
2689
  result = client.delete_process(
2874
- project_id=project_id,
2875
2690
  process_id=process_id,
2876
2691
  process_name=process_name
2877
2692
  )
@@ -2879,12 +2694,7 @@ def delete_process(option_list: list):
2879
2694
 
2880
2695
 
2881
2696
  delete_process_options = [
2882
- Option(
2883
- "project_id",
2884
- ["--project-id", "--pid"],
2885
- "ID of the project",
2886
- True
2887
- ),
2697
+ PROJECT_ID_OPTION,
2888
2698
  Option(
2889
2699
  "process_id",
2890
2700
  ["--process-id", "--pid"],
@@ -2916,16 +2726,13 @@ def publish_process_revision(option_list: list):
2916
2726
  if option_flag.name == "revision":
2917
2727
  revision = option_arg
2918
2728
 
2919
- if not project_id:
2920
- raise MissingRequirementException("Project ID must be specified.")
2921
2729
  if not (process_id or process_name):
2922
2730
  raise MissingRequirementException("Either process ID or process name must be specified.")
2923
2731
  if not revision:
2924
2732
  raise MissingRequirementException("Revision must be specified.")
2925
2733
 
2926
- client = AgenticProcessClient()
2734
+ client = AgenticProcessClient(project_id=project_id)
2927
2735
  result = client.publish_process_revision(
2928
- project_id=project_id,
2929
2736
  process_id=process_id,
2930
2737
  process_name=process_name,
2931
2738
  revision=revision
@@ -2934,12 +2741,7 @@ def publish_process_revision(option_list: list):
2934
2741
 
2935
2742
 
2936
2743
  publish_process_revision_options = [
2937
- Option(
2938
- "project_id",
2939
- ["--project-id", "--pid"],
2940
- "ID of the project",
2941
- True
2942
- ),
2744
+ PROJECT_ID_OPTION,
2943
2745
  Option(
2944
2746
  "process_id",
2945
2747
  ["--process-id", "--pid"],
@@ -3002,14 +2804,11 @@ def create_task(option_list: list):
3002
2804
  if option_flag.name == "automatic_publish":
3003
2805
  automatic_publish = get_boolean_value(option_arg)
3004
2806
 
3005
- if not project_id:
3006
- raise MissingRequirementException("Project ID must be specified.")
3007
2807
  if not name:
3008
2808
  raise MissingRequirementException("Task name must be specified.")
3009
2809
 
3010
- client = AgenticProcessClient()
2810
+ client = AgenticProcessClient(project_id=project_id)
3011
2811
  result = client.create_task(
3012
- project_id=project_id,
3013
2812
  name=name,
3014
2813
  description=description,
3015
2814
  title_template=title_template,
@@ -3022,12 +2821,7 @@ def create_task(option_list: list):
3022
2821
 
3023
2822
 
3024
2823
  create_task_options = [
3025
- Option(
3026
- "project_id",
3027
- ["--project-id", "--pid"],
3028
- "ID of the project",
3029
- True
3030
- ),
2824
+ PROJECT_ID_OPTION,
3031
2825
  Option(
3032
2826
  "name",
3033
2827
  ["--name", "-n"],
@@ -3086,14 +2880,11 @@ def get_task(option_list: list):
3086
2880
  if option_flag.name == "task_name":
3087
2881
  task_name = option_arg
3088
2882
 
3089
- if not project_id:
3090
- raise MissingRequirementException("Project ID must be specified.")
3091
2883
  if not (task_id or task_name):
3092
2884
  raise MissingRequirementException("Either task ID or task name must be specified.")
3093
2885
 
3094
- client = AgenticProcessClient()
2886
+ client = AgenticProcessClient(project_id=project_id)
3095
2887
  result = client.get_task(
3096
- project_id=project_id,
3097
2888
  task_id=task_id,
3098
2889
  task_name=task_name
3099
2890
  )
@@ -3101,12 +2892,7 @@ def get_task(option_list: list):
3101
2892
 
3102
2893
 
3103
2894
  get_task_options = [
3104
- Option(
3105
- "project_id",
3106
- ["--project-id", "--pid"],
3107
- "ID of the project",
3108
- True
3109
- ),
2895
+ PROJECT_ID_OPTION,
3110
2896
  Option(
3111
2897
  "task_id",
3112
2898
  ["--task-id", "--tid"],
@@ -3141,12 +2927,8 @@ def list_tasks(option_list: list):
3141
2927
  if option_flag.name == "allow_drafts":
3142
2928
  allow_drafts = get_boolean_value(option_arg)
3143
2929
 
3144
- if not project_id:
3145
- raise MissingRequirementException("Project ID must be specified.")
3146
-
3147
- client = AgenticProcessClient()
2930
+ client = AgenticProcessClient(project_id=project_id)
3148
2931
  result = client.list_tasks(
3149
- project_id=project_id,
3150
2932
  id=id,
3151
2933
  start=start,
3152
2934
  count=count,
@@ -3156,12 +2938,7 @@ def list_tasks(option_list: list):
3156
2938
 
3157
2939
 
3158
2940
  list_tasks_options = [
3159
- Option(
3160
- "project_id",
3161
- ["--project-id", "--pid"],
3162
- "ID of the project",
3163
- True
3164
- ),
2941
+ PROJECT_ID_OPTION,
3165
2942
  Option(
3166
2943
  "id",
3167
2944
  ["--id"],
@@ -3233,14 +3010,11 @@ def update_task(option_list: list):
3233
3010
  if option_flag.name == "upsert":
3234
3011
  upsert = get_boolean_value(option_arg)
3235
3012
 
3236
- if not project_id:
3237
- raise MissingRequirementException("Project ID must be specified.")
3238
3013
  if not (task_id or name):
3239
3014
  raise MissingRequirementException("Either task ID or name must be specified.")
3240
3015
 
3241
- client = AgenticProcessClient()
3016
+ client = AgenticProcessClient(project_id=project_id)
3242
3017
  result = client.update_task(
3243
- project_id=project_id,
3244
3018
  task_id=task_id,
3245
3019
  name=name,
3246
3020
  description=description,
@@ -3255,12 +3029,7 @@ def update_task(option_list: list):
3255
3029
 
3256
3030
 
3257
3031
  update_task_options = [
3258
- Option(
3259
- "project_id",
3260
- ["--project-id", "--pid"],
3261
- "ID of the project",
3262
- True
3263
- ),
3032
+ PROJECT_ID_OPTION,
3264
3033
  Option(
3265
3034
  "task_id",
3266
3035
  ["--task-id", "--tid"],
@@ -3331,14 +3100,11 @@ def delete_task(option_list: list):
3331
3100
  if option_flag.name == "task_name":
3332
3101
  task_name = option_arg
3333
3102
 
3334
- if not project_id:
3335
- raise MissingRequirementException("Project ID must be specified.")
3336
3103
  if not (task_id or task_name):
3337
3104
  raise MissingRequirementException("Either task ID or task name must be specified.")
3338
3105
 
3339
- client = AgenticProcessClient()
3106
+ client = AgenticProcessClient(project_id=project_id)
3340
3107
  result = client.delete_task(
3341
- project_id=project_id,
3342
3108
  task_id=task_id,
3343
3109
  task_name = task_name
3344
3110
  )
@@ -3346,12 +3112,7 @@ def delete_task(option_list: list):
3346
3112
 
3347
3113
 
3348
3114
  delete_task_options = [
3349
- Option(
3350
- "project_id",
3351
- ["--project-id", "--pid"],
3352
- "ID of the project",
3353
- True
3354
- ),
3115
+ PROJECT_ID_OPTION,
3355
3116
  Option(
3356
3117
  "task_id",
3357
3118
  ["--task-id", "--tid"],
@@ -3383,16 +3144,13 @@ def publish_task_revision(option_list: list):
3383
3144
  if option_flag.name == "revision":
3384
3145
  revision = option_arg
3385
3146
 
3386
- if not project_id:
3387
- raise MissingRequirementException("Project ID must be specified.")
3388
3147
  if not (task_id or task_name):
3389
3148
  raise MissingRequirementException("Either task ID or task name must be specified.")
3390
3149
  if not revision:
3391
3150
  raise MissingRequirementException("Revision must be specified.")
3392
3151
 
3393
- client = AgenticProcessClient()
3152
+ client = AgenticProcessClient(project_id=project_id)
3394
3153
  result = client.publish_task_revision(
3395
- project_id=project_id,
3396
3154
  task_id=task_id,
3397
3155
  task_name=task_name,
3398
3156
  revision=revision
@@ -3401,12 +3159,7 @@ def publish_task_revision(option_list: list):
3401
3159
 
3402
3160
 
3403
3161
  publish_task_revision_options = [
3404
- Option(
3405
- "project_id",
3406
- ["--project-id", "--pid"],
3407
- "ID of the project",
3408
- True
3409
- ),
3162
+ PROJECT_ID_OPTION,
3410
3163
  Option(
3411
3164
  "task_id",
3412
3165
  ["--task-id", "--tid"],
@@ -3452,14 +3205,11 @@ def start_instance(option_list: list):
3452
3205
  "Variables must be a JSON list: '[{\"key\": \"location\", \"value\": \"Paris\"}]'"
3453
3206
  )
3454
3207
 
3455
- if not project_id:
3456
- raise MissingRequirementException("Project ID must be specified.")
3457
3208
  if not process_name:
3458
3209
  raise MissingRequirementException("Process name must be specified.")
3459
3210
 
3460
- client = AgenticProcessClient()
3211
+ client = AgenticProcessClient(project_id=project_id)
3461
3212
  result = client.start_instance(
3462
- project_id=project_id,
3463
3213
  process_name=process_name,
3464
3214
  subject=subject,
3465
3215
  variables=variables
@@ -3468,12 +3218,7 @@ def start_instance(option_list: list):
3468
3218
 
3469
3219
 
3470
3220
  start_instance_options = [
3471
- Option(
3472
- "project_id",
3473
- ["--project-id", "--pid"],
3474
- "ID of the project",
3475
- True
3476
- ),
3221
+ PROJECT_ID_OPTION,
3477
3222
  Option(
3478
3223
  "process_name",
3479
3224
  ["--process-name", "--pn"],
@@ -3505,26 +3250,18 @@ def abort_instance(option_list: list):
3505
3250
  if option_flag.name == "instance_id":
3506
3251
  instance_id = option_arg
3507
3252
 
3508
- if not project_id:
3509
- raise MissingRequirementException("Project ID must be specified.")
3510
3253
  if not instance_id:
3511
3254
  raise MissingRequirementException("Instance ID must be specified.")
3512
3255
 
3513
- client = AgenticProcessClient()
3256
+ client = AgenticProcessClient(project_id=project_id)
3514
3257
  result = client.abort_instance(
3515
- project_id=project_id,
3516
3258
  instance_id=instance_id
3517
3259
  )
3518
3260
  Console.write_stdout(f"Abort instance result: \n{result}")
3519
3261
 
3520
3262
 
3521
3263
  abort_instance_options = [
3522
- Option(
3523
- "project_id",
3524
- ["--project-id", "--pid"],
3525
- "ID of the project",
3526
- True
3527
- ),
3264
+ PROJECT_ID_OPTION,
3528
3265
  Option(
3529
3266
  "instance_id",
3530
3267
  ["--instance-id", "--iid"],
@@ -3544,26 +3281,18 @@ def get_instance(option_list: list):
3544
3281
  if option_flag.name == "instance_id":
3545
3282
  instance_id = option_arg
3546
3283
 
3547
- if not project_id:
3548
- raise MissingRequirementException("Project ID must be specified.")
3549
3284
  if not instance_id:
3550
3285
  raise MissingRequirementException("Instance ID must be specified.")
3551
3286
 
3552
- client = AgenticProcessClient()
3287
+ client = AgenticProcessClient(project_id=project_id)
3553
3288
  result = client.get_instance(
3554
- project_id=project_id,
3555
3289
  instance_id=instance_id
3556
3290
  )
3557
3291
  Console.write_stdout(f"Instance detail: \n{result}")
3558
3292
 
3559
3293
 
3560
3294
  get_instance_options = [
3561
- Option(
3562
- "project_id",
3563
- ["--project-id", "--pid"],
3564
- "ID of the project",
3565
- True
3566
- ),
3295
+ PROJECT_ID_OPTION,
3567
3296
  Option(
3568
3297
  "instance_id",
3569
3298
  ["--instance-id", "--iid"],
@@ -3583,26 +3312,18 @@ def get_instance_history(option_list: list):
3583
3312
  if option_flag.name == "instance_id":
3584
3313
  instance_id = option_arg
3585
3314
 
3586
- if not project_id:
3587
- raise MissingRequirementException("Project ID must be specified.")
3588
3315
  if not instance_id:
3589
3316
  raise MissingRequirementException("Instance ID must be specified.")
3590
3317
 
3591
- client = AgenticProcessClient()
3318
+ client = AgenticProcessClient(project_id=project_id)
3592
3319
  result = client.get_instance_history(
3593
- project_id=project_id,
3594
3320
  instance_id=instance_id
3595
3321
  )
3596
3322
  Console.write_stdout(f"Instance history: \n{result}")
3597
3323
 
3598
3324
 
3599
3325
  get_instance_history_options = [
3600
- Option(
3601
- "project_id",
3602
- ["--project-id", "--pid"],
3603
- "ID of the project",
3604
- True
3605
- ),
3326
+ PROJECT_ID_OPTION,
3606
3327
  Option(
3607
3328
  "instance_id",
3608
3329
  ["--instance-id", "--iid"],
@@ -3621,26 +3342,18 @@ def get_thread_information(option_list: list):
3621
3342
  if option_flag.name == "thread_id":
3622
3343
  thread_id = option_arg
3623
3344
 
3624
- if not project_id:
3625
- raise MissingRequirementException("Project ID must be specified.")
3626
3345
  if not thread_id:
3627
3346
  raise MissingRequirementException("Thread ID must be specified.")
3628
3347
 
3629
- client = AgenticProcessClient()
3348
+ client = AgenticProcessClient(project_id=project_id)
3630
3349
  result = client.get_thread_information(
3631
- project_id=project_id,
3632
3350
  thread_id=thread_id
3633
3351
  )
3634
3352
  Console.write_stdout(f"Thread information: \n{result}")
3635
3353
 
3636
3354
 
3637
3355
  get_thread_information_options = [
3638
- Option(
3639
- "project_id",
3640
- ["--project-id", "--pid"],
3641
- "ID of the project",
3642
- True
3643
- ),
3356
+ PROJECT_ID_OPTION,
3644
3357
  Option(
3645
3358
  "thread_id",
3646
3359
  ["--thread-id", "--tid"],
@@ -3663,16 +3376,13 @@ def send_user_signal(option_list: list):
3663
3376
  if option_flag.name == "signal_name":
3664
3377
  signal_name = option_arg
3665
3378
 
3666
- if not project_id:
3667
- raise MissingRequirementException("Project ID must be specified.")
3668
3379
  if not instance_id:
3669
3380
  raise MissingRequirementException("Instance ID must be specified.")
3670
3381
  if not signal_name:
3671
3382
  raise MissingRequirementException("Signal name must be specified.")
3672
3383
 
3673
- client = AgenticProcessClient()
3384
+ client = AgenticProcessClient(project_id=project_id)
3674
3385
  result = client.send_user_signal(
3675
- project_id=project_id,
3676
3386
  instance_id=instance_id,
3677
3387
  signal_name=signal_name
3678
3388
  )
@@ -3680,12 +3390,7 @@ def send_user_signal(option_list: list):
3680
3390
 
3681
3391
 
3682
3392
  send_user_signal_options = [
3683
- Option(
3684
- "project_id",
3685
- ["--project-id", "--pid"],
3686
- "ID of the project",
3687
- True
3688
- ),
3393
+ PROJECT_ID_OPTION,
3689
3394
  Option(
3690
3395
  "instance_id",
3691
3396
  ["--instance-id", "--iid"],
@@ -3733,14 +3438,11 @@ def create_kb(option_list: list):
3733
3438
  "Metadata must be a JSON list of strings: '[\"meta1\", \"meta2\"]'"
3734
3439
  )
3735
3440
 
3736
- if not project_id:
3737
- raise MissingRequirementException("Project ID must be specified.")
3738
3441
  if not name:
3739
3442
  raise MissingRequirementException("Name must be specified.")
3740
3443
 
3741
- client = AgenticProcessClient()
3444
+ client = AgenticProcessClient(project_id=project_id)
3742
3445
  result = client.create_kb(
3743
- project_id=project_id,
3744
3446
  name=name,
3745
3447
  artifacts=artifacts,
3746
3448
  metadata=metadata
@@ -3749,12 +3451,7 @@ def create_kb(option_list: list):
3749
3451
 
3750
3452
 
3751
3453
  create_kb_options = [
3752
- Option(
3753
- "project_id",
3754
- ["--project-id", "--pid"],
3755
- "ID of the project",
3756
- True
3757
- ),
3454
+ PROJECT_ID_OPTION,
3758
3455
  Option(
3759
3456
  "name",
3760
3457
  ["--name", "-n"],
@@ -3789,14 +3486,11 @@ def get_kb(option_list: list):
3789
3486
  if option_flag.name == "kb_name":
3790
3487
  kb_name = option_arg
3791
3488
 
3792
- if not project_id:
3793
- raise MissingRequirementException("Project ID must be specified.")
3794
3489
  if not (kb_id or kb_name):
3795
3490
  raise MissingRequirementException("Either KB ID or KB name must be specified.")
3796
3491
 
3797
- client = AgenticProcessClient()
3492
+ client = AgenticProcessClient(project_id=project_id)
3798
3493
  result = client.get_kb(
3799
- project_id=project_id,
3800
3494
  kb_id=kb_id,
3801
3495
  kb_name=kb_name
3802
3496
  )
@@ -3804,12 +3498,7 @@ def get_kb(option_list: list):
3804
3498
 
3805
3499
 
3806
3500
  get_kb_options = [
3807
- Option(
3808
- "project_id",
3809
- ["--project-id", "--pid"],
3810
- "ID of the project",
3811
- True
3812
- ),
3501
+ PROJECT_ID_OPTION,
3813
3502
  Option(
3814
3503
  "kb_id",
3815
3504
  ["--kb-id", "--kid"],
@@ -3841,12 +3530,8 @@ def list_kbs(option_list: list):
3841
3530
  if option_flag.name == "count":
3842
3531
  count = option_arg
3843
3532
 
3844
- if not project_id:
3845
- raise MissingRequirementException("Project ID must be specified.")
3846
-
3847
- client = AgenticProcessClient()
3533
+ client = AgenticProcessClient(project_id=project_id)
3848
3534
  result = client.list_kbs(
3849
- project_id=project_id,
3850
3535
  name=name,
3851
3536
  start=start,
3852
3537
  count=count
@@ -3855,12 +3540,7 @@ def list_kbs(option_list: list):
3855
3540
 
3856
3541
 
3857
3542
  list_kbs_options = [
3858
- Option(
3859
- "project_id",
3860
- ["--project-id", "--pid"],
3861
- "ID of the project",
3862
- True
3863
- ),
3543
+ PROJECT_ID_OPTION,
3864
3544
  Option(
3865
3545
  "name",
3866
3546
  ["--name", "-n"],
@@ -3895,14 +3575,11 @@ def delete_kb(option_list: list):
3895
3575
  if option_flag.name == "kb_name":
3896
3576
  kb_name = option_arg
3897
3577
 
3898
- if not project_id:
3899
- raise MissingRequirementException("Project ID must be specified.")
3900
3578
  if not (kb_id or kb_name):
3901
3579
  raise MissingRequirementException("Either KB ID or KB name must be specified.")
3902
3580
 
3903
- client = AgenticProcessClient()
3581
+ client = AgenticProcessClient(project_id=project_id)
3904
3582
  result = client.delete_kb(
3905
- project_id=project_id,
3906
3583
  kb_id=kb_id,
3907
3584
  kb_name=kb_name
3908
3585
  )
@@ -3910,12 +3587,7 @@ def delete_kb(option_list: list):
3910
3587
 
3911
3588
 
3912
3589
  delete_kb_options = [
3913
- Option(
3914
- "project_id",
3915
- ["--project-id", "--pid"],
3916
- "ID of the project",
3917
- True
3918
- ),
3590
+ PROJECT_ID_OPTION,
3919
3591
  Option(
3920
3592
  "kb_id",
3921
3593
  ["--kb-id", "--kid"],
@@ -3955,12 +3627,8 @@ def list_jobs(option_list: list):
3955
3627
  if option_flag.name == "name":
3956
3628
  name = option_arg
3957
3629
 
3958
- if not project_id:
3959
- raise MissingRequirementException("Project ID must be specified.")
3960
-
3961
- client = AgenticProcessClient()
3630
+ client = AgenticProcessClient(project_id=project_id)
3962
3631
  result = client.list_jobs(
3963
- project_id=project_id,
3964
3632
  start=start,
3965
3633
  count=count,
3966
3634
  topic=topic,
@@ -3971,12 +3639,7 @@ def list_jobs(option_list: list):
3971
3639
 
3972
3640
 
3973
3641
  list_jobs_options = [
3974
- Option(
3975
- "project_id",
3976
- ["--project-id", "--pid"],
3977
- "ID of the project",
3978
- True
3979
- ),
3642
+ PROJECT_ID_OPTION,
3980
3643
  Option(
3981
3644
  "start",
3982
3645
  ["--start", "-s"],