letta-client 0.1.112__py3-none-any.whl → 0.1.114__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.

Potentially problematic release.


This version of letta-client might be problematic. Click here for more details.

letta_client/__init__.py CHANGED
@@ -113,6 +113,8 @@ from .types import (
113
113
  JobStatus,
114
114
  JobType,
115
115
  JsonSchema,
116
+ LettaBatchRequest,
117
+ LettaBatchResponse,
116
118
  LettaMessageContentUnion,
117
119
  LettaMessageUnion,
118
120
  LettaRequest,
@@ -391,6 +393,8 @@ __all__ = [
391
393
  "JobType",
392
394
  "JsonSchema",
393
395
  "Letta",
396
+ "LettaBatchRequest",
397
+ "LettaBatchResponse",
394
398
  "LettaEnvironment",
395
399
  "LettaMessageContentUnion",
396
400
  "LettaMessageUnion",
@@ -31,6 +31,8 @@ from .types.update_agent_tool_rules_item import UpdateAgentToolRulesItem
31
31
  import datetime as dt
32
32
  from ..types.passage import Passage
33
33
  from ..types.group import Group
34
+ from ..types.letta_batch_request import LettaBatchRequest
35
+ from ..types.letta_batch_response import LettaBatchResponse
34
36
  from .types.agents_search_request_search_item import AgentsSearchRequestSearchItem
35
37
  from .types.agents_search_response import AgentsSearchResponse
36
38
  from ..core.client_wrapper import AsyncClientWrapper
@@ -1158,6 +1160,141 @@ class AgentsClient:
1158
1160
  raise ApiError(status_code=_response.status_code, body=_response.text)
1159
1161
  raise ApiError(status_code=_response.status_code, body=_response_json)
1160
1162
 
1163
+ def create_batch_message_request(
1164
+ self, *, request: typing.Sequence[LettaBatchRequest], request_options: typing.Optional[RequestOptions] = None
1165
+ ) -> LettaBatchResponse:
1166
+ """
1167
+ Submit a batch of agent messages for asynchronous processing.
1168
+ Creates a job that will fan out messages to all listed agents and process them in parallel.
1169
+
1170
+ Parameters
1171
+ ----------
1172
+ request : typing.Sequence[LettaBatchRequest]
1173
+
1174
+ request_options : typing.Optional[RequestOptions]
1175
+ Request-specific configuration.
1176
+
1177
+ Returns
1178
+ -------
1179
+ LettaBatchResponse
1180
+ Successful Response
1181
+
1182
+ Examples
1183
+ --------
1184
+ from letta_client import Letta, LettaBatchRequest, MessageCreate, TextContent
1185
+
1186
+ client = Letta(
1187
+ token="YOUR_TOKEN",
1188
+ )
1189
+ client.agents.create_batch_message_request(
1190
+ request=[
1191
+ LettaBatchRequest(
1192
+ messages=[
1193
+ MessageCreate(
1194
+ role="user",
1195
+ content=[
1196
+ TextContent(
1197
+ text="text",
1198
+ )
1199
+ ],
1200
+ )
1201
+ ],
1202
+ agent_id="agent_id",
1203
+ )
1204
+ ],
1205
+ )
1206
+ """
1207
+ _response = self._client_wrapper.httpx_client.request(
1208
+ "v1/agents/messages/batches",
1209
+ method="POST",
1210
+ json=convert_and_respect_annotation_metadata(
1211
+ object_=request, annotation=typing.Sequence[LettaBatchRequest], direction="write"
1212
+ ),
1213
+ request_options=request_options,
1214
+ omit=OMIT,
1215
+ )
1216
+ try:
1217
+ if 200 <= _response.status_code < 300:
1218
+ return typing.cast(
1219
+ LettaBatchResponse,
1220
+ construct_type(
1221
+ type_=LettaBatchResponse, # type: ignore
1222
+ object_=_response.json(),
1223
+ ),
1224
+ )
1225
+ if _response.status_code == 422:
1226
+ raise UnprocessableEntityError(
1227
+ typing.cast(
1228
+ HttpValidationError,
1229
+ construct_type(
1230
+ type_=HttpValidationError, # type: ignore
1231
+ object_=_response.json(),
1232
+ ),
1233
+ )
1234
+ )
1235
+ _response_json = _response.json()
1236
+ except JSONDecodeError:
1237
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1238
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1239
+
1240
+ def retrieve_batch_message_request(
1241
+ self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None
1242
+ ) -> LettaBatchResponse:
1243
+ """
1244
+ Retrieve the result or current status of a previously submitted batch message request.
1245
+
1246
+ Parameters
1247
+ ----------
1248
+ batch_id : str
1249
+
1250
+ request_options : typing.Optional[RequestOptions]
1251
+ Request-specific configuration.
1252
+
1253
+ Returns
1254
+ -------
1255
+ LettaBatchResponse
1256
+ Successful Response
1257
+
1258
+ Examples
1259
+ --------
1260
+ from letta_client import Letta
1261
+
1262
+ client = Letta(
1263
+ token="YOUR_TOKEN",
1264
+ )
1265
+ client.agents.retrieve_batch_message_request(
1266
+ batch_id="batch_id",
1267
+ )
1268
+ """
1269
+ _response = self._client_wrapper.httpx_client.request(
1270
+ f"v1/agents/messages/batches/{jsonable_encoder(batch_id)}",
1271
+ method="GET",
1272
+ request_options=request_options,
1273
+ )
1274
+ try:
1275
+ if 200 <= _response.status_code < 300:
1276
+ return typing.cast(
1277
+ LettaBatchResponse,
1278
+ construct_type(
1279
+ type_=LettaBatchResponse, # type: ignore
1280
+ object_=_response.json(),
1281
+ ),
1282
+ )
1283
+ if _response.status_code == 422:
1284
+ raise UnprocessableEntityError(
1285
+ typing.cast(
1286
+ HttpValidationError,
1287
+ construct_type(
1288
+ type_=HttpValidationError, # type: ignore
1289
+ object_=_response.json(),
1290
+ ),
1291
+ )
1292
+ )
1293
+ _response_json = _response.json()
1294
+ except JSONDecodeError:
1295
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1296
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1297
+
1161
1298
  def search(
1162
1299
  self,
1163
1300
  *,
@@ -2427,6 +2564,162 @@ class AsyncAgentsClient:
2427
2564
  raise ApiError(status_code=_response.status_code, body=_response.text)
2428
2565
  raise ApiError(status_code=_response.status_code, body=_response_json)
2429
2566
 
2567
+ async def create_batch_message_request(
2568
+ self, *, request: typing.Sequence[LettaBatchRequest], request_options: typing.Optional[RequestOptions] = None
2569
+ ) -> LettaBatchResponse:
2570
+ """
2571
+ Submit a batch of agent messages for asynchronous processing.
2572
+ Creates a job that will fan out messages to all listed agents and process them in parallel.
2573
+
2574
+ Parameters
2575
+ ----------
2576
+ request : typing.Sequence[LettaBatchRequest]
2577
+
2578
+ request_options : typing.Optional[RequestOptions]
2579
+ Request-specific configuration.
2580
+
2581
+ Returns
2582
+ -------
2583
+ LettaBatchResponse
2584
+ Successful Response
2585
+
2586
+ Examples
2587
+ --------
2588
+ import asyncio
2589
+
2590
+ from letta_client import (
2591
+ AsyncLetta,
2592
+ LettaBatchRequest,
2593
+ MessageCreate,
2594
+ TextContent,
2595
+ )
2596
+
2597
+ client = AsyncLetta(
2598
+ token="YOUR_TOKEN",
2599
+ )
2600
+
2601
+
2602
+ async def main() -> None:
2603
+ await client.agents.create_batch_message_request(
2604
+ request=[
2605
+ LettaBatchRequest(
2606
+ messages=[
2607
+ MessageCreate(
2608
+ role="user",
2609
+ content=[
2610
+ TextContent(
2611
+ text="text",
2612
+ )
2613
+ ],
2614
+ )
2615
+ ],
2616
+ agent_id="agent_id",
2617
+ )
2618
+ ],
2619
+ )
2620
+
2621
+
2622
+ asyncio.run(main())
2623
+ """
2624
+ _response = await self._client_wrapper.httpx_client.request(
2625
+ "v1/agents/messages/batches",
2626
+ method="POST",
2627
+ json=convert_and_respect_annotation_metadata(
2628
+ object_=request, annotation=typing.Sequence[LettaBatchRequest], direction="write"
2629
+ ),
2630
+ request_options=request_options,
2631
+ omit=OMIT,
2632
+ )
2633
+ try:
2634
+ if 200 <= _response.status_code < 300:
2635
+ return typing.cast(
2636
+ LettaBatchResponse,
2637
+ construct_type(
2638
+ type_=LettaBatchResponse, # type: ignore
2639
+ object_=_response.json(),
2640
+ ),
2641
+ )
2642
+ if _response.status_code == 422:
2643
+ raise UnprocessableEntityError(
2644
+ typing.cast(
2645
+ HttpValidationError,
2646
+ construct_type(
2647
+ type_=HttpValidationError, # type: ignore
2648
+ object_=_response.json(),
2649
+ ),
2650
+ )
2651
+ )
2652
+ _response_json = _response.json()
2653
+ except JSONDecodeError:
2654
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2655
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2656
+
2657
+ async def retrieve_batch_message_request(
2658
+ self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None
2659
+ ) -> LettaBatchResponse:
2660
+ """
2661
+ Retrieve the result or current status of a previously submitted batch message request.
2662
+
2663
+ Parameters
2664
+ ----------
2665
+ batch_id : str
2666
+
2667
+ request_options : typing.Optional[RequestOptions]
2668
+ Request-specific configuration.
2669
+
2670
+ Returns
2671
+ -------
2672
+ LettaBatchResponse
2673
+ Successful Response
2674
+
2675
+ Examples
2676
+ --------
2677
+ import asyncio
2678
+
2679
+ from letta_client import AsyncLetta
2680
+
2681
+ client = AsyncLetta(
2682
+ token="YOUR_TOKEN",
2683
+ )
2684
+
2685
+
2686
+ async def main() -> None:
2687
+ await client.agents.retrieve_batch_message_request(
2688
+ batch_id="batch_id",
2689
+ )
2690
+
2691
+
2692
+ asyncio.run(main())
2693
+ """
2694
+ _response = await self._client_wrapper.httpx_client.request(
2695
+ f"v1/agents/messages/batches/{jsonable_encoder(batch_id)}",
2696
+ method="GET",
2697
+ request_options=request_options,
2698
+ )
2699
+ try:
2700
+ if 200 <= _response.status_code < 300:
2701
+ return typing.cast(
2702
+ LettaBatchResponse,
2703
+ construct_type(
2704
+ type_=LettaBatchResponse, # type: ignore
2705
+ object_=_response.json(),
2706
+ ),
2707
+ )
2708
+ if _response.status_code == 422:
2709
+ raise UnprocessableEntityError(
2710
+ typing.cast(
2711
+ HttpValidationError,
2712
+ construct_type(
2713
+ type_=HttpValidationError, # type: ignore
2714
+ object_=_response.json(),
2715
+ ),
2716
+ )
2717
+ )
2718
+ _response_json = _response.json()
2719
+ except JSONDecodeError:
2720
+ raise ApiError(status_code=_response.status_code, body=_response.text)
2721
+ raise ApiError(status_code=_response.status_code, body=_response_json)
2722
+
2430
2723
  async def search(
2431
2724
  self,
2432
2725
  *,
@@ -16,7 +16,7 @@ class BaseClientWrapper:
16
16
  headers: typing.Dict[str, str] = {
17
17
  "X-Fern-Language": "Python",
18
18
  "X-Fern-SDK-Name": "letta-client",
19
- "X-Fern-SDK-Version": "0.1.112",
19
+ "X-Fern-SDK-Version": "0.1.114",
20
20
  }
21
21
  if self.token is not None:
22
22
  headers["Authorization"] = f"Bearer {self.token}"
@@ -112,6 +112,8 @@ from .job import Job
112
112
  from .job_status import JobStatus
113
113
  from .job_type import JobType
114
114
  from .json_schema import JsonSchema
115
+ from .letta_batch_request import LettaBatchRequest
116
+ from .letta_batch_response import LettaBatchResponse
115
117
  from .letta_message_content_union import LettaMessageContentUnion
116
118
  from .letta_message_union import LettaMessageUnion
117
119
  from .letta_request import LettaRequest
@@ -334,6 +336,8 @@ __all__ = [
334
336
  "JobStatus",
335
337
  "JobType",
336
338
  "JsonSchema",
339
+ "LettaBatchRequest",
340
+ "LettaBatchResponse",
337
341
  "LettaMessageContentUnion",
338
342
  "LettaMessageUnion",
339
343
  "LettaRequest",
@@ -0,0 +1,43 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.unchecked_base_model import UncheckedBaseModel
4
+ import typing
5
+ from .message_create import MessageCreate
6
+ import pydantic
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
+
9
+
10
+ class LettaBatchRequest(UncheckedBaseModel):
11
+ messages: typing.List[MessageCreate] = pydantic.Field()
12
+ """
13
+ The messages to be sent to the agent.
14
+ """
15
+
16
+ use_assistant_message: typing.Optional[bool] = pydantic.Field(default=None)
17
+ """
18
+ Whether the server should parse specific tool call arguments (default `send_message`) as `AssistantMessage` objects.
19
+ """
20
+
21
+ assistant_message_tool_name: typing.Optional[str] = pydantic.Field(default=None)
22
+ """
23
+ The name of the designated message tool.
24
+ """
25
+
26
+ assistant_message_tool_kwarg: typing.Optional[str] = pydantic.Field(default=None)
27
+ """
28
+ The name of the message argument in the designated message tool.
29
+ """
30
+
31
+ agent_id: str = pydantic.Field()
32
+ """
33
+ The ID of the agent to send this batch request for
34
+ """
35
+
36
+ if IS_PYDANTIC_V2:
37
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
38
+ else:
39
+
40
+ class Config:
41
+ frozen = True
42
+ smart_union = True
43
+ extra = pydantic.Extra.allow
@@ -0,0 +1,44 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.unchecked_base_model import UncheckedBaseModel
4
+ import pydantic
5
+ from .job_status import JobStatus
6
+ import datetime as dt
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
+ import typing
9
+
10
+
11
+ class LettaBatchResponse(UncheckedBaseModel):
12
+ batch_id: str = pydantic.Field()
13
+ """
14
+ A unique identifier for this batch request.
15
+ """
16
+
17
+ status: JobStatus = pydantic.Field()
18
+ """
19
+ The current status of the batch request.
20
+ """
21
+
22
+ agent_count: int = pydantic.Field()
23
+ """
24
+ The number of agents in the batch request.
25
+ """
26
+
27
+ last_polled_at: dt.datetime = pydantic.Field()
28
+ """
29
+ The timestamp when the batch was last polled for updates.
30
+ """
31
+
32
+ created_at: dt.datetime = pydantic.Field()
33
+ """
34
+ The timestamp when the batch request was created.
35
+ """
36
+
37
+ if IS_PYDANTIC_V2:
38
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
39
+ else:
40
+
41
+ class Config:
42
+ frozen = True
43
+ smart_union = True
44
+ extra = pydantic.Extra.allow
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-client
3
- Version: 0.1.112
3
+ Version: 0.1.114
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -1,8 +1,8 @@
1
- letta_client/__init__.py,sha256=pij5j_AglAp0VqY5FqJ23BIaYulP95I298DZz_8H7uk,14565
1
+ letta_client/__init__.py,sha256=d1gnZZWntFsL6yIr_dKOqcnHqMkHuHvkiXC35I5vrUs,14663
2
2
  letta_client/agents/__init__.py,sha256=CveigJGrnkw3yZ8S9yZ2DpK1HV0v1fU-khsiLJJ0uaU,1452
3
3
  letta_client/agents/blocks/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
4
4
  letta_client/agents/blocks/client.py,sha256=u5zvutxoH_DqfSLWhRtNSRBC9_ezQDx682cxkxDz3JA,23822
5
- letta_client/agents/client.py,sha256=ku9SdcBr0WmR5pjwD1kfq4EMuH-BM3WROO-uda2pul4,93545
5
+ letta_client/agents/client.py,sha256=VGKkSVTJ5j52fIh7PSNmMBD7gd0ZBu3dYcDPRoYU6as,103492
6
6
  letta_client/agents/context/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
7
7
  letta_client/agents/context/client.py,sha256=GKKvoG4N_K8Biz9yDjeIHpFG0C8Cwc7tHmEX3pTL_9U,4815
8
8
  letta_client/agents/core_memory/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
@@ -44,7 +44,7 @@ letta_client/blocks/client.py,sha256=LE9dsHaBxFLC3G035f0VpNDG7XKWRK8y9OXpeFCMvUw
44
44
  letta_client/client.py,sha256=k2mZqqEWciVmEQHgipjCK4kQILk74hpSqzcdNwdql9A,21212
45
45
  letta_client/core/__init__.py,sha256=OKbX2aCZXgHCDUsCouqv-OiX32xA6eFFCKIUH9M5Vzk,1591
46
46
  letta_client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
47
- letta_client/core/client_wrapper.py,sha256=LYs3mur-os4giyagppiEczxlQACLHY_kE32cio3SpiM,1998
47
+ letta_client/core/client_wrapper.py,sha256=J-2xR0tPxzouI60voBOA1Cj19O7nBlMt7WXGhSqr9Qs,1998
48
48
  letta_client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
49
49
  letta_client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
50
50
  letta_client/core/http_client.py,sha256=Z77OIxIbL4OAB2IDqjRq_sYa5yNYAWfmdhdCSSvh6Y4,19552
@@ -106,7 +106,7 @@ letta_client/tools/types/add_mcp_server_request.py,sha256=EieZjfOT95sjkpxXdqy7gl
106
106
  letta_client/tools/types/add_mcp_server_response_item.py,sha256=TWdsKqGb1INhYtpGnAckz0Pw4nZShumSp4pfocRfxCA,270
107
107
  letta_client/tools/types/delete_mcp_server_response_item.py,sha256=MeZObU-7tMSCd-S5yuUjNDse6A1hUz1LLjbko0pXaro,273
108
108
  letta_client/tools/types/list_mcp_servers_response_value.py,sha256=AIoXu4bO8QNSU7zjL1jj0Rg4313wVtPaTt13W0aevLQ,273
109
- letta_client/types/__init__.py,sha256=Yf0Y1lIFZHtKw9Z1UnZXhORlFABZzabzpWHoZ589pMQ,19620
109
+ letta_client/types/__init__.py,sha256=3g30SRiC6aVG5mzeT9BPulQNV0A6IdK8msZiMofiHSs,19775
110
110
  letta_client/types/action_model.py,sha256=y1e2XMv3skFaNJIBdYoBKgiORzGh05aOVvu-qVR9uHg,1240
111
111
  letta_client/types/action_parameters_model.py,sha256=LgKf5aPZG3-OHGxFdXiSokIDgce8c02xPYIAY05VgW8,828
112
112
  letta_client/types/action_response_model.py,sha256=yq2Fd9UU8j7vvtE3VqXUoRRvDzWcfJPj_95ynGdeHCs,824
@@ -219,6 +219,8 @@ letta_client/types/job.py,sha256=VJBdFIY0rwqh4hObTchlU2jrloTjZwUEA44pNtY_JBg,232
219
219
  letta_client/types/job_status.py,sha256=lX5Q0QMQFnw-WiirqHD6kgBvGr6I7r8rKLnMJdqhlT8,239
220
220
  letta_client/types/job_type.py,sha256=Roa04Ry0I-8YMYcDHiHSQwqBavZyPonzkZtjf098e-Q,145
221
221
  letta_client/types/json_schema.py,sha256=EHcLKBSGRsSzCKTpujKFHylcLJG6ODQIBrjQkU4lWDQ,870
222
+ letta_client/types/letta_batch_request.py,sha256=HdIuaaUaqINbau98jPqyIc7Ge84VlCf6VhAQpIhCFvQ,1354
223
+ letta_client/types/letta_batch_response.py,sha256=i1KP1aZh710acu5bKNmcmdiheuPrKbkJr4_e2K2ki_k,1161
222
224
  letta_client/types/letta_message_content_union.py,sha256=YxzyXKxUMeqbqWOlDs9LC8HUiqEhgkNCV9a76GS3spg,486
223
225
  letta_client/types/letta_message_union.py,sha256=TTQwlur2CZNdZ466Nb_2TFcSFXrgoMliaNzD33t7Ktw,603
224
226
  letta_client/types/letta_request.py,sha256=bCPDRJhSJSo5eILJp0mTw_k26O3dZL1vChfAcaZ0rE8,1240
@@ -328,6 +330,6 @@ letta_client/voice/__init__.py,sha256=7hX85553PiRMtIMM12a0DSoFzsglNiUziYR2ekS84Q
328
330
  letta_client/voice/client.py,sha256=STjswa5oOLoP59QwTJvQwi73kgn0UzKOaXc2CsTRI4k,6912
329
331
  letta_client/voice/types/__init__.py,sha256=FRc3iKRTONE4N8Lf1IqvnqWZ2kXdrFFvkL7PxVcR8Ew,212
330
332
  letta_client/voice/types/create_voice_chat_completions_request_body.py,sha256=ZLfKgNK1T6IAwLEvaBVFfy7jEAoPUXP28n-nfmHkklc,391
331
- letta_client-0.1.112.dist-info/METADATA,sha256=NDcX0FrfdHY3zbDOcPZ7-X2rs3lpVVBcAjUrjG5eXLY,5042
332
- letta_client-0.1.112.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
333
- letta_client-0.1.112.dist-info/RECORD,,
333
+ letta_client-0.1.114.dist-info/METADATA,sha256=1wNYLSLYEtjzRn9GgYNSvEcrCbdtBISBKPaDjpuAw_0,5042
334
+ letta_client-0.1.114.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
335
+ letta_client-0.1.114.dist-info/RECORD,,