letta-client 0.1.2__py3-none-any.whl → 0.1.6__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 (65) hide show
  1. letta/__init__.py +40 -34
  2. letta/agents/__init__.py +55 -3
  3. letta/agents/client.py +513 -35
  4. letta/agents/messages/__init__.py +36 -2
  5. letta/agents/messages/client.py +46 -0
  6. letta/agents/messages/types/__init__.py +37 -3
  7. letta/agents/messages/types/letta_streaming_response.py +132 -14
  8. letta/agents/messages/types/messages_list_response_item.py +114 -7
  9. letta/agents/types/__init__.py +36 -2
  10. letta/agents/types/{agents_create_version_response.py → agents_get_agent_variables_response.py} +2 -5
  11. letta/agents/types/agents_search_deployed_agents_request_combinator.py +5 -0
  12. letta/agents/types/agents_search_deployed_agents_request_search_item.py +67 -0
  13. letta/agents/types/agents_search_deployed_agents_request_search_item_name.py +23 -0
  14. letta/agents/types/agents_search_deployed_agents_request_search_item_name_operator.py +7 -0
  15. letta/agents/types/agents_search_deployed_agents_request_search_item_order_by.py +26 -0
  16. letta/agents/types/agents_search_deployed_agents_request_search_item_order_by_direction.py +5 -0
  17. letta/agents/types/agents_search_deployed_agents_request_search_item_order_by_value.py +7 -0
  18. letta/{types/letta_response_tool_call.py → agents/types/agents_search_deployed_agents_request_search_item_version.py} +4 -6
  19. letta/client.py +8 -8
  20. letta/core/client_wrapper.py +7 -18
  21. letta/environment.py +1 -1
  22. letta/types/__init__.py +18 -32
  23. letta/types/agent_environment_variable.py +68 -0
  24. letta/types/agent_state.py +15 -9
  25. letta/types/assistant_message_output.py +1 -2
  26. letta/types/block.py +9 -9
  27. letta/types/context_window_overview.py +5 -0
  28. letta/types/embedding_config.py +13 -8
  29. letta/types/internal_server_error_body.py +1 -1
  30. letta/types/job.py +5 -5
  31. letta/types/letta_response.py +10 -97
  32. letta/types/letta_response_messages_item.py +120 -0
  33. letta/types/letta_schemas_message_message.py +10 -10
  34. letta/types/letta_schemas_tool_tool.py +5 -5
  35. letta/types/letta_usage_statistics.py +4 -4
  36. letta/types/llm_config.py +12 -7
  37. letta/types/not_found_error_body.py +2 -3
  38. letta/types/passage.py +8 -8
  39. letta/types/reasoning_message.py +4 -5
  40. letta/types/sandbox_environment_variable.py +4 -4
  41. letta/types/sandbox_environment_variable_update.py +0 -4
  42. letta/types/source.py +6 -6
  43. letta/types/system_message_output.py +4 -5
  44. letta/types/tool_call_message.py +4 -5
  45. letta/types/tool_return_message.py +8 -9
  46. letta/types/user.py +3 -3
  47. letta/types/user_message_output.py +4 -5
  48. {letta_client-0.1.2.dist-info → letta_client-0.1.6.dist-info}/METADATA +1 -1
  49. {letta_client-0.1.2.dist-info → letta_client-0.1.6.dist-info}/RECORD +50 -56
  50. {letta_client-0.1.2.dist-info → letta_client-0.1.6.dist-info}/WHEEL +1 -1
  51. letta/types/letta_response_assistant_message.py +0 -23
  52. letta/types/letta_response_letta_usage_statistics.py +0 -47
  53. letta/types/letta_response_reasoning_message.py +0 -32
  54. letta/types/letta_response_system_message.py +0 -32
  55. letta/types/letta_response_tool_call_delta.py +0 -21
  56. letta/types/letta_response_tool_call_message.py +0 -33
  57. letta/types/letta_response_tool_call_message_tool_call.py +0 -9
  58. letta/types/letta_response_tool_call_message_tool_call_one.py +0 -21
  59. letta/types/letta_response_tool_call_message_tool_call_zero.py +0 -21
  60. letta/types/letta_response_tool_return_message.py +0 -41
  61. letta/types/letta_response_tool_return_message_status.py +0 -5
  62. letta/types/letta_response_usage_message.py +0 -40
  63. letta/types/letta_response_usage_message_usage.py +0 -47
  64. letta/types/letta_response_user_message.py +0 -32
  65. letta/types/usage_message.py +0 -31
letta/agents/client.py CHANGED
@@ -28,12 +28,14 @@ from ..core.jsonable_encoder import jsonable_encoder
28
28
  from .types.update_agent_tool_rules_item import UpdateAgentToolRulesItem
29
29
  from ..types.block import Block
30
30
  from ..types.job import Job
31
- from .types.agents_create_version_response import AgentsCreateVersionResponse
31
+ from .types.agents_search_deployed_agents_request_search_item import AgentsSearchDeployedAgentsRequestSearchItem
32
+ from .types.agents_search_deployed_agents_request_combinator import AgentsSearchDeployedAgentsRequestCombinator
32
33
  from ..errors.not_found_error import NotFoundError
33
34
  from ..errors.internal_server_error import InternalServerError
34
35
  from .types.agents_migrate_response import AgentsMigrateResponse
35
36
  from ..errors.conflict_error import ConflictError
36
37
  from ..types.conflict_error_body import ConflictErrorBody
38
+ from .types.agents_get_agent_variables_response import AgentsGetAgentVariablesResponse
37
39
  from ..core.client_wrapper import AsyncClientWrapper
38
40
  from .context.client import AsyncContextClient
39
41
  from .tools.client import AsyncToolsClient
@@ -66,6 +68,8 @@ class AgentsClient:
66
68
  name: typing.Optional[str] = None,
67
69
  tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
68
70
  match_all_tags: typing.Optional[bool] = None,
71
+ cursor: typing.Optional[int] = None,
72
+ limit: typing.Optional[int] = None,
69
73
  request_options: typing.Optional[RequestOptions] = None,
70
74
  ) -> typing.List[AgentState]:
71
75
  """
@@ -83,6 +87,12 @@ class AgentsClient:
83
87
  match_all_tags : typing.Optional[bool]
84
88
  If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed in tags.
85
89
 
90
+ cursor : typing.Optional[int]
91
+ Cursor for pagination
92
+
93
+ limit : typing.Optional[int]
94
+ Limit for pagination
95
+
86
96
  request_options : typing.Optional[RequestOptions]
87
97
  Request-specific configuration.
88
98
 
@@ -107,6 +117,8 @@ class AgentsClient:
107
117
  "name": name,
108
118
  "tags": tags,
109
119
  "match_all_tags": match_all_tags,
120
+ "cursor": cursor,
121
+ "limit": limit,
110
122
  },
111
123
  request_options=request_options,
112
124
  )
@@ -157,6 +169,9 @@ class AgentsClient:
157
169
  embedding: typing.Optional[str] = OMIT,
158
170
  context_window_limit: typing.Optional[int] = OMIT,
159
171
  embedding_chunk_size: typing.Optional[int] = OMIT,
172
+ from_template: typing.Optional[str] = OMIT,
173
+ project_id: typing.Optional[str] = OMIT,
174
+ tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
160
175
  user_id: typing.Optional[str] = OMIT,
161
176
  request_options: typing.Optional[RequestOptions] = None,
162
177
  ) -> AgentState:
@@ -225,6 +240,15 @@ class AgentsClient:
225
240
  embedding_chunk_size : typing.Optional[int]
226
241
  The embedding chunk size used by the agent.
227
242
 
243
+ from_template : typing.Optional[str]
244
+ The template id used to configure the agent
245
+
246
+ project_id : typing.Optional[str]
247
+ The project id that the agent will be associated with.
248
+
249
+ tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
250
+ The environment variables for tool execution specific to this agent.
251
+
228
252
  user_id : typing.Optional[str]
229
253
 
230
254
  request_options : typing.Optional[RequestOptions]
@@ -285,6 +309,9 @@ class AgentsClient:
285
309
  "embedding": embedding,
286
310
  "context_window_limit": context_window_limit,
287
311
  "embedding_chunk_size": embedding_chunk_size,
312
+ "from_template": from_template,
313
+ "project_id": project_id,
314
+ "tool_exec_environment_variables": tool_exec_environment_variables,
288
315
  "user_id": user_id,
289
316
  },
290
317
  headers={
@@ -373,7 +400,9 @@ class AgentsClient:
373
400
  raise ApiError(status_code=_response.status_code, body=_response.text)
374
401
  raise ApiError(status_code=_response.status_code, body=_response_json)
375
402
 
376
- def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentState:
403
+ def delete(
404
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
405
+ ) -> typing.Optional[typing.Any]:
377
406
  """
378
407
  Delete an agent.
379
408
 
@@ -386,7 +415,7 @@ class AgentsClient:
386
415
 
387
416
  Returns
388
417
  -------
389
- AgentState
418
+ typing.Optional[typing.Any]
390
419
  Successful Response
391
420
 
392
421
  Examples
@@ -408,9 +437,9 @@ class AgentsClient:
408
437
  try:
409
438
  if 200 <= _response.status_code < 300:
410
439
  return typing.cast(
411
- AgentState,
440
+ typing.Optional[typing.Any],
412
441
  parse_obj_as(
413
- type_=AgentState, # type: ignore
442
+ type_=typing.Optional[typing.Any], # type: ignore
414
443
  object_=_response.json(),
415
444
  ),
416
445
  )
@@ -445,6 +474,7 @@ class AgentsClient:
445
474
  message_ids: typing.Optional[typing.Sequence[str]] = OMIT,
446
475
  description: typing.Optional[str] = OMIT,
447
476
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
477
+ tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
448
478
  request_options: typing.Optional[RequestOptions] = None,
449
479
  ) -> AgentState:
450
480
  """
@@ -490,6 +520,9 @@ class AgentsClient:
490
520
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
491
521
  The metadata of the agent.
492
522
 
523
+ tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
524
+ The environment variables for tool execution specific to this agent.
525
+
493
526
  request_options : typing.Optional[RequestOptions]
494
527
  Request-specific configuration.
495
528
 
@@ -531,6 +564,7 @@ class AgentsClient:
531
564
  "message_ids": message_ids,
532
565
  "description": description,
533
566
  "metadata_": metadata,
567
+ "tool_exec_environment_variables": tool_exec_environment_variables,
534
568
  },
535
569
  headers={
536
570
  "content-type": "application/json",
@@ -872,14 +906,83 @@ class AgentsClient:
872
906
  raise ApiError(status_code=_response.status_code, body=_response.text)
873
907
  raise ApiError(status_code=_response.status_code, body=_response_json)
874
908
 
909
+ def searchdeployedagents(
910
+ self,
911
+ *,
912
+ search: typing.Optional[typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem]] = OMIT,
913
+ project_id: typing.Optional[str] = OMIT,
914
+ combinator: typing.Optional[AgentsSearchDeployedAgentsRequestCombinator] = OMIT,
915
+ limit: typing.Optional[float] = OMIT,
916
+ offset: typing.Optional[float] = OMIT,
917
+ request_options: typing.Optional[RequestOptions] = None,
918
+ ) -> None:
919
+ """
920
+ Search deployed agents
921
+
922
+ Parameters
923
+ ----------
924
+ search : typing.Optional[typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem]]
925
+
926
+ project_id : typing.Optional[str]
927
+
928
+ combinator : typing.Optional[AgentsSearchDeployedAgentsRequestCombinator]
929
+
930
+ limit : typing.Optional[float]
931
+
932
+ offset : typing.Optional[float]
933
+
934
+ request_options : typing.Optional[RequestOptions]
935
+ Request-specific configuration.
936
+
937
+ Returns
938
+ -------
939
+ None
940
+
941
+ Examples
942
+ --------
943
+ from letta import Letta
944
+
945
+ client = Letta(
946
+ token="YOUR_TOKEN",
947
+ )
948
+ client.agents.searchdeployedagents()
949
+ """
950
+ _response = self._client_wrapper.httpx_client.request(
951
+ "v1/agents/search",
952
+ method="POST",
953
+ json={
954
+ "search": convert_and_respect_annotation_metadata(
955
+ object_=search,
956
+ annotation=typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem],
957
+ direction="write",
958
+ ),
959
+ "project_id": project_id,
960
+ "combinator": combinator,
961
+ "limit": limit,
962
+ "offset": offset,
963
+ },
964
+ headers={
965
+ "content-type": "application/json",
966
+ },
967
+ request_options=request_options,
968
+ omit=OMIT,
969
+ )
970
+ try:
971
+ if 200 <= _response.status_code < 300:
972
+ return
973
+ _response_json = _response.json()
974
+ except JSONDecodeError:
975
+ raise ApiError(status_code=_response.status_code, body=_response.text)
976
+ raise ApiError(status_code=_response.status_code, body=_response_json)
977
+
875
978
  def create_version(
876
979
  self,
877
980
  agent_id: str,
878
981
  *,
879
- return_agent_id: typing.Optional[bool] = None,
982
+ return_agent_state: typing.Optional[bool] = None,
880
983
  migrate_deployed_agents: typing.Optional[bool] = OMIT,
881
984
  request_options: typing.Optional[RequestOptions] = None,
882
- ) -> AgentsCreateVersionResponse:
985
+ ) -> None:
883
986
  """
884
987
  Creates a versioned version of an agent
885
988
 
@@ -888,7 +991,7 @@ class AgentsClient:
888
991
  agent_id : str
889
992
  The agent ID of the agent to migrate, if this agent is not a template, it will create a agent template from the agent provided as well
890
993
 
891
- return_agent_id : typing.Optional[bool]
994
+ return_agent_state : typing.Optional[bool]
892
995
 
893
996
  migrate_deployed_agents : typing.Optional[bool]
894
997
 
@@ -897,8 +1000,7 @@ class AgentsClient:
897
1000
 
898
1001
  Returns
899
1002
  -------
900
- AgentsCreateVersionResponse
901
- 201
1003
+ None
902
1004
 
903
1005
  Examples
904
1006
  --------
@@ -915,7 +1017,7 @@ class AgentsClient:
915
1017
  f"v1/agents/{jsonable_encoder(agent_id)}/version-template",
916
1018
  method="POST",
917
1019
  params={
918
- "returnAgentId": return_agent_id,
1020
+ "returnAgentState": return_agent_state,
919
1021
  },
920
1022
  json={
921
1023
  "migrate_deployed_agents": migrate_deployed_agents,
@@ -928,13 +1030,7 @@ class AgentsClient:
928
1030
  )
929
1031
  try:
930
1032
  if 200 <= _response.status_code < 300:
931
- return typing.cast(
932
- AgentsCreateVersionResponse,
933
- parse_obj_as(
934
- type_=AgentsCreateVersionResponse, # type: ignore
935
- object_=_response.json(),
936
- ),
937
- )
1033
+ return
938
1034
  if _response.status_code == 404:
939
1035
  raise NotFoundError(
940
1036
  typing.cast(
@@ -1062,6 +1158,138 @@ class AgentsClient:
1062
1158
  raise ApiError(status_code=_response.status_code, body=_response.text)
1063
1159
  raise ApiError(status_code=_response.status_code, body=_response_json)
1064
1160
 
1161
+ def createtemplatefromagent(
1162
+ self,
1163
+ agent_id: str,
1164
+ *,
1165
+ project_id: typing.Optional[str] = OMIT,
1166
+ request_options: typing.Optional[RequestOptions] = None,
1167
+ ) -> None:
1168
+ """
1169
+ Create a template from an agent
1170
+
1171
+ Parameters
1172
+ ----------
1173
+ agent_id : str
1174
+
1175
+ project_id : typing.Optional[str]
1176
+
1177
+ request_options : typing.Optional[RequestOptions]
1178
+ Request-specific configuration.
1179
+
1180
+ Returns
1181
+ -------
1182
+ None
1183
+
1184
+ Examples
1185
+ --------
1186
+ from letta import Letta
1187
+
1188
+ client = Letta(
1189
+ token="YOUR_TOKEN",
1190
+ )
1191
+ client.agents.createtemplatefromagent(
1192
+ agent_id="agent_id",
1193
+ )
1194
+ """
1195
+ _response = self._client_wrapper.httpx_client.request(
1196
+ f"v1/agents/{jsonable_encoder(agent_id)}/template",
1197
+ method="POST",
1198
+ json={
1199
+ "project_id": project_id,
1200
+ },
1201
+ headers={
1202
+ "content-type": "application/json",
1203
+ },
1204
+ request_options=request_options,
1205
+ omit=OMIT,
1206
+ )
1207
+ try:
1208
+ if 200 <= _response.status_code < 300:
1209
+ return
1210
+ if _response.status_code == 404:
1211
+ raise NotFoundError(
1212
+ typing.cast(
1213
+ typing.Optional[typing.Any],
1214
+ parse_obj_as(
1215
+ type_=typing.Optional[typing.Any], # type: ignore
1216
+ object_=_response.json(),
1217
+ ),
1218
+ )
1219
+ )
1220
+ if _response.status_code == 500:
1221
+ raise InternalServerError(
1222
+ typing.cast(
1223
+ typing.Optional[typing.Any],
1224
+ parse_obj_as(
1225
+ type_=typing.Optional[typing.Any], # type: ignore
1226
+ object_=_response.json(),
1227
+ ),
1228
+ )
1229
+ )
1230
+ _response_json = _response.json()
1231
+ except JSONDecodeError:
1232
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1233
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1234
+
1235
+ def getagentvariables(
1236
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
1237
+ ) -> AgentsGetAgentVariablesResponse:
1238
+ """
1239
+ Get the variables associated with an agent
1240
+
1241
+ Parameters
1242
+ ----------
1243
+ agent_id : str
1244
+
1245
+ request_options : typing.Optional[RequestOptions]
1246
+ Request-specific configuration.
1247
+
1248
+ Returns
1249
+ -------
1250
+ AgentsGetAgentVariablesResponse
1251
+ 200
1252
+
1253
+ Examples
1254
+ --------
1255
+ from letta import Letta
1256
+
1257
+ client = Letta(
1258
+ token="YOUR_TOKEN",
1259
+ )
1260
+ client.agents.getagentvariables(
1261
+ agent_id="agent_id",
1262
+ )
1263
+ """
1264
+ _response = self._client_wrapper.httpx_client.request(
1265
+ f"v1/agents/{jsonable_encoder(agent_id)}/variables",
1266
+ method="GET",
1267
+ request_options=request_options,
1268
+ )
1269
+ try:
1270
+ if 200 <= _response.status_code < 300:
1271
+ return typing.cast(
1272
+ AgentsGetAgentVariablesResponse,
1273
+ parse_obj_as(
1274
+ type_=AgentsGetAgentVariablesResponse, # type: ignore
1275
+ object_=_response.json(),
1276
+ ),
1277
+ )
1278
+ if _response.status_code == 404:
1279
+ raise NotFoundError(
1280
+ typing.cast(
1281
+ typing.Optional[typing.Any],
1282
+ parse_obj_as(
1283
+ type_=typing.Optional[typing.Any], # type: ignore
1284
+ object_=_response.json(),
1285
+ ),
1286
+ )
1287
+ )
1288
+ _response_json = _response.json()
1289
+ except JSONDecodeError:
1290
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1291
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1292
+
1065
1293
 
1066
1294
  class AsyncAgentsClient:
1067
1295
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -1081,6 +1309,8 @@ class AsyncAgentsClient:
1081
1309
  name: typing.Optional[str] = None,
1082
1310
  tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1083
1311
  match_all_tags: typing.Optional[bool] = None,
1312
+ cursor: typing.Optional[int] = None,
1313
+ limit: typing.Optional[int] = None,
1084
1314
  request_options: typing.Optional[RequestOptions] = None,
1085
1315
  ) -> typing.List[AgentState]:
1086
1316
  """
@@ -1098,6 +1328,12 @@ class AsyncAgentsClient:
1098
1328
  match_all_tags : typing.Optional[bool]
1099
1329
  If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed in tags.
1100
1330
 
1331
+ cursor : typing.Optional[int]
1332
+ Cursor for pagination
1333
+
1334
+ limit : typing.Optional[int]
1335
+ Limit for pagination
1336
+
1101
1337
  request_options : typing.Optional[RequestOptions]
1102
1338
  Request-specific configuration.
1103
1339
 
@@ -1130,6 +1366,8 @@ class AsyncAgentsClient:
1130
1366
  "name": name,
1131
1367
  "tags": tags,
1132
1368
  "match_all_tags": match_all_tags,
1369
+ "cursor": cursor,
1370
+ "limit": limit,
1133
1371
  },
1134
1372
  request_options=request_options,
1135
1373
  )
@@ -1180,6 +1418,9 @@ class AsyncAgentsClient:
1180
1418
  embedding: typing.Optional[str] = OMIT,
1181
1419
  context_window_limit: typing.Optional[int] = OMIT,
1182
1420
  embedding_chunk_size: typing.Optional[int] = OMIT,
1421
+ from_template: typing.Optional[str] = OMIT,
1422
+ project_id: typing.Optional[str] = OMIT,
1423
+ tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
1183
1424
  user_id: typing.Optional[str] = OMIT,
1184
1425
  request_options: typing.Optional[RequestOptions] = None,
1185
1426
  ) -> AgentState:
@@ -1248,6 +1489,15 @@ class AsyncAgentsClient:
1248
1489
  embedding_chunk_size : typing.Optional[int]
1249
1490
  The embedding chunk size used by the agent.
1250
1491
 
1492
+ from_template : typing.Optional[str]
1493
+ The template id used to configure the agent
1494
+
1495
+ project_id : typing.Optional[str]
1496
+ The project id that the agent will be associated with.
1497
+
1498
+ tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
1499
+ The environment variables for tool execution specific to this agent.
1500
+
1251
1501
  user_id : typing.Optional[str]
1252
1502
 
1253
1503
  request_options : typing.Optional[RequestOptions]
@@ -1316,6 +1566,9 @@ class AsyncAgentsClient:
1316
1566
  "embedding": embedding,
1317
1567
  "context_window_limit": context_window_limit,
1318
1568
  "embedding_chunk_size": embedding_chunk_size,
1569
+ "from_template": from_template,
1570
+ "project_id": project_id,
1571
+ "tool_exec_environment_variables": tool_exec_environment_variables,
1319
1572
  "user_id": user_id,
1320
1573
  },
1321
1574
  headers={
@@ -1412,7 +1665,9 @@ class AsyncAgentsClient:
1412
1665
  raise ApiError(status_code=_response.status_code, body=_response.text)
1413
1666
  raise ApiError(status_code=_response.status_code, body=_response_json)
1414
1667
 
1415
- async def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentState:
1668
+ async def delete(
1669
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
1670
+ ) -> typing.Optional[typing.Any]:
1416
1671
  """
1417
1672
  Delete an agent.
1418
1673
 
@@ -1425,7 +1680,7 @@ class AsyncAgentsClient:
1425
1680
 
1426
1681
  Returns
1427
1682
  -------
1428
- AgentState
1683
+ typing.Optional[typing.Any]
1429
1684
  Successful Response
1430
1685
 
1431
1686
  Examples
@@ -1455,9 +1710,9 @@ class AsyncAgentsClient:
1455
1710
  try:
1456
1711
  if 200 <= _response.status_code < 300:
1457
1712
  return typing.cast(
1458
- AgentState,
1713
+ typing.Optional[typing.Any],
1459
1714
  parse_obj_as(
1460
- type_=AgentState, # type: ignore
1715
+ type_=typing.Optional[typing.Any], # type: ignore
1461
1716
  object_=_response.json(),
1462
1717
  ),
1463
1718
  )
@@ -1492,6 +1747,7 @@ class AsyncAgentsClient:
1492
1747
  message_ids: typing.Optional[typing.Sequence[str]] = OMIT,
1493
1748
  description: typing.Optional[str] = OMIT,
1494
1749
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1750
+ tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
1495
1751
  request_options: typing.Optional[RequestOptions] = None,
1496
1752
  ) -> AgentState:
1497
1753
  """
@@ -1537,6 +1793,9 @@ class AsyncAgentsClient:
1537
1793
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1538
1794
  The metadata of the agent.
1539
1795
 
1796
+ tool_exec_environment_variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
1797
+ The environment variables for tool execution specific to this agent.
1798
+
1540
1799
  request_options : typing.Optional[RequestOptions]
1541
1800
  Request-specific configuration.
1542
1801
 
@@ -1586,6 +1845,7 @@ class AsyncAgentsClient:
1586
1845
  "message_ids": message_ids,
1587
1846
  "description": description,
1588
1847
  "metadata_": metadata,
1848
+ "tool_exec_environment_variables": tool_exec_environment_variables,
1589
1849
  },
1590
1850
  headers={
1591
1851
  "content-type": "application/json",
@@ -1959,14 +2219,91 @@ class AsyncAgentsClient:
1959
2219
  raise ApiError(status_code=_response.status_code, body=_response.text)
1960
2220
  raise ApiError(status_code=_response.status_code, body=_response_json)
1961
2221
 
2222
+ async def searchdeployedagents(
2223
+ self,
2224
+ *,
2225
+ search: typing.Optional[typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem]] = OMIT,
2226
+ project_id: typing.Optional[str] = OMIT,
2227
+ combinator: typing.Optional[AgentsSearchDeployedAgentsRequestCombinator] = OMIT,
2228
+ limit: typing.Optional[float] = OMIT,
2229
+ offset: typing.Optional[float] = OMIT,
2230
+ request_options: typing.Optional[RequestOptions] = None,
2231
+ ) -> None:
2232
+ """
2233
+ Search deployed agents
2234
+
2235
+ Parameters
2236
+ ----------
2237
+ search : typing.Optional[typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem]]
2238
+
2239
+ project_id : typing.Optional[str]
2240
+
2241
+ combinator : typing.Optional[AgentsSearchDeployedAgentsRequestCombinator]
2242
+
2243
+ limit : typing.Optional[float]
2244
+
2245
+ offset : typing.Optional[float]
2246
+
2247
+ request_options : typing.Optional[RequestOptions]
2248
+ Request-specific configuration.
2249
+
2250
+ Returns
2251
+ -------
2252
+ None
2253
+
2254
+ Examples
2255
+ --------
2256
+ import asyncio
2257
+
2258
+ from letta import AsyncLetta
2259
+
2260
+ client = AsyncLetta(
2261
+ token="YOUR_TOKEN",
2262
+ )
2263
+
2264
+
2265
+ async def main() -> None:
2266
+ await client.agents.searchdeployedagents()
2267
+
2268
+
2269
+ asyncio.run(main())
2270
+ """
2271
+ _response = await self._client_wrapper.httpx_client.request(
2272
+ "v1/agents/search",
2273
+ method="POST",
2274
+ json={
2275
+ "search": convert_and_respect_annotation_metadata(
2276
+ object_=search,
2277
+ annotation=typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem],
2278
+ direction="write",
2279
+ ),
2280
+ "project_id": project_id,
2281
+ "combinator": combinator,
2282
+ "limit": limit,
2283
+ "offset": offset,
2284
+ },
2285
+ headers={
2286
+ "content-type": "application/json",
2287
+ },
2288
+ request_options=request_options,
2289
+ omit=OMIT,
2290
+ )
2291
+ try:
2292
+ if 200 <= _response.status_code < 300:
2293
+ return
2294
+ _response_json = _response.json()
2295
+ except JSONDecodeError:
2296
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2297
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2298
+
1962
2299
  async def create_version(
1963
2300
  self,
1964
2301
  agent_id: str,
1965
2302
  *,
1966
- return_agent_id: typing.Optional[bool] = None,
2303
+ return_agent_state: typing.Optional[bool] = None,
1967
2304
  migrate_deployed_agents: typing.Optional[bool] = OMIT,
1968
2305
  request_options: typing.Optional[RequestOptions] = None,
1969
- ) -> AgentsCreateVersionResponse:
2306
+ ) -> None:
1970
2307
  """
1971
2308
  Creates a versioned version of an agent
1972
2309
 
@@ -1975,7 +2312,7 @@ class AsyncAgentsClient:
1975
2312
  agent_id : str
1976
2313
  The agent ID of the agent to migrate, if this agent is not a template, it will create a agent template from the agent provided as well
1977
2314
 
1978
- return_agent_id : typing.Optional[bool]
2315
+ return_agent_state : typing.Optional[bool]
1979
2316
 
1980
2317
  migrate_deployed_agents : typing.Optional[bool]
1981
2318
 
@@ -1984,8 +2321,7 @@ class AsyncAgentsClient:
1984
2321
 
1985
2322
  Returns
1986
2323
  -------
1987
- AgentsCreateVersionResponse
1988
- 201
2324
+ None
1989
2325
 
1990
2326
  Examples
1991
2327
  --------
@@ -2010,7 +2346,7 @@ class AsyncAgentsClient:
2010
2346
  f"v1/agents/{jsonable_encoder(agent_id)}/version-template",
2011
2347
  method="POST",
2012
2348
  params={
2013
- "returnAgentId": return_agent_id,
2349
+ "returnAgentState": return_agent_state,
2014
2350
  },
2015
2351
  json={
2016
2352
  "migrate_deployed_agents": migrate_deployed_agents,
@@ -2023,13 +2359,7 @@ class AsyncAgentsClient:
2023
2359
  )
2024
2360
  try:
2025
2361
  if 200 <= _response.status_code < 300:
2026
- return typing.cast(
2027
- AgentsCreateVersionResponse,
2028
- parse_obj_as(
2029
- type_=AgentsCreateVersionResponse, # type: ignore
2030
- object_=_response.json(),
2031
- ),
2032
- )
2362
+ return
2033
2363
  if _response.status_code == 404:
2034
2364
  raise NotFoundError(
2035
2365
  typing.cast(
@@ -2164,3 +2494,151 @@ class AsyncAgentsClient:
2164
2494
  except JSONDecodeError:
2165
2495
  raise ApiError(status_code=_response.status_code, body=_response.text)
2166
2496
  raise ApiError(status_code=_response.status_code, body=_response_json)
2497
+
2498
+ async def createtemplatefromagent(
2499
+ self,
2500
+ agent_id: str,
2501
+ *,
2502
+ project_id: typing.Optional[str] = OMIT,
2503
+ request_options: typing.Optional[RequestOptions] = None,
2504
+ ) -> None:
2505
+ """
2506
+ Create a template from an agent
2507
+
2508
+ Parameters
2509
+ ----------
2510
+ agent_id : str
2511
+
2512
+ project_id : typing.Optional[str]
2513
+
2514
+ request_options : typing.Optional[RequestOptions]
2515
+ Request-specific configuration.
2516
+
2517
+ Returns
2518
+ -------
2519
+ None
2520
+
2521
+ Examples
2522
+ --------
2523
+ import asyncio
2524
+
2525
+ from letta import AsyncLetta
2526
+
2527
+ client = AsyncLetta(
2528
+ token="YOUR_TOKEN",
2529
+ )
2530
+
2531
+
2532
+ async def main() -> None:
2533
+ await client.agents.createtemplatefromagent(
2534
+ agent_id="agent_id",
2535
+ )
2536
+
2537
+
2538
+ asyncio.run(main())
2539
+ """
2540
+ _response = await self._client_wrapper.httpx_client.request(
2541
+ f"v1/agents/{jsonable_encoder(agent_id)}/template",
2542
+ method="POST",
2543
+ json={
2544
+ "project_id": project_id,
2545
+ },
2546
+ headers={
2547
+ "content-type": "application/json",
2548
+ },
2549
+ request_options=request_options,
2550
+ omit=OMIT,
2551
+ )
2552
+ try:
2553
+ if 200 <= _response.status_code < 300:
2554
+ return
2555
+ if _response.status_code == 404:
2556
+ raise NotFoundError(
2557
+ typing.cast(
2558
+ typing.Optional[typing.Any],
2559
+ parse_obj_as(
2560
+ type_=typing.Optional[typing.Any], # type: ignore
2561
+ object_=_response.json(),
2562
+ ),
2563
+ )
2564
+ )
2565
+ if _response.status_code == 500:
2566
+ raise InternalServerError(
2567
+ typing.cast(
2568
+ typing.Optional[typing.Any],
2569
+ parse_obj_as(
2570
+ type_=typing.Optional[typing.Any], # type: ignore
2571
+ object_=_response.json(),
2572
+ ),
2573
+ )
2574
+ )
2575
+ _response_json = _response.json()
2576
+ except JSONDecodeError:
2577
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2578
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2579
+
2580
+ async def getagentvariables(
2581
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
2582
+ ) -> AgentsGetAgentVariablesResponse:
2583
+ """
2584
+ Get the variables associated with an agent
2585
+
2586
+ Parameters
2587
+ ----------
2588
+ agent_id : str
2589
+
2590
+ request_options : typing.Optional[RequestOptions]
2591
+ Request-specific configuration.
2592
+
2593
+ Returns
2594
+ -------
2595
+ AgentsGetAgentVariablesResponse
2596
+ 200
2597
+
2598
+ Examples
2599
+ --------
2600
+ import asyncio
2601
+
2602
+ from letta import AsyncLetta
2603
+
2604
+ client = AsyncLetta(
2605
+ token="YOUR_TOKEN",
2606
+ )
2607
+
2608
+
2609
+ async def main() -> None:
2610
+ await client.agents.getagentvariables(
2611
+ agent_id="agent_id",
2612
+ )
2613
+
2614
+
2615
+ asyncio.run(main())
2616
+ """
2617
+ _response = await self._client_wrapper.httpx_client.request(
2618
+ f"v1/agents/{jsonable_encoder(agent_id)}/variables",
2619
+ method="GET",
2620
+ request_options=request_options,
2621
+ )
2622
+ try:
2623
+ if 200 <= _response.status_code < 300:
2624
+ return typing.cast(
2625
+ AgentsGetAgentVariablesResponse,
2626
+ parse_obj_as(
2627
+ type_=AgentsGetAgentVariablesResponse, # type: ignore
2628
+ object_=_response.json(),
2629
+ ),
2630
+ )
2631
+ if _response.status_code == 404:
2632
+ raise NotFoundError(
2633
+ typing.cast(
2634
+ typing.Optional[typing.Any],
2635
+ parse_obj_as(
2636
+ type_=typing.Optional[typing.Any], # type: ignore
2637
+ object_=_response.json(),
2638
+ ),
2639
+ )
2640
+ )
2641
+ _response_json = _response.json()
2642
+ except JSONDecodeError:
2643
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2644
+ raise ApiError(status_code=_response.status_code, body=_response_json)