letta-client 1.0.0a13__py3-none-any.whl → 1.0.0a15__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.

Files changed (27) hide show
  1. letta_client/_client.py +16 -2
  2. letta_client/_utils/_utils.py +1 -1
  3. letta_client/_version.py +1 -1
  4. letta_client/pagination.py +9 -9
  5. letta_client/resources/agents/files.py +13 -10
  6. letta_client/resources/agents/messages.py +60 -24
  7. letta_client/resources/groups/messages.py +40 -16
  8. letta_client/resources/templates/agents.py +2 -8
  9. letta_client/types/agents/__init__.py +2 -0
  10. letta_client/types/agents/event_message.py +35 -0
  11. letta_client/types/agents/file_list_response.py +3 -14
  12. letta_client/types/agents/letta_message_union.py +4 -0
  13. letta_client/types/agents/message_modify_response.py +4 -0
  14. letta_client/types/agents/message_send_async_params.py +57 -5
  15. letta_client/types/agents/message_send_params.py +57 -5
  16. letta_client/types/agents/message_stream_params.py +57 -5
  17. letta_client/types/agents/summary_message.py +33 -0
  18. letta_client/types/batch_create_params.py +59 -6
  19. letta_client/types/groups/message_modify_response.py +4 -0
  20. letta_client/types/groups/message_send_params.py +57 -5
  21. letta_client/types/groups/message_stream_params.py +57 -5
  22. letta_client/types/steps/message_list_response.py +4 -0
  23. letta_client/types/templates/agent_create_params.py +0 -2
  24. {letta_client-1.0.0a13.dist-info → letta_client-1.0.0a15.dist-info}/METADATA +1 -1
  25. {letta_client-1.0.0a13.dist-info → letta_client-1.0.0a15.dist-info}/RECORD +27 -25
  26. {letta_client-1.0.0a13.dist-info → letta_client-1.0.0a15.dist-info}/WHEEL +0 -0
  27. {letta_client-1.0.0a13.dist-info → letta_client-1.0.0a15.dist-info}/licenses/LICENSE +0 -0
letta_client/_client.py CHANGED
@@ -91,6 +91,7 @@ class Letta(SyncAPIClient):
91
91
  # client options
92
92
  api_key: str
93
93
  project_id: str | None
94
+ project: str | None
94
95
 
95
96
  _environment: Literal["cloud", "local"] | NotGiven
96
97
 
@@ -99,6 +100,7 @@ class Letta(SyncAPIClient):
99
100
  *,
100
101
  api_key: str | None = None,
101
102
  project_id: str | None = None,
103
+ project: str | None = None,
102
104
  environment: Literal["cloud", "local"] | NotGiven = not_given,
103
105
  base_url: str | httpx.URL | None | NotGiven = not_given,
104
106
  timeout: float | Timeout | None | NotGiven = not_given,
@@ -133,6 +135,8 @@ class Letta(SyncAPIClient):
133
135
 
134
136
  self.project_id = project_id
135
137
 
138
+ self.project = project
139
+
136
140
  self._environment = environment
137
141
 
138
142
  base_url_env = os.environ.get("LETTA_BASE_URL")
@@ -206,7 +210,8 @@ class Letta(SyncAPIClient):
206
210
  return {
207
211
  **super().default_headers,
208
212
  "X-Stainless-Async": "false",
209
- "X-Project": self.project_id if self.project_id is not None else Omit(),
213
+ "X-Project-Id": self.project_id if self.project_id is not None else Omit(),
214
+ "X-Project": self.project if self.project is not None else Omit(),
210
215
  **self._custom_headers,
211
216
  }
212
217
 
@@ -215,6 +220,7 @@ class Letta(SyncAPIClient):
215
220
  *,
216
221
  api_key: str | None = None,
217
222
  project_id: str | None = None,
223
+ project: str | None = None,
218
224
  environment: Literal["cloud", "local"] | None = None,
219
225
  base_url: str | httpx.URL | None = None,
220
226
  timeout: float | Timeout | None | NotGiven = not_given,
@@ -251,6 +257,7 @@ class Letta(SyncAPIClient):
251
257
  return self.__class__(
252
258
  api_key=api_key or self.api_key,
253
259
  project_id=project_id or self.project_id,
260
+ project=project or self.project,
254
261
  base_url=base_url or self.base_url,
255
262
  environment=environment or self._environment,
256
263
  timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
@@ -339,6 +346,7 @@ class AsyncLetta(AsyncAPIClient):
339
346
  # client options
340
347
  api_key: str
341
348
  project_id: str | None
349
+ project: str | None
342
350
 
343
351
  _environment: Literal["cloud", "local"] | NotGiven
344
352
 
@@ -347,6 +355,7 @@ class AsyncLetta(AsyncAPIClient):
347
355
  *,
348
356
  api_key: str | None = None,
349
357
  project_id: str | None = None,
358
+ project: str | None = None,
350
359
  environment: Literal["cloud", "local"] | NotGiven = not_given,
351
360
  base_url: str | httpx.URL | None | NotGiven = not_given,
352
361
  timeout: float | Timeout | None | NotGiven = not_given,
@@ -381,6 +390,8 @@ class AsyncLetta(AsyncAPIClient):
381
390
 
382
391
  self.project_id = project_id
383
392
 
393
+ self.project = project
394
+
384
395
  self._environment = environment
385
396
 
386
397
  base_url_env = os.environ.get("LETTA_BASE_URL")
@@ -454,7 +465,8 @@ class AsyncLetta(AsyncAPIClient):
454
465
  return {
455
466
  **super().default_headers,
456
467
  "X-Stainless-Async": f"async:{get_async_library()}",
457
- "X-Project": self.project_id if self.project_id is not None else Omit(),
468
+ "X-Project-Id": self.project_id if self.project_id is not None else Omit(),
469
+ "X-Project": self.project if self.project is not None else Omit(),
458
470
  **self._custom_headers,
459
471
  }
460
472
 
@@ -463,6 +475,7 @@ class AsyncLetta(AsyncAPIClient):
463
475
  *,
464
476
  api_key: str | None = None,
465
477
  project_id: str | None = None,
478
+ project: str | None = None,
466
479
  environment: Literal["cloud", "local"] | None = None,
467
480
  base_url: str | httpx.URL | None = None,
468
481
  timeout: float | Timeout | None | NotGiven = not_given,
@@ -499,6 +512,7 @@ class AsyncLetta(AsyncAPIClient):
499
512
  return self.__class__(
500
513
  api_key=api_key or self.api_key,
501
514
  project_id=project_id or self.project_id,
515
+ project=project or self.project,
502
516
  base_url=base_url or self.base_url,
503
517
  environment=environment or self._environment,
504
518
  timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
@@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
133
133
  # Type safe methods for narrowing types with TypeVars.
134
134
  # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
135
135
  # however this cause Pyright to rightfully report errors. As we know we don't
136
- # care about the contained types we can safely use `object` in it's place.
136
+ # care about the contained types we can safely use `object` in its place.
137
137
  #
138
138
  # There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
139
139
  # `is_*` is for when you're dealing with an unknown input
letta_client/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "letta_client"
4
- __version__ = "1.0.0-alpha.13" # x-release-please-version
4
+ __version__ = "1.0.0-alpha.15" # x-release-please-version
@@ -35,7 +35,7 @@ class ObjectPageItem(Protocol):
35
35
 
36
36
  @runtime_checkable
37
37
  class NextFilesPageItem(Protocol):
38
- next_cursor: Optional[str]
38
+ id: Optional[str]
39
39
 
40
40
 
41
41
  class SyncArrayPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
@@ -222,18 +222,18 @@ class SyncNextFilesPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
222
222
 
223
223
  if is_forwards:
224
224
  item = cast(Any, files[-1])
225
- if not isinstance(item, NextFilesPageItem) or item.next_cursor is None:
225
+ if not isinstance(item, NextFilesPageItem) or item.id is None:
226
226
  # TODO emit warning log
227
227
  return None
228
228
 
229
- return PageInfo(params={"after": item.next_cursor})
229
+ return PageInfo(params={"after": item.id})
230
230
  else:
231
231
  item = cast(Any, self.files[0])
232
- if not isinstance(item, NextFilesPageItem) or item.next_cursor is None:
232
+ if not isinstance(item, NextFilesPageItem) or item.id is None:
233
233
  # TODO emit warning log
234
234
  return None
235
235
 
236
- return PageInfo(params={"before": item.next_cursor})
236
+ return PageInfo(params={"before": item.id})
237
237
 
238
238
 
239
239
  class AsyncNextFilesPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
@@ -266,15 +266,15 @@ class AsyncNextFilesPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
266
266
 
267
267
  if is_forwards:
268
268
  item = cast(Any, files[-1])
269
- if not isinstance(item, NextFilesPageItem) or item.next_cursor is None:
269
+ if not isinstance(item, NextFilesPageItem) or item.id is None:
270
270
  # TODO emit warning log
271
271
  return None
272
272
 
273
- return PageInfo(params={"after": item.next_cursor})
273
+ return PageInfo(params={"after": item.id})
274
274
  else:
275
275
  item = cast(Any, self.files[0])
276
- if not isinstance(item, NextFilesPageItem) or item.next_cursor is None:
276
+ if not isinstance(item, NextFilesPageItem) or item.id is None:
277
277
  # TODO emit warning log
278
278
  return None
279
279
 
280
- return PageInfo(params={"before": item.next_cursor})
280
+ return PageInfo(params={"before": item.id})
@@ -8,7 +8,7 @@ from typing_extensions import Literal
8
8
  import httpx
9
9
 
10
10
  from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
- from ..._utils import maybe_transform, async_maybe_transform
11
+ from ..._utils import maybe_transform
12
12
  from ..._compat import cached_property
13
13
  from ..._resource import SyncAPIResource, AsyncAPIResource
14
14
  from ..._response import (
@@ -17,7 +17,8 @@ from ..._response import (
17
17
  async_to_raw_response_wrapper,
18
18
  async_to_streamed_response_wrapper,
19
19
  )
20
- from ..._base_client import make_request_options
20
+ from ...pagination import SyncNextFilesPage, AsyncNextFilesPage
21
+ from ..._base_client import AsyncPaginator, make_request_options
21
22
  from ...types.agents import file_list_params
22
23
  from ...types.agents.file_list_response import FileListResponse
23
24
  from ...types.agents.file_open_response import FileOpenResponse
@@ -63,7 +64,7 @@ class FilesResource(SyncAPIResource):
63
64
  extra_query: Query | None = None,
64
65
  extra_body: Body | None = None,
65
66
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
66
- ) -> FileListResponse:
67
+ ) -> SyncNextFilesPage[FileListResponse]:
67
68
  """
68
69
  Get the files attached to an agent with their open/closed status.
69
70
 
@@ -97,8 +98,9 @@ class FilesResource(SyncAPIResource):
97
98
  """
98
99
  if not agent_id:
99
100
  raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
100
- return self._get(
101
+ return self._get_api_list(
101
102
  f"/v1/agents/{agent_id}/files",
103
+ page=SyncNextFilesPage[FileListResponse],
102
104
  options=make_request_options(
103
105
  extra_headers=extra_headers,
104
106
  extra_query=extra_query,
@@ -117,7 +119,7 @@ class FilesResource(SyncAPIResource):
117
119
  file_list_params.FileListParams,
118
120
  ),
119
121
  ),
120
- cast_to=FileListResponse,
122
+ model=FileListResponse,
121
123
  )
122
124
 
123
125
  def close(
@@ -266,7 +268,7 @@ class AsyncFilesResource(AsyncAPIResource):
266
268
  """
267
269
  return AsyncFilesResourceWithStreamingResponse(self)
268
270
 
269
- async def list(
271
+ def list(
270
272
  self,
271
273
  agent_id: str,
272
274
  *,
@@ -283,7 +285,7 @@ class AsyncFilesResource(AsyncAPIResource):
283
285
  extra_query: Query | None = None,
284
286
  extra_body: Body | None = None,
285
287
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
286
- ) -> FileListResponse:
288
+ ) -> AsyncPaginator[FileListResponse, AsyncNextFilesPage[FileListResponse]]:
287
289
  """
288
290
  Get the files attached to an agent with their open/closed status.
289
291
 
@@ -317,14 +319,15 @@ class AsyncFilesResource(AsyncAPIResource):
317
319
  """
318
320
  if not agent_id:
319
321
  raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
320
- return await self._get(
322
+ return self._get_api_list(
321
323
  f"/v1/agents/{agent_id}/files",
324
+ page=AsyncNextFilesPage[FileListResponse],
322
325
  options=make_request_options(
323
326
  extra_headers=extra_headers,
324
327
  extra_query=extra_query,
325
328
  extra_body=extra_body,
326
329
  timeout=timeout,
327
- query=await async_maybe_transform(
330
+ query=maybe_transform(
328
331
  {
329
332
  "after": after,
330
333
  "before": before,
@@ -337,7 +340,7 @@ class AsyncFilesResource(AsyncAPIResource):
337
340
  file_list_params.FileListParams,
338
341
  ),
339
342
  ),
340
- cast_to=FileListResponse,
343
+ model=FileListResponse,
341
344
  )
342
345
 
343
346
  async def close(
@@ -425,12 +425,13 @@ class MessagesResource(SyncAPIResource):
425
425
  self,
426
426
  agent_id: str,
427
427
  *,
428
- messages: Iterable[message_send_params.Message],
429
428
  assistant_message_tool_kwarg: str | Omit = omit,
430
429
  assistant_message_tool_name: str | Omit = omit,
431
430
  enable_thinking: str | Omit = omit,
432
431
  include_return_message_types: Optional[List[MessageType]] | Omit = omit,
432
+ input: Union[str, Iterable[message_send_params.InputUnionMember1], None] | Omit = omit,
433
433
  max_steps: int | Omit = omit,
434
+ messages: Optional[Iterable[message_send_params.Message]] | Omit = omit,
434
435
  use_assistant_message: bool | Omit = omit,
435
436
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
436
437
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -447,8 +448,6 @@ class MessagesResource(SyncAPIResource):
447
448
  Args:
448
449
  agent_id: The ID of the agent in the format 'agent-<uuid4>'
449
450
 
450
- messages: The messages to be sent to the agent.
451
-
452
451
  assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
453
452
  for legacy agent types, but deprecated for letta_v1_agent onward.
454
453
 
@@ -460,8 +459,14 @@ class MessagesResource(SyncAPIResource):
460
459
  include_return_message_types: Only return specified message types in the response. If `None` (default) returns
461
460
  all messages.
462
461
 
462
+ input:
463
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
464
+ 'user', 'content': input}].
465
+
463
466
  max_steps: Maximum number of steps the agent should take to process the request.
464
467
 
468
+ messages: The messages to be sent to the agent.
469
+
465
470
  use_assistant_message: Whether the server should parse specific tool call arguments (default
466
471
  `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
467
472
  types, but deprecated for letta_v1_agent onward.
@@ -480,12 +485,13 @@ class MessagesResource(SyncAPIResource):
480
485
  f"/v1/agents/{agent_id}/messages",
481
486
  body=maybe_transform(
482
487
  {
483
- "messages": messages,
484
488
  "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
485
489
  "assistant_message_tool_name": assistant_message_tool_name,
486
490
  "enable_thinking": enable_thinking,
487
491
  "include_return_message_types": include_return_message_types,
492
+ "input": input,
488
493
  "max_steps": max_steps,
494
+ "messages": messages,
489
495
  "use_assistant_message": use_assistant_message,
490
496
  },
491
497
  message_send_params.MessageSendParams,
@@ -500,13 +506,14 @@ class MessagesResource(SyncAPIResource):
500
506
  self,
501
507
  agent_id: str,
502
508
  *,
503
- messages: Iterable[message_send_async_params.Message],
504
509
  assistant_message_tool_kwarg: str | Omit = omit,
505
510
  assistant_message_tool_name: str | Omit = omit,
506
511
  callback_url: Optional[str] | Omit = omit,
507
512
  enable_thinking: str | Omit = omit,
508
513
  include_return_message_types: Optional[List[MessageType]] | Omit = omit,
514
+ input: Union[str, Iterable[message_send_async_params.InputUnionMember1], None] | Omit = omit,
509
515
  max_steps: int | Omit = omit,
516
+ messages: Optional[Iterable[message_send_async_params.Message]] | Omit = omit,
510
517
  use_assistant_message: bool | Omit = omit,
511
518
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
512
519
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -527,8 +534,6 @@ class MessagesResource(SyncAPIResource):
527
534
  Args:
528
535
  agent_id: The ID of the agent in the format 'agent-<uuid4>'
529
536
 
530
- messages: The messages to be sent to the agent.
531
-
532
537
  assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
533
538
  for legacy agent types, but deprecated for letta_v1_agent onward.
534
539
 
@@ -542,8 +547,14 @@ class MessagesResource(SyncAPIResource):
542
547
  include_return_message_types: Only return specified message types in the response. If `None` (default) returns
543
548
  all messages.
544
549
 
550
+ input:
551
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
552
+ 'user', 'content': input}].
553
+
545
554
  max_steps: Maximum number of steps the agent should take to process the request.
546
555
 
556
+ messages: The messages to be sent to the agent.
557
+
547
558
  use_assistant_message: Whether the server should parse specific tool call arguments (default
548
559
  `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
549
560
  types, but deprecated for letta_v1_agent onward.
@@ -562,13 +573,14 @@ class MessagesResource(SyncAPIResource):
562
573
  f"/v1/agents/{agent_id}/messages/async",
563
574
  body=maybe_transform(
564
575
  {
565
- "messages": messages,
566
576
  "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
567
577
  "assistant_message_tool_name": assistant_message_tool_name,
568
578
  "callback_url": callback_url,
569
579
  "enable_thinking": enable_thinking,
570
580
  "include_return_message_types": include_return_message_types,
581
+ "input": input,
571
582
  "max_steps": max_steps,
583
+ "messages": messages,
572
584
  "use_assistant_message": use_assistant_message,
573
585
  },
574
586
  message_send_async_params.MessageSendAsyncParams,
@@ -583,14 +595,15 @@ class MessagesResource(SyncAPIResource):
583
595
  self,
584
596
  agent_id: str,
585
597
  *,
586
- messages: Iterable[message_stream_params.Message],
587
598
  assistant_message_tool_kwarg: str | Omit = omit,
588
599
  assistant_message_tool_name: str | Omit = omit,
589
600
  background: bool | Omit = omit,
590
601
  enable_thinking: str | Omit = omit,
591
602
  include_pings: bool | Omit = omit,
592
603
  include_return_message_types: Optional[List[MessageType]] | Omit = omit,
604
+ input: Union[str, Iterable[message_stream_params.InputUnionMember1], None] | Omit = omit,
593
605
  max_steps: int | Omit = omit,
606
+ messages: Optional[Iterable[message_stream_params.Message]] | Omit = omit,
594
607
  stream_tokens: bool | Omit = omit,
595
608
  use_assistant_message: bool | Omit = omit,
596
609
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -609,8 +622,6 @@ class MessagesResource(SyncAPIResource):
609
622
  Args:
610
623
  agent_id: The ID of the agent in the format 'agent-<uuid4>'
611
624
 
612
- messages: The messages to be sent to the agent.
613
-
614
625
  assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
615
626
  for legacy agent types, but deprecated for letta_v1_agent onward.
616
627
 
@@ -627,8 +638,14 @@ class MessagesResource(SyncAPIResource):
627
638
  include_return_message_types: Only return specified message types in the response. If `None` (default) returns
628
639
  all messages.
629
640
 
641
+ input:
642
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
643
+ 'user', 'content': input}].
644
+
630
645
  max_steps: Maximum number of steps the agent should take to process the request.
631
646
 
647
+ messages: The messages to be sent to the agent.
648
+
632
649
  stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
633
650
  per step.
634
651
 
@@ -650,14 +667,15 @@ class MessagesResource(SyncAPIResource):
650
667
  f"/v1/agents/{agent_id}/messages/stream",
651
668
  body=maybe_transform(
652
669
  {
653
- "messages": messages,
654
670
  "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
655
671
  "assistant_message_tool_name": assistant_message_tool_name,
656
672
  "background": background,
657
673
  "enable_thinking": enable_thinking,
658
674
  "include_pings": include_pings,
659
675
  "include_return_message_types": include_return_message_types,
676
+ "input": input,
660
677
  "max_steps": max_steps,
678
+ "messages": messages,
661
679
  "stream_tokens": stream_tokens,
662
680
  "use_assistant_message": use_assistant_message,
663
681
  },
@@ -1092,12 +1110,13 @@ class AsyncMessagesResource(AsyncAPIResource):
1092
1110
  self,
1093
1111
  agent_id: str,
1094
1112
  *,
1095
- messages: Iterable[message_send_params.Message],
1096
1113
  assistant_message_tool_kwarg: str | Omit = omit,
1097
1114
  assistant_message_tool_name: str | Omit = omit,
1098
1115
  enable_thinking: str | Omit = omit,
1099
1116
  include_return_message_types: Optional[List[MessageType]] | Omit = omit,
1117
+ input: Union[str, Iterable[message_send_params.InputUnionMember1], None] | Omit = omit,
1100
1118
  max_steps: int | Omit = omit,
1119
+ messages: Optional[Iterable[message_send_params.Message]] | Omit = omit,
1101
1120
  use_assistant_message: bool | Omit = omit,
1102
1121
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1103
1122
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -1114,8 +1133,6 @@ class AsyncMessagesResource(AsyncAPIResource):
1114
1133
  Args:
1115
1134
  agent_id: The ID of the agent in the format 'agent-<uuid4>'
1116
1135
 
1117
- messages: The messages to be sent to the agent.
1118
-
1119
1136
  assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
1120
1137
  for legacy agent types, but deprecated for letta_v1_agent onward.
1121
1138
 
@@ -1127,8 +1144,14 @@ class AsyncMessagesResource(AsyncAPIResource):
1127
1144
  include_return_message_types: Only return specified message types in the response. If `None` (default) returns
1128
1145
  all messages.
1129
1146
 
1147
+ input:
1148
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
1149
+ 'user', 'content': input}].
1150
+
1130
1151
  max_steps: Maximum number of steps the agent should take to process the request.
1131
1152
 
1153
+ messages: The messages to be sent to the agent.
1154
+
1132
1155
  use_assistant_message: Whether the server should parse specific tool call arguments (default
1133
1156
  `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
1134
1157
  types, but deprecated for letta_v1_agent onward.
@@ -1147,12 +1170,13 @@ class AsyncMessagesResource(AsyncAPIResource):
1147
1170
  f"/v1/agents/{agent_id}/messages",
1148
1171
  body=await async_maybe_transform(
1149
1172
  {
1150
- "messages": messages,
1151
1173
  "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
1152
1174
  "assistant_message_tool_name": assistant_message_tool_name,
1153
1175
  "enable_thinking": enable_thinking,
1154
1176
  "include_return_message_types": include_return_message_types,
1177
+ "input": input,
1155
1178
  "max_steps": max_steps,
1179
+ "messages": messages,
1156
1180
  "use_assistant_message": use_assistant_message,
1157
1181
  },
1158
1182
  message_send_params.MessageSendParams,
@@ -1167,13 +1191,14 @@ class AsyncMessagesResource(AsyncAPIResource):
1167
1191
  self,
1168
1192
  agent_id: str,
1169
1193
  *,
1170
- messages: Iterable[message_send_async_params.Message],
1171
1194
  assistant_message_tool_kwarg: str | Omit = omit,
1172
1195
  assistant_message_tool_name: str | Omit = omit,
1173
1196
  callback_url: Optional[str] | Omit = omit,
1174
1197
  enable_thinking: str | Omit = omit,
1175
1198
  include_return_message_types: Optional[List[MessageType]] | Omit = omit,
1199
+ input: Union[str, Iterable[message_send_async_params.InputUnionMember1], None] | Omit = omit,
1176
1200
  max_steps: int | Omit = omit,
1201
+ messages: Optional[Iterable[message_send_async_params.Message]] | Omit = omit,
1177
1202
  use_assistant_message: bool | Omit = omit,
1178
1203
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1179
1204
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -1194,8 +1219,6 @@ class AsyncMessagesResource(AsyncAPIResource):
1194
1219
  Args:
1195
1220
  agent_id: The ID of the agent in the format 'agent-<uuid4>'
1196
1221
 
1197
- messages: The messages to be sent to the agent.
1198
-
1199
1222
  assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
1200
1223
  for legacy agent types, but deprecated for letta_v1_agent onward.
1201
1224
 
@@ -1209,8 +1232,14 @@ class AsyncMessagesResource(AsyncAPIResource):
1209
1232
  include_return_message_types: Only return specified message types in the response. If `None` (default) returns
1210
1233
  all messages.
1211
1234
 
1235
+ input:
1236
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
1237
+ 'user', 'content': input}].
1238
+
1212
1239
  max_steps: Maximum number of steps the agent should take to process the request.
1213
1240
 
1241
+ messages: The messages to be sent to the agent.
1242
+
1214
1243
  use_assistant_message: Whether the server should parse specific tool call arguments (default
1215
1244
  `send_message`) as `AssistantMessage` objects. Still supported for legacy agent
1216
1245
  types, but deprecated for letta_v1_agent onward.
@@ -1229,13 +1258,14 @@ class AsyncMessagesResource(AsyncAPIResource):
1229
1258
  f"/v1/agents/{agent_id}/messages/async",
1230
1259
  body=await async_maybe_transform(
1231
1260
  {
1232
- "messages": messages,
1233
1261
  "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
1234
1262
  "assistant_message_tool_name": assistant_message_tool_name,
1235
1263
  "callback_url": callback_url,
1236
1264
  "enable_thinking": enable_thinking,
1237
1265
  "include_return_message_types": include_return_message_types,
1266
+ "input": input,
1238
1267
  "max_steps": max_steps,
1268
+ "messages": messages,
1239
1269
  "use_assistant_message": use_assistant_message,
1240
1270
  },
1241
1271
  message_send_async_params.MessageSendAsyncParams,
@@ -1250,14 +1280,15 @@ class AsyncMessagesResource(AsyncAPIResource):
1250
1280
  self,
1251
1281
  agent_id: str,
1252
1282
  *,
1253
- messages: Iterable[message_stream_params.Message],
1254
1283
  assistant_message_tool_kwarg: str | Omit = omit,
1255
1284
  assistant_message_tool_name: str | Omit = omit,
1256
1285
  background: bool | Omit = omit,
1257
1286
  enable_thinking: str | Omit = omit,
1258
1287
  include_pings: bool | Omit = omit,
1259
1288
  include_return_message_types: Optional[List[MessageType]] | Omit = omit,
1289
+ input: Union[str, Iterable[message_stream_params.InputUnionMember1], None] | Omit = omit,
1260
1290
  max_steps: int | Omit = omit,
1291
+ messages: Optional[Iterable[message_stream_params.Message]] | Omit = omit,
1261
1292
  stream_tokens: bool | Omit = omit,
1262
1293
  use_assistant_message: bool | Omit = omit,
1263
1294
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1276,8 +1307,6 @@ class AsyncMessagesResource(AsyncAPIResource):
1276
1307
  Args:
1277
1308
  agent_id: The ID of the agent in the format 'agent-<uuid4>'
1278
1309
 
1279
- messages: The messages to be sent to the agent.
1280
-
1281
1310
  assistant_message_tool_kwarg: The name of the message argument in the designated message tool. Still supported
1282
1311
  for legacy agent types, but deprecated for letta_v1_agent onward.
1283
1312
 
@@ -1294,8 +1323,14 @@ class AsyncMessagesResource(AsyncAPIResource):
1294
1323
  include_return_message_types: Only return specified message types in the response. If `None` (default) returns
1295
1324
  all messages.
1296
1325
 
1326
+ input:
1327
+ Syntactic sugar for a single user message. Equivalent to messages=[{'role':
1328
+ 'user', 'content': input}].
1329
+
1297
1330
  max_steps: Maximum number of steps the agent should take to process the request.
1298
1331
 
1332
+ messages: The messages to be sent to the agent.
1333
+
1299
1334
  stream_tokens: Flag to determine if individual tokens should be streamed, rather than streaming
1300
1335
  per step.
1301
1336
 
@@ -1317,14 +1352,15 @@ class AsyncMessagesResource(AsyncAPIResource):
1317
1352
  f"/v1/agents/{agent_id}/messages/stream",
1318
1353
  body=await async_maybe_transform(
1319
1354
  {
1320
- "messages": messages,
1321
1355
  "assistant_message_tool_kwarg": assistant_message_tool_kwarg,
1322
1356
  "assistant_message_tool_name": assistant_message_tool_name,
1323
1357
  "background": background,
1324
1358
  "enable_thinking": enable_thinking,
1325
1359
  "include_pings": include_pings,
1326
1360
  "include_return_message_types": include_return_message_types,
1361
+ "input": input,
1327
1362
  "max_steps": max_steps,
1363
+ "messages": messages,
1328
1364
  "stream_tokens": stream_tokens,
1329
1365
  "use_assistant_message": use_assistant_message,
1330
1366
  },