hackagent 0.1.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 (117) hide show
  1. hackagent/__init__.py +23 -0
  2. hackagent/agent.py +193 -0
  3. hackagent/api/__init__.py +1 -0
  4. hackagent/api/agent/__init__.py +1 -0
  5. hackagent/api/agent/agent_create.py +340 -0
  6. hackagent/api/agent/agent_destroy.py +136 -0
  7. hackagent/api/agent/agent_list.py +234 -0
  8. hackagent/api/agent/agent_partial_update.py +354 -0
  9. hackagent/api/agent/agent_retrieve.py +227 -0
  10. hackagent/api/agent/agent_update.py +354 -0
  11. hackagent/api/attack/__init__.py +1 -0
  12. hackagent/api/attack/attack_create.py +264 -0
  13. hackagent/api/attack/attack_destroy.py +140 -0
  14. hackagent/api/attack/attack_list.py +242 -0
  15. hackagent/api/attack/attack_partial_update.py +278 -0
  16. hackagent/api/attack/attack_retrieve.py +235 -0
  17. hackagent/api/attack/attack_update.py +278 -0
  18. hackagent/api/key/__init__.py +1 -0
  19. hackagent/api/key/key_create.py +168 -0
  20. hackagent/api/key/key_destroy.py +97 -0
  21. hackagent/api/key/key_list.py +158 -0
  22. hackagent/api/key/key_retrieve.py +150 -0
  23. hackagent/api/prompt/__init__.py +1 -0
  24. hackagent/api/prompt/prompt_create.py +160 -0
  25. hackagent/api/prompt/prompt_destroy.py +98 -0
  26. hackagent/api/prompt/prompt_list.py +173 -0
  27. hackagent/api/prompt/prompt_partial_update.py +174 -0
  28. hackagent/api/prompt/prompt_retrieve.py +151 -0
  29. hackagent/api/prompt/prompt_update.py +174 -0
  30. hackagent/api/result/__init__.py +1 -0
  31. hackagent/api/result/result_create.py +160 -0
  32. hackagent/api/result/result_destroy.py +98 -0
  33. hackagent/api/result/result_list.py +233 -0
  34. hackagent/api/result/result_partial_update.py +178 -0
  35. hackagent/api/result/result_retrieve.py +151 -0
  36. hackagent/api/result/result_trace_create.py +178 -0
  37. hackagent/api/result/result_update.py +174 -0
  38. hackagent/api/run/__init__.py +1 -0
  39. hackagent/api/run/run_create.py +172 -0
  40. hackagent/api/run/run_destroy.py +104 -0
  41. hackagent/api/run/run_list.py +260 -0
  42. hackagent/api/run/run_partial_update.py +186 -0
  43. hackagent/api/run/run_result_create.py +178 -0
  44. hackagent/api/run/run_retrieve.py +163 -0
  45. hackagent/api/run/run_run_tests_create.py +172 -0
  46. hackagent/api/run/run_update.py +186 -0
  47. hackagent/attacks/AdvPrefix/README.md +7 -0
  48. hackagent/attacks/AdvPrefix/__init__.py +0 -0
  49. hackagent/attacks/AdvPrefix/completer.py +438 -0
  50. hackagent/attacks/AdvPrefix/config.py +59 -0
  51. hackagent/attacks/AdvPrefix/preprocessing.py +521 -0
  52. hackagent/attacks/AdvPrefix/scorer.py +259 -0
  53. hackagent/attacks/AdvPrefix/scorer_parser.py +498 -0
  54. hackagent/attacks/AdvPrefix/selector.py +246 -0
  55. hackagent/attacks/AdvPrefix/step1_generate.py +324 -0
  56. hackagent/attacks/AdvPrefix/step4_compute_ce.py +293 -0
  57. hackagent/attacks/AdvPrefix/step6_get_completions.py +387 -0
  58. hackagent/attacks/AdvPrefix/step7_evaluate_responses.py +289 -0
  59. hackagent/attacks/AdvPrefix/step8_aggregate_evaluations.py +177 -0
  60. hackagent/attacks/AdvPrefix/step9_select_prefixes.py +59 -0
  61. hackagent/attacks/AdvPrefix/utils.py +192 -0
  62. hackagent/attacks/__init__.py +6 -0
  63. hackagent/attacks/advprefix.py +1136 -0
  64. hackagent/attacks/base.py +50 -0
  65. hackagent/attacks/strategies.py +539 -0
  66. hackagent/branding.py +143 -0
  67. hackagent/client.py +328 -0
  68. hackagent/errors.py +31 -0
  69. hackagent/logger.py +67 -0
  70. hackagent/models/__init__.py +71 -0
  71. hackagent/models/agent.py +240 -0
  72. hackagent/models/agent_request.py +169 -0
  73. hackagent/models/agent_type_enum.py +12 -0
  74. hackagent/models/attack.py +154 -0
  75. hackagent/models/attack_request.py +82 -0
  76. hackagent/models/evaluation_status_enum.py +14 -0
  77. hackagent/models/organization_minimal.py +68 -0
  78. hackagent/models/paginated_agent_list.py +123 -0
  79. hackagent/models/paginated_attack_list.py +123 -0
  80. hackagent/models/paginated_prompt_list.py +123 -0
  81. hackagent/models/paginated_result_list.py +123 -0
  82. hackagent/models/paginated_run_list.py +123 -0
  83. hackagent/models/paginated_user_api_key_list.py +123 -0
  84. hackagent/models/patched_agent_request.py +176 -0
  85. hackagent/models/patched_attack_request.py +92 -0
  86. hackagent/models/patched_prompt_request.py +162 -0
  87. hackagent/models/patched_result_request.py +237 -0
  88. hackagent/models/patched_run_request.py +138 -0
  89. hackagent/models/prompt.py +226 -0
  90. hackagent/models/prompt_request.py +155 -0
  91. hackagent/models/result.py +294 -0
  92. hackagent/models/result_list_evaluation_status.py +14 -0
  93. hackagent/models/result_request.py +232 -0
  94. hackagent/models/run.py +233 -0
  95. hackagent/models/run_list_status.py +12 -0
  96. hackagent/models/run_request.py +133 -0
  97. hackagent/models/status_enum.py +12 -0
  98. hackagent/models/step_type_enum.py +14 -0
  99. hackagent/models/trace.py +121 -0
  100. hackagent/models/trace_request.py +94 -0
  101. hackagent/models/user_api_key.py +201 -0
  102. hackagent/models/user_api_key_request.py +73 -0
  103. hackagent/models/user_profile_minimal.py +76 -0
  104. hackagent/py.typed +1 -0
  105. hackagent/router/__init__.py +11 -0
  106. hackagent/router/adapters/__init__.py +5 -0
  107. hackagent/router/adapters/google_adk.py +658 -0
  108. hackagent/router/adapters/litellm_adapter.py +290 -0
  109. hackagent/router/base.py +48 -0
  110. hackagent/router/router.py +753 -0
  111. hackagent/types.py +46 -0
  112. hackagent/utils.py +61 -0
  113. hackagent/vulnerabilities/__init__.py +0 -0
  114. hackagent-0.1.0.dist-info/LICENSE +202 -0
  115. hackagent-0.1.0.dist-info/METADATA +173 -0
  116. hackagent-0.1.0.dist-info/RECORD +117 -0
  117. hackagent-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,354 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.agent import Agent
10
+ from ...models.patched_agent_request import PatchedAgentRequest
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: UUID,
16
+ *,
17
+ body: PatchedAgentRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "patch",
23
+ "url": f"/api/agent/{id}",
24
+ }
25
+
26
+ _body = body.to_dict()
27
+
28
+ _kwargs["json"] = _body
29
+ headers["Content-Type"] = "application/json"
30
+
31
+ _kwargs["headers"] = headers
32
+ return _kwargs
33
+
34
+
35
+ def _parse_response(
36
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
37
+ ) -> Optional[Agent]:
38
+ if response.status_code == 200:
39
+ response_200 = Agent.from_dict(response.json())
40
+
41
+ return response_200
42
+ if client.raise_on_unexpected_status:
43
+ raise errors.UnexpectedStatus(response.status_code, response.content)
44
+ else:
45
+ return None
46
+
47
+
48
+ def _build_response(
49
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
50
+ ) -> Response[Agent]:
51
+ return Response(
52
+ status_code=HTTPStatus(response.status_code),
53
+ content=response.content,
54
+ headers=response.headers,
55
+ parsed=_parse_response(client=client, response=response),
56
+ )
57
+
58
+
59
+ def sync_detailed(
60
+ id: UUID,
61
+ *,
62
+ client: AuthenticatedClient,
63
+ body: PatchedAgentRequest,
64
+ ) -> Response[Agent]:
65
+ """Provides CRUD operations for Agent instances.
66
+
67
+ This ViewSet manages Agent records, ensuring that users can only interact
68
+ with agents based on their permissions and organizational context.
69
+ It filters agent listings for users and handles the logic for creating
70
+ agents, including associating them with the correct organization and owner.
71
+
72
+ Authentication uses UserAPIKeyAuthentication and PrivyAuthentication.
73
+ Permissions are based on IsAuthenticated, with queryset filtering providing
74
+ row-level access control.
75
+
76
+ Class Attributes:
77
+ queryset (QuerySet): The default queryset for listing agents, initially all agents.
78
+ This is further filtered by `get_queryset()`.
79
+ serializer_class (AgentSerializer): The serializer used for validating and
80
+ deserializing input, and for serializing output.
81
+ authentication_classes (list): List of authentication classes to use.
82
+ permission_classes (list): List of permission classes to use.
83
+ parser_classes (list): List of parser classes for handling request data.
84
+ lookup_field (str): The model field used for looking up individual instances (UUID 'id').
85
+
86
+ Args:
87
+ id (UUID):
88
+ body (PatchedAgentRequest): Serializes Agent model instances to JSON and validates data
89
+ for creating
90
+ or updating Agent instances.
91
+
92
+ This serializer provides a comprehensive representation of an Agent,
93
+ including its type, endpoint, and nested details for related 'organization'
94
+ and 'owner' for read operations, while allowing 'organization' and 'owner' IDs
95
+ for write operations.
96
+
97
+ Attributes:
98
+ organization_detail (OrganizationMinimalSerializer): Read-only nested
99
+ serializer for the agent's organization. Displays minimal details.
100
+ owner_detail (UserProfileMinimalSerializer): Read-only nested serializer
101
+ for the agent's owner's user profile. Displays minimal details.
102
+ Can be null if the agent has no owner or the owner has no profile.
103
+ type (CharField): The type of the agent (e.g., GENERIC_ADK, OPENAI_SDK).
104
+ Uses the choices defined in the Agent model's AgentType enum.
105
+
106
+ Meta:
107
+ model (Agent): The model class that this serializer works with.
108
+ fields (tuple): The fields to include in the serialized output.
109
+ Includes standard Agent fields like 'endpoint', 'type',
110
+ and the read-only nested details.
111
+ read_only_fields (tuple): Fields that are read-only and cannot be
112
+ set during create/update operations through this serializer.
113
+ This includes 'id', 'created_at', 'updated_at', and the
114
+ nested detail fields.
115
+
116
+ Raises:
117
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
118
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
119
+
120
+ Returns:
121
+ Response[Agent]
122
+ """
123
+
124
+ kwargs = _get_kwargs(
125
+ id=id,
126
+ body=body,
127
+ )
128
+
129
+ response = client.get_httpx_client().request(
130
+ **kwargs,
131
+ )
132
+
133
+ return _build_response(client=client, response=response)
134
+
135
+
136
+ def sync(
137
+ id: UUID,
138
+ *,
139
+ client: AuthenticatedClient,
140
+ body: PatchedAgentRequest,
141
+ ) -> Optional[Agent]:
142
+ """Provides CRUD operations for Agent instances.
143
+
144
+ This ViewSet manages Agent records, ensuring that users can only interact
145
+ with agents based on their permissions and organizational context.
146
+ It filters agent listings for users and handles the logic for creating
147
+ agents, including associating them with the correct organization and owner.
148
+
149
+ Authentication uses UserAPIKeyAuthentication and PrivyAuthentication.
150
+ Permissions are based on IsAuthenticated, with queryset filtering providing
151
+ row-level access control.
152
+
153
+ Class Attributes:
154
+ queryset (QuerySet): The default queryset for listing agents, initially all agents.
155
+ This is further filtered by `get_queryset()`.
156
+ serializer_class (AgentSerializer): The serializer used for validating and
157
+ deserializing input, and for serializing output.
158
+ authentication_classes (list): List of authentication classes to use.
159
+ permission_classes (list): List of permission classes to use.
160
+ parser_classes (list): List of parser classes for handling request data.
161
+ lookup_field (str): The model field used for looking up individual instances (UUID 'id').
162
+
163
+ Args:
164
+ id (UUID):
165
+ body (PatchedAgentRequest): Serializes Agent model instances to JSON and validates data
166
+ for creating
167
+ or updating Agent instances.
168
+
169
+ This serializer provides a comprehensive representation of an Agent,
170
+ including its type, endpoint, and nested details for related 'organization'
171
+ and 'owner' for read operations, while allowing 'organization' and 'owner' IDs
172
+ for write operations.
173
+
174
+ Attributes:
175
+ organization_detail (OrganizationMinimalSerializer): Read-only nested
176
+ serializer for the agent's organization. Displays minimal details.
177
+ owner_detail (UserProfileMinimalSerializer): Read-only nested serializer
178
+ for the agent's owner's user profile. Displays minimal details.
179
+ Can be null if the agent has no owner or the owner has no profile.
180
+ type (CharField): The type of the agent (e.g., GENERIC_ADK, OPENAI_SDK).
181
+ Uses the choices defined in the Agent model's AgentType enum.
182
+
183
+ Meta:
184
+ model (Agent): The model class that this serializer works with.
185
+ fields (tuple): The fields to include in the serialized output.
186
+ Includes standard Agent fields like 'endpoint', 'type',
187
+ and the read-only nested details.
188
+ read_only_fields (tuple): Fields that are read-only and cannot be
189
+ set during create/update operations through this serializer.
190
+ This includes 'id', 'created_at', 'updated_at', and the
191
+ nested detail fields.
192
+
193
+ Raises:
194
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
195
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
196
+
197
+ Returns:
198
+ Agent
199
+ """
200
+
201
+ return sync_detailed(
202
+ id=id,
203
+ client=client,
204
+ body=body,
205
+ ).parsed
206
+
207
+
208
+ async def asyncio_detailed(
209
+ id: UUID,
210
+ *,
211
+ client: AuthenticatedClient,
212
+ body: PatchedAgentRequest,
213
+ ) -> Response[Agent]:
214
+ """Provides CRUD operations for Agent instances.
215
+
216
+ This ViewSet manages Agent records, ensuring that users can only interact
217
+ with agents based on their permissions and organizational context.
218
+ It filters agent listings for users and handles the logic for creating
219
+ agents, including associating them with the correct organization and owner.
220
+
221
+ Authentication uses UserAPIKeyAuthentication and PrivyAuthentication.
222
+ Permissions are based on IsAuthenticated, with queryset filtering providing
223
+ row-level access control.
224
+
225
+ Class Attributes:
226
+ queryset (QuerySet): The default queryset for listing agents, initially all agents.
227
+ This is further filtered by `get_queryset()`.
228
+ serializer_class (AgentSerializer): The serializer used for validating and
229
+ deserializing input, and for serializing output.
230
+ authentication_classes (list): List of authentication classes to use.
231
+ permission_classes (list): List of permission classes to use.
232
+ parser_classes (list): List of parser classes for handling request data.
233
+ lookup_field (str): The model field used for looking up individual instances (UUID 'id').
234
+
235
+ Args:
236
+ id (UUID):
237
+ body (PatchedAgentRequest): Serializes Agent model instances to JSON and validates data
238
+ for creating
239
+ or updating Agent instances.
240
+
241
+ This serializer provides a comprehensive representation of an Agent,
242
+ including its type, endpoint, and nested details for related 'organization'
243
+ and 'owner' for read operations, while allowing 'organization' and 'owner' IDs
244
+ for write operations.
245
+
246
+ Attributes:
247
+ organization_detail (OrganizationMinimalSerializer): Read-only nested
248
+ serializer for the agent's organization. Displays minimal details.
249
+ owner_detail (UserProfileMinimalSerializer): Read-only nested serializer
250
+ for the agent's owner's user profile. Displays minimal details.
251
+ Can be null if the agent has no owner or the owner has no profile.
252
+ type (CharField): The type of the agent (e.g., GENERIC_ADK, OPENAI_SDK).
253
+ Uses the choices defined in the Agent model's AgentType enum.
254
+
255
+ Meta:
256
+ model (Agent): The model class that this serializer works with.
257
+ fields (tuple): The fields to include in the serialized output.
258
+ Includes standard Agent fields like 'endpoint', 'type',
259
+ and the read-only nested details.
260
+ read_only_fields (tuple): Fields that are read-only and cannot be
261
+ set during create/update operations through this serializer.
262
+ This includes 'id', 'created_at', 'updated_at', and the
263
+ nested detail fields.
264
+
265
+ Raises:
266
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
267
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
268
+
269
+ Returns:
270
+ Response[Agent]
271
+ """
272
+
273
+ kwargs = _get_kwargs(
274
+ id=id,
275
+ body=body,
276
+ )
277
+
278
+ response = await client.get_async_httpx_client().request(**kwargs)
279
+
280
+ return _build_response(client=client, response=response)
281
+
282
+
283
+ async def asyncio(
284
+ id: UUID,
285
+ *,
286
+ client: AuthenticatedClient,
287
+ body: PatchedAgentRequest,
288
+ ) -> Optional[Agent]:
289
+ """Provides CRUD operations for Agent instances.
290
+
291
+ This ViewSet manages Agent records, ensuring that users can only interact
292
+ with agents based on their permissions and organizational context.
293
+ It filters agent listings for users and handles the logic for creating
294
+ agents, including associating them with the correct organization and owner.
295
+
296
+ Authentication uses UserAPIKeyAuthentication and PrivyAuthentication.
297
+ Permissions are based on IsAuthenticated, with queryset filtering providing
298
+ row-level access control.
299
+
300
+ Class Attributes:
301
+ queryset (QuerySet): The default queryset for listing agents, initially all agents.
302
+ This is further filtered by `get_queryset()`.
303
+ serializer_class (AgentSerializer): The serializer used for validating and
304
+ deserializing input, and for serializing output.
305
+ authentication_classes (list): List of authentication classes to use.
306
+ permission_classes (list): List of permission classes to use.
307
+ parser_classes (list): List of parser classes for handling request data.
308
+ lookup_field (str): The model field used for looking up individual instances (UUID 'id').
309
+
310
+ Args:
311
+ id (UUID):
312
+ body (PatchedAgentRequest): Serializes Agent model instances to JSON and validates data
313
+ for creating
314
+ or updating Agent instances.
315
+
316
+ This serializer provides a comprehensive representation of an Agent,
317
+ including its type, endpoint, and nested details for related 'organization'
318
+ and 'owner' for read operations, while allowing 'organization' and 'owner' IDs
319
+ for write operations.
320
+
321
+ Attributes:
322
+ organization_detail (OrganizationMinimalSerializer): Read-only nested
323
+ serializer for the agent's organization. Displays minimal details.
324
+ owner_detail (UserProfileMinimalSerializer): Read-only nested serializer
325
+ for the agent's owner's user profile. Displays minimal details.
326
+ Can be null if the agent has no owner or the owner has no profile.
327
+ type (CharField): The type of the agent (e.g., GENERIC_ADK, OPENAI_SDK).
328
+ Uses the choices defined in the Agent model's AgentType enum.
329
+
330
+ Meta:
331
+ model (Agent): The model class that this serializer works with.
332
+ fields (tuple): The fields to include in the serialized output.
333
+ Includes standard Agent fields like 'endpoint', 'type',
334
+ and the read-only nested details.
335
+ read_only_fields (tuple): Fields that are read-only and cannot be
336
+ set during create/update operations through this serializer.
337
+ This includes 'id', 'created_at', 'updated_at', and the
338
+ nested detail fields.
339
+
340
+ Raises:
341
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
342
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
343
+
344
+ Returns:
345
+ Agent
346
+ """
347
+
348
+ return (
349
+ await asyncio_detailed(
350
+ id=id,
351
+ client=client,
352
+ body=body,
353
+ )
354
+ ).parsed
@@ -0,0 +1,227 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.agent import Agent
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ id: UUID,
15
+ ) -> dict[str, Any]:
16
+ _kwargs: dict[str, Any] = {
17
+ "method": "get",
18
+ "url": f"/api/agent/{id}",
19
+ }
20
+
21
+ return _kwargs
22
+
23
+
24
+ def _parse_response(
25
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
26
+ ) -> Optional[Agent]:
27
+ if response.status_code == 200:
28
+ response_200 = Agent.from_dict(response.json())
29
+
30
+ return response_200
31
+ if client.raise_on_unexpected_status:
32
+ raise errors.UnexpectedStatus(response.status_code, response.content)
33
+ else:
34
+ return None
35
+
36
+
37
+ def _build_response(
38
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
39
+ ) -> Response[Agent]:
40
+ return Response(
41
+ status_code=HTTPStatus(response.status_code),
42
+ content=response.content,
43
+ headers=response.headers,
44
+ parsed=_parse_response(client=client, response=response),
45
+ )
46
+
47
+
48
+ def sync_detailed(
49
+ id: UUID,
50
+ *,
51
+ client: AuthenticatedClient,
52
+ ) -> Response[Agent]:
53
+ """Provides CRUD operations for Agent instances.
54
+
55
+ This ViewSet manages Agent records, ensuring that users can only interact
56
+ with agents based on their permissions and organizational context.
57
+ It filters agent listings for users and handles the logic for creating
58
+ agents, including associating them with the correct organization and owner.
59
+
60
+ Authentication uses UserAPIKeyAuthentication and PrivyAuthentication.
61
+ Permissions are based on IsAuthenticated, with queryset filtering providing
62
+ row-level access control.
63
+
64
+ Class Attributes:
65
+ queryset (QuerySet): The default queryset for listing agents, initially all agents.
66
+ This is further filtered by `get_queryset()`.
67
+ serializer_class (AgentSerializer): The serializer used for validating and
68
+ deserializing input, and for serializing output.
69
+ authentication_classes (list): List of authentication classes to use.
70
+ permission_classes (list): List of permission classes to use.
71
+ parser_classes (list): List of parser classes for handling request data.
72
+ lookup_field (str): The model field used for looking up individual instances (UUID 'id').
73
+
74
+ Args:
75
+ id (UUID):
76
+
77
+ Raises:
78
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
79
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
80
+
81
+ Returns:
82
+ Response[Agent]
83
+ """
84
+
85
+ kwargs = _get_kwargs(
86
+ id=id,
87
+ )
88
+
89
+ response = client.get_httpx_client().request(
90
+ **kwargs,
91
+ )
92
+
93
+ return _build_response(client=client, response=response)
94
+
95
+
96
+ def sync(
97
+ id: UUID,
98
+ *,
99
+ client: AuthenticatedClient,
100
+ ) -> Optional[Agent]:
101
+ """Provides CRUD operations for Agent instances.
102
+
103
+ This ViewSet manages Agent records, ensuring that users can only interact
104
+ with agents based on their permissions and organizational context.
105
+ It filters agent listings for users and handles the logic for creating
106
+ agents, including associating them with the correct organization and owner.
107
+
108
+ Authentication uses UserAPIKeyAuthentication and PrivyAuthentication.
109
+ Permissions are based on IsAuthenticated, with queryset filtering providing
110
+ row-level access control.
111
+
112
+ Class Attributes:
113
+ queryset (QuerySet): The default queryset for listing agents, initially all agents.
114
+ This is further filtered by `get_queryset()`.
115
+ serializer_class (AgentSerializer): The serializer used for validating and
116
+ deserializing input, and for serializing output.
117
+ authentication_classes (list): List of authentication classes to use.
118
+ permission_classes (list): List of permission classes to use.
119
+ parser_classes (list): List of parser classes for handling request data.
120
+ lookup_field (str): The model field used for looking up individual instances (UUID 'id').
121
+
122
+ Args:
123
+ id (UUID):
124
+
125
+ Raises:
126
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
128
+
129
+ Returns:
130
+ Agent
131
+ """
132
+
133
+ return sync_detailed(
134
+ id=id,
135
+ client=client,
136
+ ).parsed
137
+
138
+
139
+ async def asyncio_detailed(
140
+ id: UUID,
141
+ *,
142
+ client: AuthenticatedClient,
143
+ ) -> Response[Agent]:
144
+ """Provides CRUD operations for Agent instances.
145
+
146
+ This ViewSet manages Agent records, ensuring that users can only interact
147
+ with agents based on their permissions and organizational context.
148
+ It filters agent listings for users and handles the logic for creating
149
+ agents, including associating them with the correct organization and owner.
150
+
151
+ Authentication uses UserAPIKeyAuthentication and PrivyAuthentication.
152
+ Permissions are based on IsAuthenticated, with queryset filtering providing
153
+ row-level access control.
154
+
155
+ Class Attributes:
156
+ queryset (QuerySet): The default queryset for listing agents, initially all agents.
157
+ This is further filtered by `get_queryset()`.
158
+ serializer_class (AgentSerializer): The serializer used for validating and
159
+ deserializing input, and for serializing output.
160
+ authentication_classes (list): List of authentication classes to use.
161
+ permission_classes (list): List of permission classes to use.
162
+ parser_classes (list): List of parser classes for handling request data.
163
+ lookup_field (str): The model field used for looking up individual instances (UUID 'id').
164
+
165
+ Args:
166
+ id (UUID):
167
+
168
+ Raises:
169
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
170
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
171
+
172
+ Returns:
173
+ Response[Agent]
174
+ """
175
+
176
+ kwargs = _get_kwargs(
177
+ id=id,
178
+ )
179
+
180
+ response = await client.get_async_httpx_client().request(**kwargs)
181
+
182
+ return _build_response(client=client, response=response)
183
+
184
+
185
+ async def asyncio(
186
+ id: UUID,
187
+ *,
188
+ client: AuthenticatedClient,
189
+ ) -> Optional[Agent]:
190
+ """Provides CRUD operations for Agent instances.
191
+
192
+ This ViewSet manages Agent records, ensuring that users can only interact
193
+ with agents based on their permissions and organizational context.
194
+ It filters agent listings for users and handles the logic for creating
195
+ agents, including associating them with the correct organization and owner.
196
+
197
+ Authentication uses UserAPIKeyAuthentication and PrivyAuthentication.
198
+ Permissions are based on IsAuthenticated, with queryset filtering providing
199
+ row-level access control.
200
+
201
+ Class Attributes:
202
+ queryset (QuerySet): The default queryset for listing agents, initially all agents.
203
+ This is further filtered by `get_queryset()`.
204
+ serializer_class (AgentSerializer): The serializer used for validating and
205
+ deserializing input, and for serializing output.
206
+ authentication_classes (list): List of authentication classes to use.
207
+ permission_classes (list): List of permission classes to use.
208
+ parser_classes (list): List of parser classes for handling request data.
209
+ lookup_field (str): The model field used for looking up individual instances (UUID 'id').
210
+
211
+ Args:
212
+ id (UUID):
213
+
214
+ Raises:
215
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
216
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
217
+
218
+ Returns:
219
+ Agent
220
+ """
221
+
222
+ return (
223
+ await asyncio_detailed(
224
+ id=id,
225
+ client=client,
226
+ )
227
+ ).parsed