pygeai 0.5.0__py3-none-any.whl → 0.6.0b3__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 (79) hide show
  1. pygeai/__init__.py +1 -1
  2. pygeai/auth/__init__.py +0 -0
  3. pygeai/auth/clients.py +55 -0
  4. pygeai/auth/endpoints.py +2 -0
  5. pygeai/cli/__init__.py +0 -1
  6. pygeai/cli/commands/auth.py +123 -0
  7. pygeai/cli/commands/base.py +22 -1
  8. pygeai/cli/commands/docs.py +105 -0
  9. pygeai/cli/texts/help.py +157 -24
  10. pygeai/core/files/responses.py +4 -3
  11. pygeai/lab/clients.py +3 -3
  12. pygeai/lab/tools/clients.py +4 -4
  13. pygeai/tests/admin/test_clients.py +143 -0
  14. pygeai/tests/auth/__init__.py +0 -0
  15. pygeai/tests/auth/test_clients.py +105 -0
  16. pygeai/tests/cli/commands/lab/test_ai_lab.py +41 -35
  17. pygeai/tests/cli/commands/lab/test_spec.py +24 -56
  18. pygeai/tests/cli/commands/test_chat.py +21 -3
  19. pygeai/tests/cli/commands/test_evaluation.py +649 -0
  20. pygeai/tests/cli/commands/test_secrets.py +171 -0
  21. pygeai/tests/core/base/data/models.py +7 -0
  22. pygeai/tests/core/base/test_mappers.py +43 -11
  23. pygeai/tests/core/base/test_models.py +3 -1
  24. pygeai/tests/core/base/test_responses.py +53 -0
  25. pygeai/tests/core/common/test_config.py +2 -3
  26. pygeai/tests/core/files/test_mappers.py +137 -0
  27. pygeai/tests/core/plugins/__init__.py +0 -0
  28. pygeai/tests/core/plugins/test_clients.py +64 -0
  29. pygeai/tests/evaluation/__init__.py +0 -0
  30. pygeai/tests/evaluation/dataset/__init__.py +0 -0
  31. pygeai/tests/evaluation/dataset/test_clients.py +263 -0
  32. pygeai/tests/evaluation/plan/__init__.py +0 -0
  33. pygeai/tests/evaluation/plan/test_clients.py +193 -0
  34. pygeai/tests/evaluation/result/__init__.py +0 -0
  35. pygeai/tests/evaluation/result/test_clients.py +64 -0
  36. pygeai/tests/integration/assistants/rag/test_create_rag.py +1 -1
  37. pygeai/tests/integration/chat/test_generate_image.py +1 -1
  38. pygeai/tests/integration/lab/agents/test_agents_list.py +1 -1
  39. pygeai/tests/integration/lab/agents/test_create_agent.py +3 -3
  40. pygeai/tests/integration/lab/agents/test_create_sharing_link.py +1 -1
  41. pygeai/tests/integration/lab/agents/test_delete_agent.py +2 -2
  42. pygeai/tests/integration/lab/agents/test_get_agent.py +1 -1
  43. pygeai/tests/integration/lab/agents/test_publish_agent_revision.py +2 -2
  44. pygeai/tests/integration/lab/agents/test_update_agent.py +3 -3
  45. pygeai/tests/integration/lab/processes/test_create_process.py +1 -1
  46. pygeai/tests/integration/lab/processes/test_create_task.py +211 -0
  47. pygeai/tests/integration/lab/processes/test_delete_process.py +111 -0
  48. pygeai/tests/integration/lab/processes/test_get_process.py +1 -1
  49. pygeai/tests/integration/lab/processes/test_list_process_instances.py +91 -0
  50. pygeai/tests/integration/lab/processes/test_list_processes.py +138 -0
  51. pygeai/tests/integration/lab/processes/test_publish_process_revision.py +232 -0
  52. pygeai/tests/integration/lab/processes/test_update_process.py +1 -1
  53. pygeai/tests/integration/lab/reasoning_strategies/test_get_reasoning_strategy.py +1 -1
  54. pygeai/tests/integration/lab/reasoning_strategies/test_list_reasoning_strategies.py +1 -1
  55. pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +1 -1
  56. pygeai/tests/integration/lab/tools/test_create_tool.py +1 -1
  57. pygeai/tests/integration/lab/tools/test_delete_tool.py +1 -1
  58. pygeai/tests/integration/lab/tools/test_get_parameter.py +1 -1
  59. pygeai/tests/integration/lab/tools/test_get_tool.py +1 -1
  60. pygeai/tests/integration/lab/tools/test_list_tools.py +1 -1
  61. pygeai/tests/integration/lab/tools/test_publish_tool_revision.py +1 -1
  62. pygeai/tests/integration/lab/tools/test_set_parameter.py +1 -1
  63. pygeai/tests/integration/lab/tools/test_update_tool.py +1 -1
  64. pygeai/tests/lab/agents/test_clients.py +17 -34
  65. pygeai/tests/lab/processes/test_clients.py +30 -93
  66. pygeai/tests/lab/processes/test_mappers.py +12 -71
  67. pygeai/tests/lab/strategies/test_clients.py +63 -63
  68. pygeai/tests/lab/test_managers.py +3 -6
  69. pygeai/tests/lab/test_models.py +9 -8
  70. pygeai/tests/lab/tools/test_clients.py +22 -45
  71. pygeai/tests/migration/test_strategies.py +16 -16
  72. pygeai/tests/organization/test_mappers.py +11 -4
  73. pygeai/tests/organization/test_responses.py +137 -0
  74. {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/METADATA +1 -1
  75. {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/RECORD +79 -53
  76. {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/WHEEL +0 -0
  77. {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/entry_points.txt +0 -0
  78. {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/licenses/LICENSE +0 -0
  79. {pygeai-0.5.0.dist-info → pygeai-0.6.0b3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,232 @@
1
+ from unittest import TestCase
2
+ import uuid
3
+ from pygeai.lab.managers import AILabManager
4
+ from pygeai.lab.models import AgenticProcess, KnowledgeBase, AgenticActivity, ArtifactSignal, UserSignal, Event, SequenceFlow
5
+ from pygeai.core.common.exceptions import InvalidAPIResponseException, MissingRequirementException, APIError
6
+
7
+ ai_lab_manager: AILabManager
8
+
9
+ class TestAILabPublishProcessRevisionIntegration(TestCase):
10
+
11
+ def setUp(self):
12
+ self.ai_lab_manager = AILabManager()
13
+ # Using a known process ID that should have revisions for testing
14
+ self.process_id = "7e28e9ab-b9a2-417e-9e87-ed7f6ec9534b"
15
+ self.process_name = "Test Process For Sdk Project"
16
+ self.revision = "1"
17
+
18
+
19
+ def __create_process(self):
20
+ """
21
+ Helper to create a process for testing publish revision functionality.
22
+ """
23
+ unique_key = str(uuid.uuid4())
24
+ process = AgenticProcess(
25
+ key="test_publish_key",
26
+ name=f"Test Publish Process {unique_key[:8]}",
27
+ description="Test process for publish revision testing",
28
+ kb=KnowledgeBase(name="basic-sample", artifact_type_name=["sample-artifact"]),
29
+ agentic_activities=[
30
+ AgenticActivity(
31
+ key="activityOne",
32
+ name="First Step",
33
+ task_name="basic-task",
34
+ agent_name="GoogleSummarizer2",
35
+ agent_revision_id=0
36
+ )
37
+ ],
38
+ artifact_signals=[
39
+ ArtifactSignal(
40
+ key="artifact.upload.1",
41
+ name="artifact.upload",
42
+ handling_type="C",
43
+ artifact_type_name=["sample-artifact"]
44
+ )
45
+ ],
46
+ user_signals=[
47
+ UserSignal(key="signal_done", name="process-completed")
48
+ ],
49
+ start_event=Event(key="artifact.upload.1", name="artifact.upload"),
50
+ end_event=Event(key="end", name="Done"),
51
+ sequence_flows=[
52
+ SequenceFlow(key="step1", source_key="artifact.upload.1", target_key="activityOne"),
53
+ SequenceFlow(key="step2", source_key="activityOne", target_key="signal_done"),
54
+ SequenceFlow(key="stepEnd", source_key="signal_done", target_key="end")
55
+ ]
56
+ )
57
+
58
+ return self.ai_lab_manager.create_process(
59
+ process=process,
60
+ automatic_publish=False
61
+ )
62
+
63
+
64
+ def __publish_process_revision(self, process_id: str = None, process_name: str = None, revision: str = None):
65
+ return self.ai_lab_manager.publish_process_revision(
66
+ process_id=process_id,
67
+ process_name=process_name,
68
+ revision=revision if revision is not None else self.revision
69
+ )
70
+
71
+
72
+ def test_publish_process_revision_by_id(self):
73
+ """Test publishing a process revision using process_id."""
74
+ published_process = self.__publish_process_revision(process_id=self.process_id)
75
+
76
+ self.assertIsInstance(published_process, AgenticProcess, "Expected AgenticProcess instance")
77
+ self.assertEqual(published_process.id, self.process_id, "Expected process ID to match")
78
+ self.assertIsNotNone(published_process.revision, "Expected revision to be set")
79
+
80
+
81
+ def test_publish_process_revision_by_name(self):
82
+ """Test publishing a process revision using process_name."""
83
+ published_process = self.__publish_process_revision(process_name=self.process_name)
84
+
85
+ self.assertIsInstance(published_process, AgenticProcess, "Expected AgenticProcess instance")
86
+ self.assertEqual(published_process.name, self.process_name, "Expected process name to match")
87
+ self.assertIsNotNone(published_process.revision, "Expected revision to be set")
88
+
89
+
90
+ def test_publish_process_revision_specific_revision(self):
91
+ """Test publishing a specific revision number."""
92
+ specific_revision = "2"
93
+ published_process = self.__publish_process_revision(
94
+ process_id=self.process_id,
95
+ revision=specific_revision
96
+ )
97
+
98
+ self.assertIsInstance(published_process, AgenticProcess, "Expected AgenticProcess instance")
99
+ self.assertEqual(published_process.id, self.process_id, "Expected process ID to match")
100
+
101
+
102
+ def test_publish_process_revision_no_parameters(self):
103
+ """Test error when neither process_id nor process_name is provided."""
104
+ with self.assertRaises(MissingRequirementException) as exception:
105
+ self.__publish_process_revision()
106
+
107
+ self.assertIn(
108
+ "Either process_id or process_name and revision must be provided",
109
+ str(exception.exception),
110
+ "Expected error message for missing parameters"
111
+ )
112
+
113
+
114
+ def test_publish_process_revision_empty_process_id(self):
115
+ """Test error when process_id is empty."""
116
+ with self.assertRaises(MissingRequirementException) as exception:
117
+ self.__publish_process_revision(process_id="")
118
+
119
+ self.assertIn(
120
+ "Either process_id or process_name and revision must be provided",
121
+ str(exception.exception),
122
+ "Expected error message for empty process_id"
123
+ )
124
+
125
+
126
+ def test_publish_process_revision_empty_process_name(self):
127
+ """Test error when process_name is empty."""
128
+ with self.assertRaises(MissingRequirementException) as exception:
129
+ self.__publish_process_revision(process_name="")
130
+
131
+ self.assertIn(
132
+ "Either process_id or process_name and revision must be provided",
133
+ str(exception.exception),
134
+ "Expected error message for empty process_name"
135
+ )
136
+
137
+
138
+ def test_publish_process_revision_no_revision(self):
139
+ """Test error when revision is not provided."""
140
+ with self.assertRaises(MissingRequirementException) as exception:
141
+ self.__publish_process_revision(process_id=self.process_id, revision="")
142
+
143
+ self.assertIn(
144
+ "Either process_id or process_name and revision must be provided",
145
+ str(exception.exception),
146
+ "Expected error message for missing revision"
147
+ )
148
+
149
+
150
+ def test_publish_process_revision_none_revision(self):
151
+ """Test error when revision is None."""
152
+ with self.assertRaises(MissingRequirementException) as exception:
153
+ self.__publish_process_revision(process_id=self.process_id, revision=None)
154
+
155
+ self.assertIn(
156
+ "Either process_id or process_name and revision must be provided",
157
+ str(exception.exception),
158
+ "Expected error message for None revision"
159
+ )
160
+
161
+
162
+ def test_publish_process_revision_invalid_process_id(self):
163
+ """Test error with invalid process_id."""
164
+ invalid_id = "0026e53d-ea78-4cac-af9f-12650invalid"
165
+ with self.assertRaises((APIError, InvalidAPIResponseException)) as exception:
166
+ self.__publish_process_revision(process_id=invalid_id)
167
+
168
+ self.assertTrue(
169
+ f"Unable to publish revision {self.revision} for process {invalid_id}" in str(exception.exception) or
170
+ "Error received while publishing process revision" in str(exception.exception),
171
+ "Expected error message for invalid process id"
172
+ )
173
+
174
+
175
+ def test_publish_process_revision_invalid_process_name(self):
176
+ """Test error with invalid process_name."""
177
+ invalid_name = "NonExistentProcessName123"
178
+ with self.assertRaises((APIError, InvalidAPIResponseException)) as exception:
179
+ self.__publish_process_revision(process_name=invalid_name)
180
+
181
+ self.assertTrue(
182
+ f"Unable to publish revision {self.revision} for process {invalid_name}" in str(exception.exception) or
183
+ "Error received while publishing process revision" in str(exception.exception),
184
+ "Expected error message for invalid process name"
185
+ )
186
+
187
+
188
+ def test_publish_process_revision_nonexistent_process_id(self):
189
+ """Test error with nonexistent process_id."""
190
+ nonexistent_id = "99999999-9999-9999-9999-999999999999"
191
+ with self.assertRaises((APIError, InvalidAPIResponseException)) as exception:
192
+ self.__publish_process_revision(process_id=nonexistent_id)
193
+
194
+ self.assertTrue(
195
+ f"Unable to publish revision {self.revision} for process {nonexistent_id}" in str(exception.exception) or
196
+ "Error received while publishing process revision" in str(exception.exception),
197
+ "Expected error message for nonexistent process id"
198
+ )
199
+
200
+
201
+ def test_publish_process_revision_invalid_revision(self):
202
+ """Test error with invalid revision number."""
203
+ invalid_revision = "999"
204
+ with self.assertRaises((APIError, InvalidAPIResponseException)) as exception:
205
+ self.__publish_process_revision(process_id=self.process_id, revision=invalid_revision)
206
+
207
+ self.assertTrue(
208
+ f"Unable to publish revision {invalid_revision} for process {self.process_id}" in str(exception.exception) or
209
+ "Error received while publishing process revision" in str(exception.exception),
210
+ "Expected error message for invalid revision"
211
+ )
212
+
213
+
214
+ def test_publish_process_revision_with_created_process(self):
215
+ """Test publishing revision with a newly created process."""
216
+ # Create a fresh process
217
+ created_process = self.__create_process()
218
+
219
+ # Note: A newly created process might not have additional revisions to publish
220
+ # This test verifies the process creation worked and we can attempt to publish
221
+ self.assertIsNotNone(created_process.id, "Expected created process to have an ID")
222
+
223
+ # Attempt to publish revision 0 (initial revision)
224
+ try:
225
+ published_process = self.__publish_process_revision(
226
+ process_id=created_process.id,
227
+ revision="0"
228
+ )
229
+ self.assertIsInstance(published_process, AgenticProcess, "Expected AgenticProcess instance")
230
+ except (APIError, InvalidAPIResponseException):
231
+ # This is expected for a new process that may not have publishable revisions yet
232
+ pass
@@ -15,7 +15,7 @@ class TestAILabUpdateProcessIntegration(TestCase):
15
15
  """
16
16
  Set up the test environment.
17
17
  """
18
- self.ai_lab_manager = AILabManager(alias="beta")
18
+ self.ai_lab_manager = AILabManager()
19
19
  self.process_to_update = self.__load_process()
20
20
  self.created_process: AgenticProcess = None
21
21
  self.updated_process: AgenticProcess = None
@@ -8,7 +8,7 @@ ai_lab_manager: AILabManager
8
8
  class TestAILabGetReasoningStrategyIntegration(TestCase):
9
9
 
10
10
  def setUp(self):
11
- self.ai_lab_manager = AILabManager(alias="beta")
11
+ self.ai_lab_manager = AILabManager()
12
12
  self.strategy_id = "0a3b039e-25bd-4cf9-ad67-7af2b654874b"
13
13
  self.strategy_name = "Chain of Thought"
14
14
 
@@ -8,7 +8,7 @@ ai_lab_manager: AILabManager
8
8
  class TestAILabListReasoningStrategiesIntegration(TestCase):
9
9
 
10
10
  def setUp(self):
11
- self.ai_lab_manager = AILabManager(alias="beta")
11
+ self.ai_lab_manager = AILabManager()
12
12
  self.filter_settings = FilterSettings(
13
13
  name="",
14
14
  start=0,
@@ -11,7 +11,7 @@ class TestAILabCreateReasoningStrategyIntegration(TestCase):
11
11
  """
12
12
  Set up the test environment.
13
13
  """
14
- self.ai_lab_manager = AILabManager(alias="beta")
14
+ self.ai_lab_manager = AILabManager()
15
15
  self.strategy_to_update = self.__load_strategy()
16
16
 
17
17
 
@@ -10,7 +10,7 @@ class TestAILabCreateToolIntegration(TestCase):
10
10
  """
11
11
  Set up the test environment.
12
12
  """
13
- self.ai_lab_manager = AILabManager(alias="beta")
13
+ self.ai_lab_manager = AILabManager()
14
14
  self.new_tool = self.__load_tool()
15
15
  self.created_tool: Tool = None
16
16
 
@@ -9,7 +9,7 @@ ai_lab_manager: AILabManager
9
9
  class TestAILabDeleteToolIntegration(TestCase):
10
10
 
11
11
  def setUp(self):
12
- self.ai_lab_manager = AILabManager(alias="beta")
12
+ self.ai_lab_manager = AILabManager()
13
13
 
14
14
 
15
15
  def __create_tool(self):
@@ -9,7 +9,7 @@ ai_lab_manager: AILabManager
9
9
  class TestAILabGetParameterIntegration(TestCase):
10
10
 
11
11
  def setUp(self):
12
- self.ai_lab_manager = AILabManager(alias="beta")
12
+ self.ai_lab_manager = AILabManager()
13
13
  self.tool_id = "42610b61-cb47-49bf-9475-36ee652f31f3"
14
14
  self.filter_settings = FilterSettings(
15
15
  revision="0",
@@ -10,7 +10,7 @@ ai_lab_manager: AILabManager
10
10
  class TestAILabGetToolIntegration(TestCase):
11
11
 
12
12
  def setUp(self):
13
- self.ai_lab_manager = AILabManager(alias="beta")
13
+ self.ai_lab_manager = AILabManager()
14
14
  self.tool_id = "e3e4d64f-ce52-467e-90a9-aa4d08425e82"
15
15
  self.filter_settings = FilterSettings(
16
16
  revision="0",
@@ -8,7 +8,7 @@ ai_lab_manager: AILabManager
8
8
  class TestAILabListToolsIntegration(TestCase):
9
9
 
10
10
  def setUp(self):
11
- self.ai_lab_manager = AILabManager(alias="beta")
11
+ self.ai_lab_manager = AILabManager()
12
12
  self.filter_settings = FilterSettings(
13
13
  allow_external=False,
14
14
  allow_drafts=True,
@@ -9,7 +9,7 @@ ai_lab_manager: AILabManager
9
9
  class TestAILabPublishToolRevisionIntegration(TestCase):
10
10
 
11
11
  def setUp(self):
12
- self.ai_lab_manager = AILabManager(alias="beta")
12
+ self.ai_lab_manager = AILabManager()
13
13
  self.tool_id = "c77e1f2e-0322-4dd0-b6ec-aff217f1cb32"
14
14
 
15
15
 
@@ -8,7 +8,7 @@ ai_lab_manager: AILabManager
8
8
 
9
9
  class TestAILabSetParameterIntegration(TestCase):
10
10
  def setUp(self):
11
- self.ai_lab_manager = AILabManager(alias="beta")
11
+ self.ai_lab_manager = AILabManager()
12
12
  self.tool_id = "42610b61-cb47-49bf-9475-36ee652f31f3"
13
13
  self.tool_parameters = self.__load_parameters()
14
14
 
@@ -10,7 +10,7 @@ class TestAILabUpdateToolIntegration(TestCase):
10
10
  """
11
11
  Set up the test environment.
12
12
  """
13
- self.ai_lab_manager = AILabManager(alias="beta")
13
+ self.ai_lab_manager = AILabManager()
14
14
  self.tool_to_update = self.__load_tool()
15
15
 
16
16
 
@@ -15,11 +15,12 @@ class TestAgentClient(unittest.TestCase):
15
15
  """
16
16
 
17
17
  def setUp(self):
18
- self.client = AgentClient()
19
18
  self.project_id = "test-project-id"
19
+ self.client = AgentClient(api_key="test_key", base_url="https://test.url", project_id=self.project_id)
20
20
  self.agent_id = "test-agent-id"
21
21
  self.agent_data_prompt = {"instructions": "Do this task"}
22
22
  self.agent_data_llm_config = {"maxTokens": 100, "timeout": 30}
23
+ self.agent_data_strategy_name = "default"
23
24
  self.agent_data_models = [{"name": "gpt-4o"}]
24
25
  self.agent_data_resource_pools = [{"name": "pool1", "tools": [{"name": "tool1"}]}]
25
26
 
@@ -30,7 +31,6 @@ class TestAgentClient(unittest.TestCase):
30
31
  mock_response.json.return_value = expected_response
31
32
 
32
33
  result = self.client.list_agents(
33
- project_id=self.project_id,
34
34
  status="active",
35
35
  start=0,
36
36
  count=10,
@@ -63,7 +63,7 @@ class TestAgentClient(unittest.TestCase):
63
63
  mock_response.text = "Invalid JSON response"
64
64
 
65
65
  with self.assertRaises(InvalidAPIResponseException) as context:
66
- self.client.list_agents(project_id=self.project_id)
66
+ self.client.list_agents()
67
67
 
68
68
  self.assertEqual(str(context.exception), f"Unable to list agents for project {self.project_id}: Invalid JSON response")
69
69
  mock_get.assert_called_once()
@@ -75,7 +75,6 @@ class TestAgentClient(unittest.TestCase):
75
75
  mock_response.json.return_value = expected_response
76
76
 
77
77
  result = self.client.create_agent(
78
- project_id=self.project_id,
79
78
  name="Test Agent",
80
79
  access_scope="private",
81
80
  public_name="test-agent",
@@ -84,6 +83,7 @@ class TestAgentClient(unittest.TestCase):
84
83
  description="Agent Description",
85
84
  agent_data_prompt=self.agent_data_prompt,
86
85
  agent_data_llm_config=self.agent_data_llm_config,
86
+ agent_data_strategy_name=self.agent_data_strategy_name,
87
87
  agent_data_models=self.agent_data_models,
88
88
  agent_data_resource_pools=self.agent_data_resource_pools,
89
89
  automatic_publish=True
@@ -116,7 +116,6 @@ class TestAgentClient(unittest.TestCase):
116
116
  mock_response.json.return_value = expected_response
117
117
 
118
118
  result = self.client.create_agent(
119
- project_id=self.project_id,
120
119
  name="Test Agent",
121
120
  access_scope="private",
122
121
  public_name="test-agent",
@@ -125,6 +124,7 @@ class TestAgentClient(unittest.TestCase):
125
124
  description="Agent Description",
126
125
  agent_data_prompt=self.agent_data_prompt,
127
126
  agent_data_llm_config=self.agent_data_llm_config,
127
+ agent_data_strategy_name=self.agent_data_strategy_name,
128
128
  agent_data_models=self.agent_data_models,
129
129
  automatic_publish=False
130
130
  )
@@ -137,7 +137,6 @@ class TestAgentClient(unittest.TestCase):
137
137
  def test_create_agent_invalid_access_scope(self):
138
138
  with self.assertRaises(ValueError) as context:
139
139
  self.client.create_agent(
140
- project_id=self.project_id,
141
140
  name="Test Agent",
142
141
  access_scope="invalid_scope",
143
142
  public_name="test-agent",
@@ -146,6 +145,7 @@ class TestAgentClient(unittest.TestCase):
146
145
  description="Agent Description",
147
146
  agent_data_prompt=self.agent_data_prompt,
148
147
  agent_data_llm_config=self.agent_data_llm_config,
148
+ agent_data_strategy_name=self.agent_data_strategy_name,
149
149
  agent_data_models=self.agent_data_models
150
150
  )
151
151
  self.assertEqual(str(context.exception), f"Access scope must be one of {', '.join(VALID_ACCESS_SCOPES)}.")
@@ -159,7 +159,6 @@ class TestAgentClient(unittest.TestCase):
159
159
 
160
160
  with self.assertRaises(InvalidAPIResponseException) as context:
161
161
  self.client.create_agent(
162
- project_id=self.project_id,
163
162
  name="Test Agent",
164
163
  access_scope="private",
165
164
  public_name="test-agent",
@@ -168,6 +167,7 @@ class TestAgentClient(unittest.TestCase):
168
167
  description="Agent Description",
169
168
  agent_data_prompt=self.agent_data_prompt,
170
169
  agent_data_llm_config=self.agent_data_llm_config,
170
+ agent_data_strategy_name=self.agent_data_strategy_name,
171
171
  agent_data_models=self.agent_data_models
172
172
  )
173
173
 
@@ -181,7 +181,6 @@ class TestAgentClient(unittest.TestCase):
181
181
  mock_response.json.return_value = expected_response
182
182
 
183
183
  result = self.client.get_agent(
184
- project_id=self.project_id,
185
184
  agent_id=self.agent_id,
186
185
  revision="1",
187
186
  version=2,
@@ -201,14 +200,9 @@ class TestAgentClient(unittest.TestCase):
201
200
  headers = mock_get.call_args[1]['headers']
202
201
  self.assertEqual(headers['ProjectId'], self.project_id)
203
202
 
204
- def test_get_agent_missing_project_id(self):
205
- with self.assertRaises(MissingRequirementException) as context:
206
- self.client.get_agent(project_id="", agent_id=self.agent_id)
207
- self.assertEqual(str(context.exception), "Cannot retrieve agent without specifying project_id")
208
-
209
203
  def test_get_agent_missing_agent_id(self):
210
204
  with self.assertRaises(MissingRequirementException) as context:
211
- self.client.get_agent(project_id=self.project_id, agent_id="")
205
+ self.client.get_agent(agent_id="")
212
206
  self.assertEqual(str(context.exception), "agent_id must be specified in order to retrieve the agent")
213
207
 
214
208
  @patch("pygeai.core.services.rest.ApiService.get")
@@ -219,7 +213,7 @@ class TestAgentClient(unittest.TestCase):
219
213
  mock_response.text = "Invalid JSON response"
220
214
 
221
215
  with self.assertRaises(InvalidAPIResponseException) as context:
222
- self.client.get_agent(project_id=self.project_id, agent_id=self.agent_id)
216
+ self.client.get_agent(agent_id=self.agent_id)
223
217
 
224
218
  self.assertEqual(str(context.exception), f"Unable to retrieve agent {self.agent_id} for project {self.project_id}: Invalid JSON response")
225
219
  mock_get.assert_called_once()
@@ -231,7 +225,6 @@ class TestAgentClient(unittest.TestCase):
231
225
  mock_response.json.return_value = expected_response
232
226
 
233
227
  result = self.client.create_sharing_link(
234
- project_id=self.project_id,
235
228
  agent_id=self.agent_id
236
229
  )
237
230
 
@@ -244,14 +237,9 @@ class TestAgentClient(unittest.TestCase):
244
237
  headers = mock_get.call_args[1]['headers']
245
238
  self.assertEqual(headers['ProjectId'], self.project_id)
246
239
 
247
- def test_create_sharing_link_missing_project_id(self):
248
- with self.assertRaises(MissingRequirementException) as context:
249
- self.client.create_sharing_link(project_id="", agent_id=self.agent_id)
250
- self.assertEqual(str(context.exception), "Cannot create sharing link without specifying project_id")
251
-
252
240
  def test_create_sharing_link_missing_agent_id(self):
253
241
  with self.assertRaises(MissingRequirementException) as context:
254
- self.client.create_sharing_link(project_id=self.project_id, agent_id="")
242
+ self.client.create_sharing_link(agent_id="")
255
243
  self.assertEqual(str(context.exception), "agent_id must be specified in order to create sharing link")
256
244
 
257
245
  @patch("pygeai.core.services.rest.ApiService.get")
@@ -263,7 +251,6 @@ class TestAgentClient(unittest.TestCase):
263
251
 
264
252
  with self.assertRaises(InvalidAPIResponseException) as context:
265
253
  self.client.create_sharing_link(
266
- project_id=self.project_id,
267
254
  agent_id=self.agent_id
268
255
  )
269
256
 
@@ -278,7 +265,6 @@ class TestAgentClient(unittest.TestCase):
278
265
  mock_response.json.return_value = expected_response
279
266
 
280
267
  result = self.client.publish_agent_revision(
281
- project_id=self.project_id,
282
268
  agent_id=self.agent_id,
283
269
  revision=revision
284
270
  )
@@ -302,7 +288,6 @@ class TestAgentClient(unittest.TestCase):
302
288
 
303
289
  with self.assertRaises(InvalidAPIResponseException) as context:
304
290
  self.client.publish_agent_revision(
305
- project_id=self.project_id,
306
291
  agent_id=self.agent_id,
307
292
  revision=revision
308
293
  )
@@ -312,12 +297,11 @@ class TestAgentClient(unittest.TestCase):
312
297
 
313
298
  @patch("pygeai.core.services.rest.ApiService.delete")
314
299
  def test_delete_agent_success(self, mock_delete):
315
- expected_response = {"status": "deleted"}
300
+ expected_response = {}
316
301
  mock_response = mock_delete.return_value
317
- mock_response.json.return_value = expected_response
302
+ mock_response.status_code = 204
318
303
 
319
304
  result = self.client.delete_agent(
320
- project_id=self.project_id,
321
305
  agent_id=self.agent_id
322
306
  )
323
307
 
@@ -339,7 +323,6 @@ class TestAgentClient(unittest.TestCase):
339
323
 
340
324
  with self.assertRaises(InvalidAPIResponseException) as context:
341
325
  self.client.delete_agent(
342
- project_id=self.project_id,
343
326
  agent_id=self.agent_id
344
327
  )
345
328
 
@@ -353,7 +336,6 @@ class TestAgentClient(unittest.TestCase):
353
336
  mock_response.json.return_value = expected_response
354
337
 
355
338
  result = self.client.update_agent(
356
- project_id=self.project_id,
357
339
  agent_id=self.agent_id,
358
340
  name="Updated Agent",
359
341
  access_scope="public",
@@ -363,6 +345,7 @@ class TestAgentClient(unittest.TestCase):
363
345
  description="Updated Description",
364
346
  agent_data_prompt=self.agent_data_prompt,
365
347
  agent_data_llm_config=self.agent_data_llm_config,
348
+ agent_data_strategy_name=self.agent_data_strategy_name,
366
349
  agent_data_models=self.agent_data_models,
367
350
  agent_data_resource_pools=self.agent_data_resource_pools,
368
351
  automatic_publish=True,
@@ -396,7 +379,6 @@ class TestAgentClient(unittest.TestCase):
396
379
  mock_response.json.return_value = expected_response
397
380
 
398
381
  result = self.client.update_agent(
399
- project_id=self.project_id,
400
382
  agent_id=self.agent_id,
401
383
  name="Upserted Agent",
402
384
  access_scope="private",
@@ -406,6 +388,7 @@ class TestAgentClient(unittest.TestCase):
406
388
  description="Upserted Description",
407
389
  agent_data_prompt=self.agent_data_prompt,
408
390
  agent_data_llm_config=self.agent_data_llm_config,
391
+ agent_data_strategy_name=self.agent_data_strategy_name,
409
392
  agent_data_models=self.agent_data_models,
410
393
  automatic_publish=False,
411
394
  upsert=True
@@ -425,7 +408,6 @@ class TestAgentClient(unittest.TestCase):
425
408
  mock_response.json.return_value = expected_response
426
409
 
427
410
  result = self.client.update_agent(
428
- project_id=self.project_id,
429
411
  agent_id=self.agent_id,
430
412
  name="Updated Agent No Pools",
431
413
  access_scope="private",
@@ -435,6 +417,7 @@ class TestAgentClient(unittest.TestCase):
435
417
  description="Updated Description",
436
418
  agent_data_prompt=self.agent_data_prompt,
437
419
  agent_data_llm_config=self.agent_data_llm_config,
420
+ agent_data_strategy_name=self.agent_data_strategy_name,
438
421
  agent_data_models=self.agent_data_models,
439
422
  automatic_publish=False,
440
423
  upsert=False
@@ -448,7 +431,6 @@ class TestAgentClient(unittest.TestCase):
448
431
  def test_update_agent_invalid_access_scope(self):
449
432
  with self.assertRaises(ValueError) as context:
450
433
  self.client.update_agent(
451
- project_id=self.project_id,
452
434
  agent_id=self.agent_id,
453
435
  name="Updated Agent",
454
436
  access_scope="invalid_scope",
@@ -458,6 +440,7 @@ class TestAgentClient(unittest.TestCase):
458
440
  description="Updated Description",
459
441
  agent_data_prompt=self.agent_data_prompt,
460
442
  agent_data_llm_config=self.agent_data_llm_config,
443
+ agent_data_strategy_name=self.agent_data_strategy_name,
461
444
  agent_data_models=self.agent_data_models
462
445
  )
463
446
  self.assertEqual(str(context.exception), f"Access scope must be one of {', '.join(VALID_ACCESS_SCOPES)}.")
@@ -471,7 +454,6 @@ class TestAgentClient(unittest.TestCase):
471
454
 
472
455
  with self.assertRaises(InvalidAPIResponseException) as context:
473
456
  self.client.update_agent(
474
- project_id=self.project_id,
475
457
  agent_id=self.agent_id,
476
458
  name="Updated Agent",
477
459
  access_scope="private",
@@ -481,6 +463,7 @@ class TestAgentClient(unittest.TestCase):
481
463
  description="Updated Description",
482
464
  agent_data_prompt=self.agent_data_prompt,
483
465
  agent_data_llm_config=self.agent_data_llm_config,
466
+ agent_data_strategy_name=self.agent_data_strategy_name,
484
467
  agent_data_models=self.agent_data_models
485
468
  )
486
469