pygeai 0.4.0b12__py3-none-any.whl → 0.5.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 (32) hide show
  1. pygeai/__init__.py +1 -1
  2. pygeai/cli/__init__.py +1 -1
  3. pygeai/core/base/session.py +1 -1
  4. pygeai/tests/cli/docker/__init__.py +0 -0
  5. pygeai/tests/integration/assistants/rag/test_create_rag.py +24 -5
  6. pygeai/tests/integration/chat/test_generate_image.py +1 -5
  7. pygeai/tests/integration/lab/agents/test_create_agent.py +13 -7
  8. pygeai/tests/integration/lab/agents/test_create_sharing_link.py +4 -1
  9. pygeai/tests/integration/lab/agents/test_update_agent.py +15 -18
  10. pygeai/tests/integration/lab/processes/__init__.py +0 -0
  11. pygeai/tests/integration/lab/processes/test_create_process.py +345 -0
  12. pygeai/tests/integration/lab/processes/test_get_process.py +201 -0
  13. pygeai/tests/integration/lab/processes/test_update_process.py +289 -0
  14. pygeai/tests/integration/lab/reasoning_strategies/__init__.py +0 -0
  15. pygeai/tests/integration/lab/reasoning_strategies/test_get_reasoning_strategy.py +70 -0
  16. pygeai/tests/integration/lab/reasoning_strategies/test_list_reasoning_strategies.py +93 -0
  17. pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +149 -0
  18. pygeai/tests/integration/lab/tools/test_create_tool.py +12 -16
  19. pygeai/tests/integration/lab/tools/test_delete_tool.py +3 -3
  20. pygeai/tests/integration/lab/tools/test_get_tool.py +3 -3
  21. pygeai/tests/integration/lab/tools/test_update_tool.py +8 -9
  22. pygeai/tests/snippets/lab/agentic_flow_example_4.py +23 -23
  23. pygeai/tests/snippets/lab/samples/summarize_files.py +3 -3
  24. pygeai/tests/snippets/lab/use_cases/file_summarizer_example.py +3 -3
  25. pygeai/tests/snippets/lab/use_cases/file_summarizer_example_2.py +11 -11
  26. pygeai/tests/snippets/lab/use_cases/update_web_reader.py +1 -2
  27. {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/METADATA +44 -16
  28. {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/RECORD +32 -23
  29. {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/WHEEL +0 -0
  30. {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/entry_points.txt +0 -0
  31. {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/licenses/LICENSE +0 -0
  32. {pygeai-0.4.0b12.dist-info → pygeai-0.5.0.dist-info}/top_level.txt +0 -0
pygeai/__init__.py CHANGED
@@ -4,7 +4,7 @@ import sys
4
4
  from pathlib import Path
5
5
 
6
6
  __author__ = 'Globant'
7
- __version__ = '0.4.0'
7
+ __version__ = '0.5.0'
8
8
 
9
9
  # Add vendor directory to Python path
10
10
  package_root = Path(__file__).parent
pygeai/cli/__init__.py CHANGED
@@ -4,5 +4,5 @@ GEAI - ClI
4
4
  Command line interface to interact with Globant Enterprise AI.
5
5
  """
6
6
 
7
- __version__ = '0.4.0'
7
+ __version__ = '0.5.0'
8
8
 
@@ -30,7 +30,7 @@ class Session(metaclass=Singleton):
30
30
  eval_url: Optional[str] = None,
31
31
  ):
32
32
  if not api_key or not base_url:
33
- raise MissingRequirementException("Cannot instantiate session without api_key and base_url")
33
+ logger.warning("Cannot instantiate session without api_key and base_url")
34
34
 
35
35
  self.__api_key = api_key
36
36
  self.__base_url = base_url
File without changes
@@ -1,4 +1,5 @@
1
1
  from unittest import TestCase
2
+ import uuid
2
3
  from pygeai.assistant.managers import AssistantManager
3
4
  from pygeai.core.models import WelcomeData, LlmSettings
4
5
  from pygeai.assistant.rag.models import (
@@ -10,10 +11,28 @@ from pygeai.assistant.rag.models import (
10
11
  RAGAssistant,
11
12
  )
12
13
 
13
- assistant_manager = AssistantManager(alias="beta")
14
14
 
15
15
  class TestAssistantCreateRagIntegration(TestCase):
16
16
 
17
+ def setUp(self):
18
+ """
19
+ Set up the test environment.
20
+ """
21
+ self.assistant_manager = AssistantManager(alias="beta")
22
+
23
+ self.new_rag = self.__load_rag()
24
+ self.created_rag: RAGAssistant = None
25
+
26
+
27
+ def tearDown(self):
28
+ """
29
+ Clean up after each test if necessary.
30
+ This can be used to delete the created tool
31
+ """
32
+ if isinstance(self.created_rag, RAGAssistant):
33
+ self.assistant_manager.delete_assistant(assistant_name=self.created_rag.name)
34
+
35
+
17
36
  def __load_rag(self):
18
37
  llm_options = LlmSettings(
19
38
  cache=False,
@@ -57,7 +76,7 @@ class TestAssistantCreateRagIntegration(TestCase):
57
76
  )
58
77
 
59
78
  return RAGAssistant(
60
- name="Testaasdfasdfsasdfdfsdfsdf123in123g12355",
79
+ name=str(uuid.uuid4()),
61
80
  description="Test Profile with WelcomeData",
62
81
  search_options=search_options,
63
82
  index_options=index_options,
@@ -67,6 +86,6 @@ class TestAssistantCreateRagIntegration(TestCase):
67
86
 
68
87
  def test_create_rag_assistant(self):
69
88
  rag_assistant = self.__load_rag()
70
- response = assistant_manager.create_assistant(rag_assistant)
71
-
72
- self.assertIsInstance(response, RAGAssistant, "Failed to create RAG assistant")
89
+ self.created_rag = self.assistant_manager.create_assistant(rag_assistant)
90
+
91
+ self.assertIsInstance(self.created_rag, RAGAssistant, "Failed to create RAG assistant")
@@ -56,13 +56,9 @@ class TestChatGenerateImageIntegration(TestCase):
56
56
  self.new_image["model"] = ""
57
57
  created_image = self.__generate_image()
58
58
 
59
- self.assertEqual(
60
- created_image["error"]["code"], 400,
61
- "Expected a 400 code for no model"
62
- )
63
59
  self.assertEqual(
64
60
  created_image["error"]["message"],
65
- "Invalid 'model' name. Must follow pattern {provider}/{modelName}",
61
+ "LLM Provider NOT provided. Pass in the LLM provider you are trying to call",
66
62
  "Expected an error message when no model is provided"
67
63
  )
68
64
 
@@ -141,7 +141,6 @@ class TestAILabCreateAgentIntegration(TestCase):
141
141
  self.assertEqual(prompt.inputs, agent.agent_data.prompt.inputs)
142
142
 
143
143
 
144
- @unittest.skip("Skipping test due to mismatch in expected behavior")
145
144
  def test_create_agent_without_required_data(self):
146
145
  test_params = [ True, False ]
147
146
 
@@ -151,12 +150,19 @@ class TestAILabCreateAgentIntegration(TestCase):
151
150
  self.new_agent = Agent(
152
151
  name=str(uuid.uuid4())
153
152
  )
154
- with self.assertRaises(APIError) as exception:
155
- self.__create_agent(automatic_publish=auto_publish)
156
-
157
- #TODO: Change validation error to a more specific one
158
- self.assertIn("400",str(exception.exception))
159
- self.assertIn("Bad Request",str(exception.exception))
153
+ if auto_publish:
154
+
155
+ with self.assertRaises(APIError) as exception:
156
+ self.__create_agent(automatic_publish=auto_publish)
157
+
158
+ #TODO: Change validation error to a more specific one
159
+ self.assertIn(
160
+ "A valid prompt is required. To be valid, it must provide clear instructions to the model",
161
+ str(exception.exception)
162
+ )
163
+ else:
164
+ created_agent = self.__create_agent(automatic_publish=auto_publish)
165
+ self.assertTrue(isinstance(created_agent, Agent), "Expected a created agent")
160
166
 
161
167
 
162
168
  def test_create_agent_no_name(self):
@@ -1,4 +1,5 @@
1
1
  from unittest import TestCase
2
+ import unittest
2
3
  from pygeai.lab.managers import AILabManager
3
4
  from pygeai.lab.models import SharingLink
4
5
  from pygeai.core.common.exceptions import APIError, MissingRequirementException
@@ -16,7 +17,7 @@ class TestAILabCreateSharingLinkIntegration(TestCase):
16
17
  agent_id=self.agent_id if agent_id is None else agent_id
17
18
  )
18
19
 
19
-
20
+ @unittest.skip("Endpoint is not found. Validate if it was deleted")
20
21
  def test_create_sharing_link(self):
21
22
  shared_link = self.__create_sharing_link()
22
23
  self.assertIsInstance(shared_link, SharingLink, "Expected response to be an instance of SharingLink")
@@ -46,6 +47,7 @@ class TestAILabCreateSharingLinkIntegration(TestCase):
46
47
  )
47
48
 
48
49
 
50
+ @unittest.skip("Endpoint is not found. Validate if it was deleted")
49
51
  def test_create_sharing_link_no_agent_id(self):
50
52
  with self.assertRaises(MissingRequirementException) as context:
51
53
  self.__create_sharing_link(agent_id="")
@@ -56,6 +58,7 @@ class TestAILabCreateSharingLinkIntegration(TestCase):
56
58
  )
57
59
 
58
60
 
61
+ @unittest.skip("Endpoint is not found. Validate if it was deleted")
59
62
  def test_create_sharing_link_invalid_agent_id(self):
60
63
  with self.assertRaises(APIError) as exception:
61
64
  invalid_id = "0026e53d-ea78-4cac-af9f-12650invalid"
@@ -191,23 +191,21 @@ class TestAILabUpdateAgentIntegration(TestCase):
191
191
  self.agent_to_update.agent_data.prompt.instructions = ""
192
192
 
193
193
  for auto_publish in test_params:
194
- with self.subTest(input=auto_publish):
195
- with self.assertRaises(ValidationError) as exception:
196
- self.__update_agent(automatic_publish=auto_publish)
197
-
198
- self.assertIn(
199
- "instructions",
200
- str(exception.exception),
201
- f"Expected a validation error about allowed values for instructions when autopublish is {'enabled' if auto_publish else 'disabled'}"
202
- )
203
- self.assertIn(
204
- "Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]",
205
- str(exception.exception),
206
- f"Expected a validation error about allowed values for instructions when autopublish is {'enabled' if auto_publish else 'disabled'}"
207
- )
194
+ with self.subTest(input=auto_publish):
195
+ if auto_publish == True:
196
+ with self.assertRaises(ValidationError) as exception:
197
+ self.__update_agent(automatic_publish=auto_publish)
198
+ self.assertIn(
199
+ "agent_data.prompt must have at least instructions for publication",
200
+ str(exception.exception),
201
+ f"Expected a validation error about allowed values for instructions when autopublish is {'enabled' if auto_publish else 'disabled'}"
202
+ )
203
+ else:
204
+ updated_agent = self.__update_agent(automatic_publish=auto_publish)
205
+ self.assertTrue(isinstance(updated_agent, Agent))
208
206
 
209
- # TODO: Change validation when API behavior is fixed
210
- def test_update_agent_no_model(self):
207
+
208
+ def test_update_agent_no_model(self):
211
209
  test_params = [ True, False ]
212
210
  self.agent_to_update.agent_data.models[0].name = ""
213
211
 
@@ -217,9 +215,8 @@ class TestAILabUpdateAgentIntegration(TestCase):
217
215
  # If the agent is not published, the API returns a warning message for invalid model name. However, the sdk mapping is not returning it.
218
216
  if auto_publish == False:
219
217
  updated_agent = self.__update_agent(automatic_publish=auto_publish)
220
- error_msg = str(exception.exception)
221
218
 
222
- self.assertTrue(self.isInstance(updated_agent), Agent)
219
+ self.assertTrue(isinstance(updated_agent, Agent))
223
220
  else:
224
221
  with self.assertRaises(APIError) as exception:
225
222
  self.__update_agent(automatic_publish=auto_publish)
File without changes
@@ -0,0 +1,345 @@
1
+ from unittest import TestCase
2
+ import unittest
3
+ import uuid
4
+ from pygeai.lab.managers import AILabManager
5
+ from pygeai.lab.models import (
6
+ AgenticProcess, KnowledgeBase, AgenticActivity, ArtifactSignal, Task,
7
+ UserSignal, Event, SequenceFlow, Variable
8
+ )
9
+ from pygeai.core.common.exceptions import APIResponseError, APIError
10
+
11
+
12
+ class TestAILabCreateProcessIntegration(TestCase):
13
+
14
+ def setUp(self):
15
+ """
16
+ Set up the test environment.
17
+ """
18
+ self.ai_lab_manager = AILabManager(alias="beta")
19
+ self.new_process = self.__load_process()
20
+ self.created_process: AgenticProcess = None
21
+
22
+
23
+ def tearDown(self):
24
+ """
25
+ Clean up after each test if necessary.
26
+ This can be used to delete the created process
27
+ """
28
+ if isinstance(self.created_process, AgenticProcess):
29
+ self.ai_lab_manager.delete_process(self.created_process.id)
30
+
31
+
32
+ def __load_process(self):
33
+ """
34
+ Helper to load a complete process configuration for testing.
35
+ """
36
+ unique_key = str(uuid.uuid4())
37
+ process = AgenticProcess(
38
+ key="product_def",
39
+ name=f"Test Process {unique_key[:8]}",
40
+ description="This is a sample process",
41
+ kb=KnowledgeBase(name="basic-sample", artifact_type_name=["sample-artifact"]),
42
+ agentic_activities=[
43
+ AgenticActivity(key="activityOne", name="First Step", task_name="basic-task", agent_name="GoogleSummarizer2", agent_revision_id=0)
44
+ ],
45
+ artifact_signals=[
46
+ ArtifactSignal(key="artifact.upload.1", name="artifact.upload", handling_type="C", artifact_type_name=["sample-artifact"])
47
+ ],
48
+ user_signals=[
49
+ UserSignal(key="signal_done", name="process-completed")
50
+ ],
51
+ start_event=Event(key="artifact.upload.1", name="artifact.upload"),
52
+ end_event=Event(key="end", name="Done"),
53
+ sequence_flows=[
54
+ SequenceFlow(key="step1", source_key="artifact.upload.1", target_key="activityOne"),
55
+ SequenceFlow(key="step2", source_key="activityOne", target_key="signal_done"),
56
+ SequenceFlow(key="stepEnd", source_key="signal_done", target_key="end")
57
+ ]
58
+ )
59
+ return process
60
+
61
+
62
+ def __create_process(self, process=None, automatic_publish=False):
63
+ """
64
+ Helper to create a process using ai_lab_manager.
65
+ """
66
+ return self.ai_lab_manager.create_process(
67
+ process=self.new_process if process is None else process,
68
+ automatic_publish=automatic_publish
69
+ )
70
+
71
+
72
+ def test_create_process_full_data(self):
73
+ """
74
+ Test creating a process with all available fields populated.
75
+ """
76
+ self.created_process = self.__create_process()
77
+ created_process = self.created_process
78
+ process = self.new_process
79
+
80
+ self.assertTrue(isinstance(created_process, AgenticProcess), "Expected a created process")
81
+
82
+ # Assert the main fields of the created process
83
+ self.assertIsNotNone(created_process.id)
84
+ #self.assertEqual(created_process.key, process.key)
85
+ self.assertEqual(created_process.name, process.name)
86
+ self.assertEqual(created_process.description, process.description)
87
+ self.assertEqual(created_process.status, "active")
88
+
89
+ # Assert knowledge base
90
+ self.assertIsNotNone(created_process.kb)
91
+ self.assertEqual(created_process.kb.name, process.kb.name)
92
+
93
+ # Assert agentic activities
94
+ created_activity = created_process.agentic_activities[0]
95
+ original_activity = process.agentic_activities[0]
96
+ self.assertTrue(isinstance(created_activity, AgenticActivity))
97
+ self.assertEqual(created_activity.key.lower(), original_activity.key.lower())
98
+ self.assertEqual(created_activity.name, original_activity.name)
99
+
100
+ # Assert artifact signals
101
+ created_signal = created_process.artifact_signals[0]
102
+ original_signal = process.artifact_signals[0]
103
+ self.assertTrue(isinstance(created_signal, ArtifactSignal))
104
+ self.assertEqual(created_signal.key.lower(), original_signal.key.lower())
105
+ self.assertEqual(created_signal.name, original_signal.name)
106
+ self.assertEqual(created_signal.handling_type, original_signal.handling_type)
107
+
108
+ # Assert user signals
109
+ created_user_signal = created_process.user_signals[0]
110
+ self.assertTrue(isinstance(created_user_signal, UserSignal))
111
+
112
+ # Assert events
113
+ self.assertIsNotNone(created_process.start_event)
114
+ self.assertEqual(created_process.start_event.key.lower(), process.start_event.key.lower())
115
+ self.assertEqual(created_process.start_event.name, process.start_event.name)
116
+
117
+ self.assertIsNotNone(created_process.end_event)
118
+ self.assertEqual(created_process.end_event.key.lower(), process.end_event.key.lower())
119
+ self.assertEqual(created_process.end_event.name, process.end_event.name)
120
+
121
+ # Assert sequence flows
122
+ created_flow = created_process.sequence_flows[0]
123
+ original_flow = process.sequence_flows[0]
124
+ self.assertIsNotNone(created_process.sequence_flows)
125
+ self.assertEqual(len(created_process.sequence_flows), len(process.sequence_flows))
126
+
127
+ self.assertEqual(created_flow.key.lower(), original_flow.key.lower())
128
+ self.assertEqual(created_flow.source_key.lower(), original_flow.source_key.lower())
129
+ self.assertEqual(created_flow.target_key.lower(), original_flow.target_key.lower())
130
+
131
+
132
+ def test_create_process_minimum_required_data(self):
133
+ """
134
+ Test creating a process with only minimum required fields (key and name).
135
+ """
136
+ unique_key = str(uuid.uuid4())
137
+ self.new_process = AgenticProcess(
138
+ key=unique_key,
139
+ name=f"Minimal Process {unique_key[:8]}"
140
+ )
141
+ self.created_process = self.__create_process()
142
+ process = self.new_process
143
+
144
+ self.assertTrue(isinstance(self.created_process, AgenticProcess), "Expected a created process")
145
+ self.assertIsNotNone(self.created_process.id)
146
+ self.assertEqual(self.created_process.name, process.name)
147
+
148
+
149
+ def test_create_process_without_key(self):
150
+ """
151
+ Test creating a process without a key should still work (key is optional).
152
+ """
153
+ self.new_process = AgenticProcess(
154
+ name=f"Process Without Key {str(uuid.uuid4())[:8]}"
155
+ )
156
+ self.created_process = self.__create_process()
157
+
158
+ self.assertTrue(isinstance(self.created_process, AgenticProcess), "Expected a created process")
159
+ self.assertIsNotNone(self.created_process.id)
160
+ self.assertEqual(self.created_process.name, self.new_process.name)
161
+
162
+
163
+ def test_create_process_no_name(self):
164
+ """
165
+ Test creating a process without a name should raise an error.
166
+ """
167
+ test_params = [True, False]
168
+
169
+ for auto_publish in test_params:
170
+ with self.subTest(input=auto_publish):
171
+ self.new_process.name = ""
172
+ with self.assertRaises(APIError) as exception:
173
+ self.__create_process(automatic_publish=auto_publish)
174
+
175
+ self.assertIn(
176
+ "Process name cannot be empty",
177
+ str(exception.exception),
178
+ f"Expected an error about empty process name with autopublish {'enabled' if auto_publish else 'disabled'}"
179
+ )
180
+
181
+
182
+ def test_create_process_duplicated_name(self):
183
+ """
184
+ Test creating a process with a duplicate name should raise an error.
185
+ """
186
+ test_params = [True, False]
187
+ created_process = self.__create_process()
188
+
189
+ for auto_publish in test_params:
190
+ with self.subTest(input=auto_publish):
191
+ loaded_process = self.__load_process()
192
+ loaded_process.name = created_process.name
193
+ with self.assertRaises(APIError) as exception:
194
+ self.__create_process(process = loaded_process, automatic_publish=auto_publish)
195
+
196
+ self.assertIn(
197
+ f"A process with this name already exists [name={created_process.name}].",
198
+ str(exception.exception),
199
+ f"Expected an error about duplicated process name with autopublish {'enabled' if auto_publish else 'disabled'}"
200
+ )
201
+
202
+
203
+ def test_create_process_invalid_name_characters(self):
204
+ """
205
+ Test creating a process with invalid characters in name should raise a validation error.
206
+ """
207
+ test_params = [True, False]
208
+
209
+ for auto_publish in test_params:
210
+ with self.subTest(input=auto_publish):
211
+ invalid_names = [
212
+ f"{str(uuid.uuid4())[:8]}:invalid",
213
+ f"{str(uuid.uuid4())[:8]}/invalid"
214
+ ]
215
+
216
+ for invalid_name in invalid_names:
217
+ new_process = self.__load_process()
218
+ new_process.name = invalid_name
219
+
220
+ with self.assertRaises(APIError) as exception:
221
+ self.__create_process(process=new_process, automatic_publish=auto_publish)
222
+
223
+ self.assertIn(
224
+ "Invalid character in name",
225
+ str(exception.exception),
226
+ f"Expected an error about invalid character in process name with autopublish {'enabled' if auto_publish else 'disabled'}"
227
+ )
228
+
229
+
230
+ @unittest.skip("Skipping test for now.KB is required but is marked as optional")
231
+ def test_create_process_with_no_kb(self):
232
+ """
233
+ Test creating a process with knowledge base in JSON format.
234
+ """
235
+ unique_key = str(uuid.uuid4())
236
+ self.new_process.kb = None
237
+ self.created_process = self.__create_process()
238
+
239
+ self.assertIsNotNone(self.created_process.kb)
240
+ self.assertEqual(self.created_process.kb.name, "basic-sample")
241
+
242
+
243
+ def test_create_process_with_empty_agentic_activities_array(self):
244
+ """
245
+ Test creating a process with empty agentic activities array (to clear all activities).
246
+ """
247
+ self.new_process.agentic_activities = []
248
+ self.new_process.sequence_flows = [] # Clear sequence flows as well because they depend on activities
249
+ self.created_process = self.__create_process()
250
+
251
+ # Empty array should be handled gracefully
252
+ self.assertTrue(
253
+ self.created_process.agentic_activities is None or
254
+ len(self.created_process.agentic_activities) == 0
255
+ )
256
+
257
+
258
+ def test_create_process_with_multiple_artifact_signals(self):
259
+ """
260
+ Test creating a process with multiple artifact signals.
261
+ """
262
+ self.new_process.artifact_signals=[
263
+ ArtifactSignal(key="artifact.upload.1", name="artifact.upload", handling_type="C", artifact_type_name=["sample-artifact"]),
264
+ ArtifactSignal(key="artifact.upload.2", name="artifact.upload.second", handling_type="C", artifact_type_name=["sample-artifact"])
265
+ ]
266
+ self.created_process = self.__create_process()
267
+
268
+ self.assertIsNotNone(self.created_process.artifact_signals)
269
+ self.assertEqual(len(self.created_process.artifact_signals), 2)
270
+
271
+ first_signal = self.created_process.artifact_signals[0]
272
+ second_signal = self.created_process.artifact_signals[1]
273
+
274
+ self.assertEqual(first_signal.key.lower(), "artifact.upload.1")
275
+ self.assertEqual(second_signal.key.lower(), "artifact.upload.2")
276
+
277
+
278
+ def test_create_process_with_multiple_user_signals(self):
279
+ """
280
+ Test creating a process with multiple user signals.
281
+ """
282
+ self.new_process.user_signals=[
283
+ UserSignal(key="signal_done", name="process-completed"),
284
+ UserSignal(key="signal_cancel", name="process-cancelled")
285
+ ]
286
+ self.created_process = self.__create_process()
287
+
288
+ self.assertIsNotNone(self.created_process.user_signals)
289
+ self.assertEqual(len(self.created_process.user_signals)-1, 2)
290
+ keys = [signal.key for signal in self.created_process.user_signals]
291
+
292
+ assert "SIGNAL_CANCEL" in keys
293
+ assert "SIGNAL_DONE" in keys
294
+
295
+
296
+ def test_create_process_autopublish_disabled(self):
297
+ """
298
+ Test creating a process without automatic publish (default behavior).
299
+ """
300
+ self.created_process = self.__create_process(automatic_publish=False)
301
+
302
+ # Process should be created as draft by default
303
+ self.assertTrue(
304
+ self.created_process.is_draft is True or
305
+ self.created_process.is_draft is None, # API might not return this field for drafts
306
+ "Expected the process to be created as draft when autopublish is disabled"
307
+ )
308
+
309
+
310
+ def test_create_process_autopublish_without_task(self):
311
+ """
312
+ Test creating a process with automatic publish enabled.
313
+ """
314
+
315
+ with self.assertRaises(APIError) as exception:
316
+ self.__create_process(automatic_publish=True)
317
+
318
+ self.assertIn(
319
+ "Failure on process publication",
320
+ str(exception.exception),
321
+ "Expected an error about failure on process publication"
322
+ )
323
+
324
+ self.assertIn(
325
+ "Task is required",
326
+ str(exception.exception),
327
+ "Expected an error about task being required"
328
+ )
329
+
330
+
331
+ def test_create_process_autopublish_enabled(self):
332
+ """
333
+ Test creating a process with automatic publish enabled.
334
+ """
335
+ unique_key = str(uuid.uuid4())
336
+ task = Task(name=unique_key, description="Basic task for process", title_template="Basic Task")
337
+ self.ai_lab_manager.create_task(task=task, automatic_publish=True)
338
+ self.new_process.agentic_activities[0].task_name = unique_key
339
+
340
+
341
+ self.created_process = self.__create_process(automatic_publish=True)
342
+ self.assertTrue(
343
+ self.created_process.is_draft is False,
344
+ "Expected the process to be created no draft when autopublish is enabled"
345
+ )