letta-client 0.1.2__py3-none-any.whl → 0.1.4__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 (41) hide show
  1. letta/__init__.py +18 -34
  2. letta/agents/__init__.py +18 -2
  3. letta/agents/client.py +473 -35
  4. letta/agents/types/__init__.py +28 -2
  5. letta/agents/types/{agents_create_version_response.py → agents_get_agent_variables_response.py} +2 -5
  6. letta/agents/types/agents_search_deployed_agents_request_combinator.py +5 -0
  7. letta/agents/types/agents_search_deployed_agents_request_search_item.py +16 -0
  8. letta/agents/types/agents_search_deployed_agents_request_search_item_direction.py +27 -0
  9. letta/agents/types/agents_search_deployed_agents_request_search_item_direction_direction.py +5 -0
  10. letta/agents/types/agents_search_deployed_agents_request_search_item_direction_value.py +7 -0
  11. letta/agents/types/agents_search_deployed_agents_request_search_item_operator.py +24 -0
  12. letta/agents/types/agents_search_deployed_agents_request_search_item_operator_operator.py +7 -0
  13. letta/{types/letta_response_tool_call_message_tool_call_zero.py → agents/types/agents_search_deployed_agents_request_search_item_zero.py} +5 -6
  14. letta/client.py +4 -4
  15. letta/core/client_wrapper.py +1 -1
  16. letta/environment.py +1 -1
  17. letta/types/__init__.py +0 -32
  18. letta/types/embedding_config.py +5 -0
  19. letta/types/internal_server_error_body.py +1 -1
  20. letta/types/letta_response.py +9 -97
  21. letta/types/letta_usage_statistics.py +1 -0
  22. letta/types/llm_config.py +5 -0
  23. letta/types/not_found_error_body.py +2 -3
  24. {letta_client-0.1.2.dist-info → letta_client-0.1.4.dist-info}/METADATA +1 -1
  25. {letta_client-0.1.2.dist-info → letta_client-0.1.4.dist-info}/RECORD +26 -34
  26. {letta_client-0.1.2.dist-info → letta_client-0.1.4.dist-info}/WHEEL +1 -1
  27. letta/types/letta_response_assistant_message.py +0 -23
  28. letta/types/letta_response_letta_usage_statistics.py +0 -47
  29. letta/types/letta_response_reasoning_message.py +0 -32
  30. letta/types/letta_response_system_message.py +0 -32
  31. letta/types/letta_response_tool_call.py +0 -21
  32. letta/types/letta_response_tool_call_delta.py +0 -21
  33. letta/types/letta_response_tool_call_message.py +0 -33
  34. letta/types/letta_response_tool_call_message_tool_call.py +0 -9
  35. letta/types/letta_response_tool_call_message_tool_call_one.py +0 -21
  36. letta/types/letta_response_tool_return_message.py +0 -41
  37. letta/types/letta_response_tool_return_message_status.py +0 -5
  38. letta/types/letta_response_usage_message.py +0 -40
  39. letta/types/letta_response_usage_message_usage.py +0 -47
  40. letta/types/letta_response_user_message.py +0 -32
  41. 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
@@ -157,6 +159,8 @@ class AgentsClient:
157
159
  embedding: typing.Optional[str] = OMIT,
158
160
  context_window_limit: typing.Optional[int] = OMIT,
159
161
  embedding_chunk_size: typing.Optional[int] = OMIT,
162
+ from_template: typing.Optional[str] = OMIT,
163
+ project_id: typing.Optional[str] = OMIT,
160
164
  user_id: typing.Optional[str] = OMIT,
161
165
  request_options: typing.Optional[RequestOptions] = None,
162
166
  ) -> AgentState:
@@ -225,6 +229,12 @@ class AgentsClient:
225
229
  embedding_chunk_size : typing.Optional[int]
226
230
  The embedding chunk size used by the agent.
227
231
 
232
+ from_template : typing.Optional[str]
233
+ The template id used to configure the agent
234
+
235
+ project_id : typing.Optional[str]
236
+ The project id that the agent will be associated with.
237
+
228
238
  user_id : typing.Optional[str]
229
239
 
230
240
  request_options : typing.Optional[RequestOptions]
@@ -285,6 +295,8 @@ class AgentsClient:
285
295
  "embedding": embedding,
286
296
  "context_window_limit": context_window_limit,
287
297
  "embedding_chunk_size": embedding_chunk_size,
298
+ "from_template": from_template,
299
+ "project_id": project_id,
288
300
  "user_id": user_id,
289
301
  },
290
302
  headers={
@@ -373,7 +385,9 @@ class AgentsClient:
373
385
  raise ApiError(status_code=_response.status_code, body=_response.text)
374
386
  raise ApiError(status_code=_response.status_code, body=_response_json)
375
387
 
376
- def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentState:
388
+ def delete(
389
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
390
+ ) -> typing.Optional[typing.Any]:
377
391
  """
378
392
  Delete an agent.
379
393
 
@@ -386,7 +400,7 @@ class AgentsClient:
386
400
 
387
401
  Returns
388
402
  -------
389
- AgentState
403
+ typing.Optional[typing.Any]
390
404
  Successful Response
391
405
 
392
406
  Examples
@@ -408,9 +422,9 @@ class AgentsClient:
408
422
  try:
409
423
  if 200 <= _response.status_code < 300:
410
424
  return typing.cast(
411
- AgentState,
425
+ typing.Optional[typing.Any],
412
426
  parse_obj_as(
413
- type_=AgentState, # type: ignore
427
+ type_=typing.Optional[typing.Any], # type: ignore
414
428
  object_=_response.json(),
415
429
  ),
416
430
  )
@@ -872,14 +886,83 @@ class AgentsClient:
872
886
  raise ApiError(status_code=_response.status_code, body=_response.text)
873
887
  raise ApiError(status_code=_response.status_code, body=_response_json)
874
888
 
889
+ def searchdeployedagents(
890
+ self,
891
+ *,
892
+ search: typing.Optional[typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem]] = OMIT,
893
+ project_id: typing.Optional[str] = OMIT,
894
+ combinator: typing.Optional[AgentsSearchDeployedAgentsRequestCombinator] = OMIT,
895
+ limit: typing.Optional[float] = OMIT,
896
+ offset: typing.Optional[float] = OMIT,
897
+ request_options: typing.Optional[RequestOptions] = None,
898
+ ) -> None:
899
+ """
900
+ Search deployed agents
901
+
902
+ Parameters
903
+ ----------
904
+ search : typing.Optional[typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem]]
905
+
906
+ project_id : typing.Optional[str]
907
+
908
+ combinator : typing.Optional[AgentsSearchDeployedAgentsRequestCombinator]
909
+
910
+ limit : typing.Optional[float]
911
+
912
+ offset : typing.Optional[float]
913
+
914
+ request_options : typing.Optional[RequestOptions]
915
+ Request-specific configuration.
916
+
917
+ Returns
918
+ -------
919
+ None
920
+
921
+ Examples
922
+ --------
923
+ from letta import Letta
924
+
925
+ client = Letta(
926
+ token="YOUR_TOKEN",
927
+ )
928
+ client.agents.searchdeployedagents()
929
+ """
930
+ _response = self._client_wrapper.httpx_client.request(
931
+ "v1/agents/search",
932
+ method="POST",
933
+ json={
934
+ "search": convert_and_respect_annotation_metadata(
935
+ object_=search,
936
+ annotation=typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem],
937
+ direction="write",
938
+ ),
939
+ "project_id": project_id,
940
+ "combinator": combinator,
941
+ "limit": limit,
942
+ "offset": offset,
943
+ },
944
+ headers={
945
+ "content-type": "application/json",
946
+ },
947
+ request_options=request_options,
948
+ omit=OMIT,
949
+ )
950
+ try:
951
+ if 200 <= _response.status_code < 300:
952
+ return
953
+ _response_json = _response.json()
954
+ except JSONDecodeError:
955
+ raise ApiError(status_code=_response.status_code, body=_response.text)
956
+ raise ApiError(status_code=_response.status_code, body=_response_json)
957
+
875
958
  def create_version(
876
959
  self,
877
960
  agent_id: str,
878
961
  *,
879
- return_agent_id: typing.Optional[bool] = None,
962
+ return_agent_state: typing.Optional[bool] = None,
880
963
  migrate_deployed_agents: typing.Optional[bool] = OMIT,
881
964
  request_options: typing.Optional[RequestOptions] = None,
882
- ) -> AgentsCreateVersionResponse:
965
+ ) -> None:
883
966
  """
884
967
  Creates a versioned version of an agent
885
968
 
@@ -888,7 +971,7 @@ class AgentsClient:
888
971
  agent_id : str
889
972
  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
973
 
891
- return_agent_id : typing.Optional[bool]
974
+ return_agent_state : typing.Optional[bool]
892
975
 
893
976
  migrate_deployed_agents : typing.Optional[bool]
894
977
 
@@ -897,8 +980,7 @@ class AgentsClient:
897
980
 
898
981
  Returns
899
982
  -------
900
- AgentsCreateVersionResponse
901
- 201
983
+ None
902
984
 
903
985
  Examples
904
986
  --------
@@ -915,7 +997,7 @@ class AgentsClient:
915
997
  f"v1/agents/{jsonable_encoder(agent_id)}/version-template",
916
998
  method="POST",
917
999
  params={
918
- "returnAgentId": return_agent_id,
1000
+ "returnAgentState": return_agent_state,
919
1001
  },
920
1002
  json={
921
1003
  "migrate_deployed_agents": migrate_deployed_agents,
@@ -928,13 +1010,7 @@ class AgentsClient:
928
1010
  )
929
1011
  try:
930
1012
  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
- )
1013
+ return
938
1014
  if _response.status_code == 404:
939
1015
  raise NotFoundError(
940
1016
  typing.cast(
@@ -1062,6 +1138,138 @@ class AgentsClient:
1062
1138
  raise ApiError(status_code=_response.status_code, body=_response.text)
1063
1139
  raise ApiError(status_code=_response.status_code, body=_response_json)
1064
1140
 
1141
+ def createtemplatefromagent(
1142
+ self,
1143
+ agent_id: str,
1144
+ *,
1145
+ project_id: typing.Optional[str] = OMIT,
1146
+ request_options: typing.Optional[RequestOptions] = None,
1147
+ ) -> None:
1148
+ """
1149
+ Create a template from an agent
1150
+
1151
+ Parameters
1152
+ ----------
1153
+ agent_id : str
1154
+
1155
+ project_id : typing.Optional[str]
1156
+
1157
+ request_options : typing.Optional[RequestOptions]
1158
+ Request-specific configuration.
1159
+
1160
+ Returns
1161
+ -------
1162
+ None
1163
+
1164
+ Examples
1165
+ --------
1166
+ from letta import Letta
1167
+
1168
+ client = Letta(
1169
+ token="YOUR_TOKEN",
1170
+ )
1171
+ client.agents.createtemplatefromagent(
1172
+ agent_id="agent_id",
1173
+ )
1174
+ """
1175
+ _response = self._client_wrapper.httpx_client.request(
1176
+ f"v1/agents/{jsonable_encoder(agent_id)}/template",
1177
+ method="POST",
1178
+ json={
1179
+ "project_id": project_id,
1180
+ },
1181
+ headers={
1182
+ "content-type": "application/json",
1183
+ },
1184
+ request_options=request_options,
1185
+ omit=OMIT,
1186
+ )
1187
+ try:
1188
+ if 200 <= _response.status_code < 300:
1189
+ return
1190
+ if _response.status_code == 404:
1191
+ raise NotFoundError(
1192
+ typing.cast(
1193
+ typing.Optional[typing.Any],
1194
+ parse_obj_as(
1195
+ type_=typing.Optional[typing.Any], # type: ignore
1196
+ object_=_response.json(),
1197
+ ),
1198
+ )
1199
+ )
1200
+ if _response.status_code == 500:
1201
+ raise InternalServerError(
1202
+ typing.cast(
1203
+ typing.Optional[typing.Any],
1204
+ parse_obj_as(
1205
+ type_=typing.Optional[typing.Any], # type: ignore
1206
+ object_=_response.json(),
1207
+ ),
1208
+ )
1209
+ )
1210
+ _response_json = _response.json()
1211
+ except JSONDecodeError:
1212
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1213
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1214
+
1215
+ def getagentvariables(
1216
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
1217
+ ) -> AgentsGetAgentVariablesResponse:
1218
+ """
1219
+ Get the variables associated with an agent
1220
+
1221
+ Parameters
1222
+ ----------
1223
+ agent_id : str
1224
+
1225
+ request_options : typing.Optional[RequestOptions]
1226
+ Request-specific configuration.
1227
+
1228
+ Returns
1229
+ -------
1230
+ AgentsGetAgentVariablesResponse
1231
+ 200
1232
+
1233
+ Examples
1234
+ --------
1235
+ from letta import Letta
1236
+
1237
+ client = Letta(
1238
+ token="YOUR_TOKEN",
1239
+ )
1240
+ client.agents.getagentvariables(
1241
+ agent_id="agent_id",
1242
+ )
1243
+ """
1244
+ _response = self._client_wrapper.httpx_client.request(
1245
+ f"v1/agents/{jsonable_encoder(agent_id)}/variables",
1246
+ method="GET",
1247
+ request_options=request_options,
1248
+ )
1249
+ try:
1250
+ if 200 <= _response.status_code < 300:
1251
+ return typing.cast(
1252
+ AgentsGetAgentVariablesResponse,
1253
+ parse_obj_as(
1254
+ type_=AgentsGetAgentVariablesResponse, # type: ignore
1255
+ object_=_response.json(),
1256
+ ),
1257
+ )
1258
+ if _response.status_code == 404:
1259
+ raise NotFoundError(
1260
+ typing.cast(
1261
+ typing.Optional[typing.Any],
1262
+ parse_obj_as(
1263
+ type_=typing.Optional[typing.Any], # type: ignore
1264
+ object_=_response.json(),
1265
+ ),
1266
+ )
1267
+ )
1268
+ _response_json = _response.json()
1269
+ except JSONDecodeError:
1270
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1271
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1272
+
1065
1273
 
1066
1274
  class AsyncAgentsClient:
1067
1275
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -1180,6 +1388,8 @@ class AsyncAgentsClient:
1180
1388
  embedding: typing.Optional[str] = OMIT,
1181
1389
  context_window_limit: typing.Optional[int] = OMIT,
1182
1390
  embedding_chunk_size: typing.Optional[int] = OMIT,
1391
+ from_template: typing.Optional[str] = OMIT,
1392
+ project_id: typing.Optional[str] = OMIT,
1183
1393
  user_id: typing.Optional[str] = OMIT,
1184
1394
  request_options: typing.Optional[RequestOptions] = None,
1185
1395
  ) -> AgentState:
@@ -1248,6 +1458,12 @@ class AsyncAgentsClient:
1248
1458
  embedding_chunk_size : typing.Optional[int]
1249
1459
  The embedding chunk size used by the agent.
1250
1460
 
1461
+ from_template : typing.Optional[str]
1462
+ The template id used to configure the agent
1463
+
1464
+ project_id : typing.Optional[str]
1465
+ The project id that the agent will be associated with.
1466
+
1251
1467
  user_id : typing.Optional[str]
1252
1468
 
1253
1469
  request_options : typing.Optional[RequestOptions]
@@ -1316,6 +1532,8 @@ class AsyncAgentsClient:
1316
1532
  "embedding": embedding,
1317
1533
  "context_window_limit": context_window_limit,
1318
1534
  "embedding_chunk_size": embedding_chunk_size,
1535
+ "from_template": from_template,
1536
+ "project_id": project_id,
1319
1537
  "user_id": user_id,
1320
1538
  },
1321
1539
  headers={
@@ -1412,7 +1630,9 @@ class AsyncAgentsClient:
1412
1630
  raise ApiError(status_code=_response.status_code, body=_response.text)
1413
1631
  raise ApiError(status_code=_response.status_code, body=_response_json)
1414
1632
 
1415
- async def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentState:
1633
+ async def delete(
1634
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
1635
+ ) -> typing.Optional[typing.Any]:
1416
1636
  """
1417
1637
  Delete an agent.
1418
1638
 
@@ -1425,7 +1645,7 @@ class AsyncAgentsClient:
1425
1645
 
1426
1646
  Returns
1427
1647
  -------
1428
- AgentState
1648
+ typing.Optional[typing.Any]
1429
1649
  Successful Response
1430
1650
 
1431
1651
  Examples
@@ -1455,9 +1675,9 @@ class AsyncAgentsClient:
1455
1675
  try:
1456
1676
  if 200 <= _response.status_code < 300:
1457
1677
  return typing.cast(
1458
- AgentState,
1678
+ typing.Optional[typing.Any],
1459
1679
  parse_obj_as(
1460
- type_=AgentState, # type: ignore
1680
+ type_=typing.Optional[typing.Any], # type: ignore
1461
1681
  object_=_response.json(),
1462
1682
  ),
1463
1683
  )
@@ -1959,14 +2179,91 @@ class AsyncAgentsClient:
1959
2179
  raise ApiError(status_code=_response.status_code, body=_response.text)
1960
2180
  raise ApiError(status_code=_response.status_code, body=_response_json)
1961
2181
 
2182
+ async def searchdeployedagents(
2183
+ self,
2184
+ *,
2185
+ search: typing.Optional[typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem]] = OMIT,
2186
+ project_id: typing.Optional[str] = OMIT,
2187
+ combinator: typing.Optional[AgentsSearchDeployedAgentsRequestCombinator] = OMIT,
2188
+ limit: typing.Optional[float] = OMIT,
2189
+ offset: typing.Optional[float] = OMIT,
2190
+ request_options: typing.Optional[RequestOptions] = None,
2191
+ ) -> None:
2192
+ """
2193
+ Search deployed agents
2194
+
2195
+ Parameters
2196
+ ----------
2197
+ search : typing.Optional[typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem]]
2198
+
2199
+ project_id : typing.Optional[str]
2200
+
2201
+ combinator : typing.Optional[AgentsSearchDeployedAgentsRequestCombinator]
2202
+
2203
+ limit : typing.Optional[float]
2204
+
2205
+ offset : typing.Optional[float]
2206
+
2207
+ request_options : typing.Optional[RequestOptions]
2208
+ Request-specific configuration.
2209
+
2210
+ Returns
2211
+ -------
2212
+ None
2213
+
2214
+ Examples
2215
+ --------
2216
+ import asyncio
2217
+
2218
+ from letta import AsyncLetta
2219
+
2220
+ client = AsyncLetta(
2221
+ token="YOUR_TOKEN",
2222
+ )
2223
+
2224
+
2225
+ async def main() -> None:
2226
+ await client.agents.searchdeployedagents()
2227
+
2228
+
2229
+ asyncio.run(main())
2230
+ """
2231
+ _response = await self._client_wrapper.httpx_client.request(
2232
+ "v1/agents/search",
2233
+ method="POST",
2234
+ json={
2235
+ "search": convert_and_respect_annotation_metadata(
2236
+ object_=search,
2237
+ annotation=typing.Sequence[AgentsSearchDeployedAgentsRequestSearchItem],
2238
+ direction="write",
2239
+ ),
2240
+ "project_id": project_id,
2241
+ "combinator": combinator,
2242
+ "limit": limit,
2243
+ "offset": offset,
2244
+ },
2245
+ headers={
2246
+ "content-type": "application/json",
2247
+ },
2248
+ request_options=request_options,
2249
+ omit=OMIT,
2250
+ )
2251
+ try:
2252
+ if 200 <= _response.status_code < 300:
2253
+ return
2254
+ _response_json = _response.json()
2255
+ except JSONDecodeError:
2256
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2257
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2258
+
1962
2259
  async def create_version(
1963
2260
  self,
1964
2261
  agent_id: str,
1965
2262
  *,
1966
- return_agent_id: typing.Optional[bool] = None,
2263
+ return_agent_state: typing.Optional[bool] = None,
1967
2264
  migrate_deployed_agents: typing.Optional[bool] = OMIT,
1968
2265
  request_options: typing.Optional[RequestOptions] = None,
1969
- ) -> AgentsCreateVersionResponse:
2266
+ ) -> None:
1970
2267
  """
1971
2268
  Creates a versioned version of an agent
1972
2269
 
@@ -1975,7 +2272,7 @@ class AsyncAgentsClient:
1975
2272
  agent_id : str
1976
2273
  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
2274
 
1978
- return_agent_id : typing.Optional[bool]
2275
+ return_agent_state : typing.Optional[bool]
1979
2276
 
1980
2277
  migrate_deployed_agents : typing.Optional[bool]
1981
2278
 
@@ -1984,8 +2281,7 @@ class AsyncAgentsClient:
1984
2281
 
1985
2282
  Returns
1986
2283
  -------
1987
- AgentsCreateVersionResponse
1988
- 201
2284
+ None
1989
2285
 
1990
2286
  Examples
1991
2287
  --------
@@ -2010,7 +2306,7 @@ class AsyncAgentsClient:
2010
2306
  f"v1/agents/{jsonable_encoder(agent_id)}/version-template",
2011
2307
  method="POST",
2012
2308
  params={
2013
- "returnAgentId": return_agent_id,
2309
+ "returnAgentState": return_agent_state,
2014
2310
  },
2015
2311
  json={
2016
2312
  "migrate_deployed_agents": migrate_deployed_agents,
@@ -2023,13 +2319,7 @@ class AsyncAgentsClient:
2023
2319
  )
2024
2320
  try:
2025
2321
  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
- )
2322
+ return
2033
2323
  if _response.status_code == 404:
2034
2324
  raise NotFoundError(
2035
2325
  typing.cast(
@@ -2164,3 +2454,151 @@ class AsyncAgentsClient:
2164
2454
  except JSONDecodeError:
2165
2455
  raise ApiError(status_code=_response.status_code, body=_response.text)
2166
2456
  raise ApiError(status_code=_response.status_code, body=_response_json)
2457
+
2458
+ async def createtemplatefromagent(
2459
+ self,
2460
+ agent_id: str,
2461
+ *,
2462
+ project_id: typing.Optional[str] = OMIT,
2463
+ request_options: typing.Optional[RequestOptions] = None,
2464
+ ) -> None:
2465
+ """
2466
+ Create a template from an agent
2467
+
2468
+ Parameters
2469
+ ----------
2470
+ agent_id : str
2471
+
2472
+ project_id : typing.Optional[str]
2473
+
2474
+ request_options : typing.Optional[RequestOptions]
2475
+ Request-specific configuration.
2476
+
2477
+ Returns
2478
+ -------
2479
+ None
2480
+
2481
+ Examples
2482
+ --------
2483
+ import asyncio
2484
+
2485
+ from letta import AsyncLetta
2486
+
2487
+ client = AsyncLetta(
2488
+ token="YOUR_TOKEN",
2489
+ )
2490
+
2491
+
2492
+ async def main() -> None:
2493
+ await client.agents.createtemplatefromagent(
2494
+ agent_id="agent_id",
2495
+ )
2496
+
2497
+
2498
+ asyncio.run(main())
2499
+ """
2500
+ _response = await self._client_wrapper.httpx_client.request(
2501
+ f"v1/agents/{jsonable_encoder(agent_id)}/template",
2502
+ method="POST",
2503
+ json={
2504
+ "project_id": project_id,
2505
+ },
2506
+ headers={
2507
+ "content-type": "application/json",
2508
+ },
2509
+ request_options=request_options,
2510
+ omit=OMIT,
2511
+ )
2512
+ try:
2513
+ if 200 <= _response.status_code < 300:
2514
+ return
2515
+ if _response.status_code == 404:
2516
+ raise NotFoundError(
2517
+ typing.cast(
2518
+ typing.Optional[typing.Any],
2519
+ parse_obj_as(
2520
+ type_=typing.Optional[typing.Any], # type: ignore
2521
+ object_=_response.json(),
2522
+ ),
2523
+ )
2524
+ )
2525
+ if _response.status_code == 500:
2526
+ raise InternalServerError(
2527
+ typing.cast(
2528
+ typing.Optional[typing.Any],
2529
+ parse_obj_as(
2530
+ type_=typing.Optional[typing.Any], # type: ignore
2531
+ object_=_response.json(),
2532
+ ),
2533
+ )
2534
+ )
2535
+ _response_json = _response.json()
2536
+ except JSONDecodeError:
2537
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2538
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2539
+
2540
+ async def getagentvariables(
2541
+ self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
2542
+ ) -> AgentsGetAgentVariablesResponse:
2543
+ """
2544
+ Get the variables associated with an agent
2545
+
2546
+ Parameters
2547
+ ----------
2548
+ agent_id : str
2549
+
2550
+ request_options : typing.Optional[RequestOptions]
2551
+ Request-specific configuration.
2552
+
2553
+ Returns
2554
+ -------
2555
+ AgentsGetAgentVariablesResponse
2556
+ 200
2557
+
2558
+ Examples
2559
+ --------
2560
+ import asyncio
2561
+
2562
+ from letta import AsyncLetta
2563
+
2564
+ client = AsyncLetta(
2565
+ token="YOUR_TOKEN",
2566
+ )
2567
+
2568
+
2569
+ async def main() -> None:
2570
+ await client.agents.getagentvariables(
2571
+ agent_id="agent_id",
2572
+ )
2573
+
2574
+
2575
+ asyncio.run(main())
2576
+ """
2577
+ _response = await self._client_wrapper.httpx_client.request(
2578
+ f"v1/agents/{jsonable_encoder(agent_id)}/variables",
2579
+ method="GET",
2580
+ request_options=request_options,
2581
+ )
2582
+ try:
2583
+ if 200 <= _response.status_code < 300:
2584
+ return typing.cast(
2585
+ AgentsGetAgentVariablesResponse,
2586
+ parse_obj_as(
2587
+ type_=AgentsGetAgentVariablesResponse, # type: ignore
2588
+ object_=_response.json(),
2589
+ ),
2590
+ )
2591
+ if _response.status_code == 404:
2592
+ raise NotFoundError(
2593
+ typing.cast(
2594
+ typing.Optional[typing.Any],
2595
+ parse_obj_as(
2596
+ type_=typing.Optional[typing.Any], # type: ignore
2597
+ object_=_response.json(),
2598
+ ),
2599
+ )
2600
+ )
2601
+ _response_json = _response.json()
2602
+ except JSONDecodeError:
2603
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2604
+ raise ApiError(status_code=_response.status_code, body=_response_json)