letta-client 0.1.120__py3-none-any.whl → 0.1.122__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 (50) hide show
  1. letta_client/__init__.py +7 -6
  2. letta_client/agents/__init__.py +2 -1
  3. letta_client/agents/client.py +90 -581
  4. letta_client/agents/groups/client.py +167 -0
  5. letta_client/agents/messages/client.py +145 -0
  6. letta_client/agents/passages/client.py +289 -0
  7. letta_client/base_client.py +12 -0
  8. letta_client/batches/__init__.py +2 -0
  9. letta_client/{messages/batches → batches}/client.py +19 -19
  10. letta_client/blocks/__init__.py +3 -0
  11. letta_client/blocks/agents/__init__.py +2 -0
  12. letta_client/blocks/agents/client.py +149 -0
  13. letta_client/blocks/client.py +4 -127
  14. letta_client/core/client_wrapper.py +1 -1
  15. letta_client/embeddings/__init__.py +2 -0
  16. letta_client/embeddings/client.py +108 -0
  17. letta_client/groups/client.py +0 -124
  18. letta_client/groups/messages/client.py +124 -0
  19. letta_client/identities/__init__.py +3 -0
  20. letta_client/identities/client.py +4 -154
  21. letta_client/identities/properties/__init__.py +2 -0
  22. letta_client/identities/properties/client.py +181 -0
  23. letta_client/messages/__init__.py +0 -3
  24. letta_client/messages/client.py +0 -4
  25. letta_client/models/client.py +4 -97
  26. letta_client/providers/client.py +173 -10
  27. letta_client/runs/__init__.py +3 -0
  28. letta_client/runs/client.py +34 -480
  29. letta_client/runs/messages/__init__.py +2 -0
  30. letta_client/runs/messages/client.py +234 -0
  31. letta_client/runs/steps/__init__.py +2 -0
  32. letta_client/runs/steps/client.py +217 -0
  33. letta_client/runs/usage/__init__.py +2 -0
  34. letta_client/runs/usage/client.py +145 -0
  35. letta_client/sources/client.py +6 -4
  36. letta_client/steps/client.py +78 -4
  37. letta_client/tags/__init__.py +2 -0
  38. letta_client/tags/client.py +92 -0
  39. letta_client/templates/__init__.py +5 -6
  40. letta_client/templates/agents/__init__.py +5 -0
  41. letta_client/templates/agents/client.py +208 -0
  42. letta_client/templates/agents/types/__init__.py +5 -0
  43. letta_client/templates/{types/templates_create_agents_response.py → agents/types/agents_create_response.py} +4 -4
  44. letta_client/templates/client.py +6 -191
  45. letta_client/templates/types/__init__.py +1 -6
  46. letta_client/tools/client.py +4 -4
  47. {letta_client-0.1.120.dist-info → letta_client-0.1.122.dist-info}/METADATA +1 -1
  48. {letta_client-0.1.120.dist-info → letta_client-0.1.122.dist-info}/RECORD +50 -31
  49. /letta_client/{messages/batches → agents/groups}/__init__.py +0 -0
  50. {letta_client-0.1.120.dist-info → letta_client-0.1.122.dist-info}/WHEEL +0 -0
@@ -116,7 +116,7 @@ class StepsClient:
116
116
  raise ApiError(status_code=_response.status_code, body=_response.text)
117
117
  raise ApiError(status_code=_response.status_code, body=_response_json)
118
118
 
119
- def retrieve_step(self, step_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Step:
119
+ def retrieve(self, step_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Step:
120
120
  """
121
121
  Get a step by ID.
122
122
 
@@ -139,7 +139,7 @@ class StepsClient:
139
139
  client = Letta(
140
140
  token="YOUR_TOKEN",
141
141
  )
142
- client.steps.retrieve_step(
142
+ client.steps.retrieve(
143
143
  step_id="step_id",
144
144
  )
145
145
  """
@@ -172,6 +172,39 @@ class StepsClient:
172
172
  raise ApiError(status_code=_response.status_code, body=_response.text)
173
173
  raise ApiError(status_code=_response.status_code, body=_response_json)
174
174
 
175
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
176
+ """
177
+ Parameters
178
+ ----------
179
+ request_options : typing.Optional[RequestOptions]
180
+ Request-specific configuration.
181
+
182
+ Returns
183
+ -------
184
+ None
185
+
186
+ Examples
187
+ --------
188
+ from letta_client import Letta
189
+
190
+ client = Letta(
191
+ token="YOUR_TOKEN",
192
+ )
193
+ client.steps.list()
194
+ """
195
+ _response = self._client_wrapper.httpx_client.request(
196
+ "v1/steps/",
197
+ method="GET",
198
+ request_options=request_options,
199
+ )
200
+ try:
201
+ if 200 <= _response.status_code < 300:
202
+ return
203
+ _response_json = _response.json()
204
+ except JSONDecodeError:
205
+ raise ApiError(status_code=_response.status_code, body=_response.text)
206
+ raise ApiError(status_code=_response.status_code, body=_response_json)
207
+
175
208
 
176
209
  class AsyncStepsClient:
177
210
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -284,7 +317,7 @@ class AsyncStepsClient:
284
317
  raise ApiError(status_code=_response.status_code, body=_response.text)
285
318
  raise ApiError(status_code=_response.status_code, body=_response_json)
286
319
 
287
- async def retrieve_step(self, step_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Step:
320
+ async def retrieve(self, step_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Step:
288
321
  """
289
322
  Get a step by ID.
290
323
 
@@ -312,7 +345,7 @@ class AsyncStepsClient:
312
345
 
313
346
 
314
347
  async def main() -> None:
315
- await client.steps.retrieve_step(
348
+ await client.steps.retrieve(
316
349
  step_id="step_id",
317
350
  )
318
351
 
@@ -347,3 +380,44 @@ class AsyncStepsClient:
347
380
  except JSONDecodeError:
348
381
  raise ApiError(status_code=_response.status_code, body=_response.text)
349
382
  raise ApiError(status_code=_response.status_code, body=_response_json)
383
+
384
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
385
+ """
386
+ Parameters
387
+ ----------
388
+ request_options : typing.Optional[RequestOptions]
389
+ Request-specific configuration.
390
+
391
+ Returns
392
+ -------
393
+ None
394
+
395
+ Examples
396
+ --------
397
+ import asyncio
398
+
399
+ from letta_client import AsyncLetta
400
+
401
+ client = AsyncLetta(
402
+ token="YOUR_TOKEN",
403
+ )
404
+
405
+
406
+ async def main() -> None:
407
+ await client.steps.list()
408
+
409
+
410
+ asyncio.run(main())
411
+ """
412
+ _response = await self._client_wrapper.httpx_client.request(
413
+ "v1/steps/",
414
+ method="GET",
415
+ request_options=request_options,
416
+ )
417
+ try:
418
+ if 200 <= _response.status_code < 300:
419
+ return
420
+ _response_json = _response.json()
421
+ except JSONDecodeError:
422
+ raise ApiError(status_code=_response.status_code, body=_response.text)
423
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
@@ -0,0 +1,92 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.client_wrapper import SyncClientWrapper
4
+ import typing
5
+ from ..core.request_options import RequestOptions
6
+ from json.decoder import JSONDecodeError
7
+ from ..core.api_error import ApiError
8
+ from ..core.client_wrapper import AsyncClientWrapper
9
+
10
+
11
+ class TagsClient:
12
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
13
+ self._client_wrapper = client_wrapper
14
+
15
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
16
+ """
17
+ Parameters
18
+ ----------
19
+ request_options : typing.Optional[RequestOptions]
20
+ Request-specific configuration.
21
+
22
+ Returns
23
+ -------
24
+ None
25
+
26
+ Examples
27
+ --------
28
+ from letta_client import Letta
29
+
30
+ client = Letta(
31
+ token="YOUR_TOKEN",
32
+ )
33
+ client.tags.list()
34
+ """
35
+ _response = self._client_wrapper.httpx_client.request(
36
+ "v1/tags",
37
+ method="GET",
38
+ request_options=request_options,
39
+ )
40
+ try:
41
+ if 200 <= _response.status_code < 300:
42
+ return
43
+ _response_json = _response.json()
44
+ except JSONDecodeError:
45
+ raise ApiError(status_code=_response.status_code, body=_response.text)
46
+ raise ApiError(status_code=_response.status_code, body=_response_json)
47
+
48
+
49
+ class AsyncTagsClient:
50
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
51
+ self._client_wrapper = client_wrapper
52
+
53
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
54
+ """
55
+ Parameters
56
+ ----------
57
+ request_options : typing.Optional[RequestOptions]
58
+ Request-specific configuration.
59
+
60
+ Returns
61
+ -------
62
+ None
63
+
64
+ Examples
65
+ --------
66
+ import asyncio
67
+
68
+ from letta_client import AsyncLetta
69
+
70
+ client = AsyncLetta(
71
+ token="YOUR_TOKEN",
72
+ )
73
+
74
+
75
+ async def main() -> None:
76
+ await client.tags.list()
77
+
78
+
79
+ asyncio.run(main())
80
+ """
81
+ _response = await self._client_wrapper.httpx_client.request(
82
+ "v1/tags",
83
+ method="GET",
84
+ request_options=request_options,
85
+ )
86
+ try:
87
+ if 200 <= _response.status_code < 300:
88
+ return
89
+ _response_json = _response.json()
90
+ except JSONDecodeError:
91
+ raise ApiError(status_code=_response.status_code, body=_response.text)
92
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,13 +1,12 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from .types import (
4
- TemplatesCreateAgentsResponse,
5
- TemplatesListTemplatesResponse,
6
- TemplatesListTemplatesResponseTemplatesItem,
7
- )
3
+ from .types import TemplatesListTemplatesResponse, TemplatesListTemplatesResponseTemplatesItem
4
+ from . import agents
5
+ from .agents import AgentsCreateResponse
8
6
 
9
7
  __all__ = [
10
- "TemplatesCreateAgentsResponse",
8
+ "AgentsCreateResponse",
11
9
  "TemplatesListTemplatesResponse",
12
10
  "TemplatesListTemplatesResponseTemplatesItem",
11
+ "agents",
13
12
  ]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import AgentsCreateResponse
4
+
5
+ __all__ = ["AgentsCreateResponse"]
@@ -0,0 +1,208 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from ...core.client_wrapper import SyncClientWrapper
5
+ from ...core.request_options import RequestOptions
6
+ from .types.agents_create_response import AgentsCreateResponse
7
+ from ...core.jsonable_encoder import jsonable_encoder
8
+ from ...core.unchecked_base_model import construct_type
9
+ from json.decoder import JSONDecodeError
10
+ from ...core.api_error import ApiError
11
+ from ...core.client_wrapper import AsyncClientWrapper
12
+
13
+ # this is used as the default value for optional parameters
14
+ OMIT = typing.cast(typing.Any, ...)
15
+
16
+
17
+ class AgentsClient:
18
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
19
+ self._client_wrapper = client_wrapper
20
+
21
+ def create(
22
+ self,
23
+ project: str,
24
+ template_version: str,
25
+ *,
26
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
27
+ agent_name: typing.Optional[str] = OMIT,
28
+ memory_variables: typing.Optional[typing.Dict[str, str]] = OMIT,
29
+ tool_variables: typing.Optional[typing.Dict[str, str]] = OMIT,
30
+ identity_ids: typing.Optional[typing.Sequence[str]] = OMIT,
31
+ request_options: typing.Optional[RequestOptions] = None,
32
+ ) -> AgentsCreateResponse:
33
+ """
34
+ Creates an Agent or multiple Agents from a template
35
+
36
+ Parameters
37
+ ----------
38
+ project : str
39
+ The project slug
40
+
41
+ template_version : str
42
+ The template version, formatted as {template-name}:{version-number} or {template-name}:latest
43
+
44
+ tags : typing.Optional[typing.Sequence[str]]
45
+ The tags to assign to the agent
46
+
47
+ agent_name : typing.Optional[str]
48
+ The name of the agent, optional otherwise a random one will be assigned
49
+
50
+ memory_variables : typing.Optional[typing.Dict[str, str]]
51
+ The memory variables to assign to the agent
52
+
53
+ tool_variables : typing.Optional[typing.Dict[str, str]]
54
+ The tool variables to assign to the agent
55
+
56
+ identity_ids : typing.Optional[typing.Sequence[str]]
57
+ The identity ids to assign to the agent
58
+
59
+ request_options : typing.Optional[RequestOptions]
60
+ Request-specific configuration.
61
+
62
+ Returns
63
+ -------
64
+ AgentsCreateResponse
65
+ 201
66
+
67
+ Examples
68
+ --------
69
+ from letta_client import Letta
70
+
71
+ client = Letta(
72
+ token="YOUR_TOKEN",
73
+ )
74
+ client.templates.agents.create(
75
+ project="project",
76
+ template_version="template_version",
77
+ )
78
+ """
79
+ _response = self._client_wrapper.httpx_client.request(
80
+ f"v1/templates/{jsonable_encoder(project)}/{jsonable_encoder(template_version)}/agents",
81
+ method="POST",
82
+ json={
83
+ "tags": tags,
84
+ "agent_name": agent_name,
85
+ "memory_variables": memory_variables,
86
+ "tool_variables": tool_variables,
87
+ "identity_ids": identity_ids,
88
+ },
89
+ headers={
90
+ "content-type": "application/json",
91
+ },
92
+ request_options=request_options,
93
+ omit=OMIT,
94
+ )
95
+ try:
96
+ if 200 <= _response.status_code < 300:
97
+ return typing.cast(
98
+ AgentsCreateResponse,
99
+ construct_type(
100
+ type_=AgentsCreateResponse, # type: ignore
101
+ object_=_response.json(),
102
+ ),
103
+ )
104
+ _response_json = _response.json()
105
+ except JSONDecodeError:
106
+ raise ApiError(status_code=_response.status_code, body=_response.text)
107
+ raise ApiError(status_code=_response.status_code, body=_response_json)
108
+
109
+
110
+ class AsyncAgentsClient:
111
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
112
+ self._client_wrapper = client_wrapper
113
+
114
+ async def create(
115
+ self,
116
+ project: str,
117
+ template_version: str,
118
+ *,
119
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
120
+ agent_name: typing.Optional[str] = OMIT,
121
+ memory_variables: typing.Optional[typing.Dict[str, str]] = OMIT,
122
+ tool_variables: typing.Optional[typing.Dict[str, str]] = OMIT,
123
+ identity_ids: typing.Optional[typing.Sequence[str]] = OMIT,
124
+ request_options: typing.Optional[RequestOptions] = None,
125
+ ) -> AgentsCreateResponse:
126
+ """
127
+ Creates an Agent or multiple Agents from a template
128
+
129
+ Parameters
130
+ ----------
131
+ project : str
132
+ The project slug
133
+
134
+ template_version : str
135
+ The template version, formatted as {template-name}:{version-number} or {template-name}:latest
136
+
137
+ tags : typing.Optional[typing.Sequence[str]]
138
+ The tags to assign to the agent
139
+
140
+ agent_name : typing.Optional[str]
141
+ The name of the agent, optional otherwise a random one will be assigned
142
+
143
+ memory_variables : typing.Optional[typing.Dict[str, str]]
144
+ The memory variables to assign to the agent
145
+
146
+ tool_variables : typing.Optional[typing.Dict[str, str]]
147
+ The tool variables to assign to the agent
148
+
149
+ identity_ids : typing.Optional[typing.Sequence[str]]
150
+ The identity ids to assign to the agent
151
+
152
+ request_options : typing.Optional[RequestOptions]
153
+ Request-specific configuration.
154
+
155
+ Returns
156
+ -------
157
+ AgentsCreateResponse
158
+ 201
159
+
160
+ Examples
161
+ --------
162
+ import asyncio
163
+
164
+ from letta_client import AsyncLetta
165
+
166
+ client = AsyncLetta(
167
+ token="YOUR_TOKEN",
168
+ )
169
+
170
+
171
+ async def main() -> None:
172
+ await client.templates.agents.create(
173
+ project="project",
174
+ template_version="template_version",
175
+ )
176
+
177
+
178
+ asyncio.run(main())
179
+ """
180
+ _response = await self._client_wrapper.httpx_client.request(
181
+ f"v1/templates/{jsonable_encoder(project)}/{jsonable_encoder(template_version)}/agents",
182
+ method="POST",
183
+ json={
184
+ "tags": tags,
185
+ "agent_name": agent_name,
186
+ "memory_variables": memory_variables,
187
+ "tool_variables": tool_variables,
188
+ "identity_ids": identity_ids,
189
+ },
190
+ headers={
191
+ "content-type": "application/json",
192
+ },
193
+ request_options=request_options,
194
+ omit=OMIT,
195
+ )
196
+ try:
197
+ if 200 <= _response.status_code < 300:
198
+ return typing.cast(
199
+ AgentsCreateResponse,
200
+ construct_type(
201
+ type_=AgentsCreateResponse, # type: ignore
202
+ object_=_response.json(),
203
+ ),
204
+ )
205
+ _response_json = _response.json()
206
+ except JSONDecodeError:
207
+ raise ApiError(status_code=_response.status_code, body=_response.text)
208
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .agents_create_response import AgentsCreateResponse
4
+
5
+ __all__ = ["AgentsCreateResponse"]
@@ -1,13 +1,13 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from ...core.unchecked_base_model import UncheckedBaseModel
3
+ from ....core.unchecked_base_model import UncheckedBaseModel
4
4
  import typing
5
- from ...types.agent_state import AgentState
6
- from ...core.pydantic_utilities import IS_PYDANTIC_V2
5
+ from ....types.agent_state import AgentState
6
+ from ....core.pydantic_utilities import IS_PYDANTIC_V2
7
7
  import pydantic
8
8
 
9
9
 
10
- class TemplatesCreateAgentsResponse(UncheckedBaseModel):
10
+ class AgentsCreateResponse(UncheckedBaseModel):
11
11
  agents: typing.List[AgentState]
12
12
 
13
13
  if IS_PYDANTIC_V2:
@@ -1,111 +1,21 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import typing
4
3
  from ..core.client_wrapper import SyncClientWrapper
4
+ from .agents.client import AgentsClient
5
+ import typing
5
6
  from ..core.request_options import RequestOptions
6
- from .types.templates_create_agents_response import TemplatesCreateAgentsResponse
7
- from ..core.jsonable_encoder import jsonable_encoder
7
+ from .types.templates_list_templates_response import TemplatesListTemplatesResponse
8
8
  from ..core.unchecked_base_model import construct_type
9
9
  from json.decoder import JSONDecodeError
10
10
  from ..core.api_error import ApiError
11
- from .types.templates_list_templates_response import TemplatesListTemplatesResponse
12
11
  from ..core.client_wrapper import AsyncClientWrapper
13
-
14
- # this is used as the default value for optional parameters
15
- OMIT = typing.cast(typing.Any, ...)
12
+ from .agents.client import AsyncAgentsClient
16
13
 
17
14
 
18
15
  class TemplatesClient:
19
16
  def __init__(self, *, client_wrapper: SyncClientWrapper):
20
17
  self._client_wrapper = client_wrapper
21
-
22
- def create_agents(
23
- self,
24
- project: str,
25
- template_version: str,
26
- *,
27
- tags: typing.Optional[typing.Sequence[str]] = OMIT,
28
- agent_name: typing.Optional[str] = OMIT,
29
- memory_variables: typing.Optional[typing.Dict[str, str]] = OMIT,
30
- tool_variables: typing.Optional[typing.Dict[str, str]] = OMIT,
31
- identity_ids: typing.Optional[typing.Sequence[str]] = OMIT,
32
- request_options: typing.Optional[RequestOptions] = None,
33
- ) -> TemplatesCreateAgentsResponse:
34
- """
35
- Creates an Agent or multiple Agents from a template
36
-
37
- Parameters
38
- ----------
39
- project : str
40
- The project slug
41
-
42
- template_version : str
43
- The template version, formatted as {template-name}:{version-number} or {template-name}:latest
44
-
45
- tags : typing.Optional[typing.Sequence[str]]
46
- The tags to assign to the agent
47
-
48
- agent_name : typing.Optional[str]
49
- The name of the agent, optional otherwise a random one will be assigned
50
-
51
- memory_variables : typing.Optional[typing.Dict[str, str]]
52
- The memory variables to assign to the agent
53
-
54
- tool_variables : typing.Optional[typing.Dict[str, str]]
55
- The tool variables to assign to the agent
56
-
57
- identity_ids : typing.Optional[typing.Sequence[str]]
58
- The identity ids to assign to the agent
59
-
60
- request_options : typing.Optional[RequestOptions]
61
- Request-specific configuration.
62
-
63
- Returns
64
- -------
65
- TemplatesCreateAgentsResponse
66
- 201
67
-
68
- Examples
69
- --------
70
- from letta_client import Letta
71
-
72
- client = Letta(
73
- token="YOUR_TOKEN",
74
- )
75
- client.templates.create_agents(
76
- project="project",
77
- template_version="template_version",
78
- )
79
- """
80
- _response = self._client_wrapper.httpx_client.request(
81
- f"v1/templates/{jsonable_encoder(project)}/{jsonable_encoder(template_version)}/agents",
82
- method="POST",
83
- json={
84
- "tags": tags,
85
- "agent_name": agent_name,
86
- "memory_variables": memory_variables,
87
- "tool_variables": tool_variables,
88
- "identity_ids": identity_ids,
89
- },
90
- headers={
91
- "content-type": "application/json",
92
- },
93
- request_options=request_options,
94
- omit=OMIT,
95
- )
96
- try:
97
- if 200 <= _response.status_code < 300:
98
- return typing.cast(
99
- TemplatesCreateAgentsResponse,
100
- construct_type(
101
- type_=TemplatesCreateAgentsResponse, # type: ignore
102
- object_=_response.json(),
103
- ),
104
- )
105
- _response_json = _response.json()
106
- except JSONDecodeError:
107
- raise ApiError(status_code=_response.status_code, body=_response.text)
108
- raise ApiError(status_code=_response.status_code, body=_response_json)
18
+ self.agents = AgentsClient(client_wrapper=self._client_wrapper)
109
19
 
110
20
  def listtemplates(
111
21
  self,
@@ -175,102 +85,7 @@ class TemplatesClient:
175
85
  class AsyncTemplatesClient:
176
86
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
177
87
  self._client_wrapper = client_wrapper
178
-
179
- async def create_agents(
180
- self,
181
- project: str,
182
- template_version: str,
183
- *,
184
- tags: typing.Optional[typing.Sequence[str]] = OMIT,
185
- agent_name: typing.Optional[str] = OMIT,
186
- memory_variables: typing.Optional[typing.Dict[str, str]] = OMIT,
187
- tool_variables: typing.Optional[typing.Dict[str, str]] = OMIT,
188
- identity_ids: typing.Optional[typing.Sequence[str]] = OMIT,
189
- request_options: typing.Optional[RequestOptions] = None,
190
- ) -> TemplatesCreateAgentsResponse:
191
- """
192
- Creates an Agent or multiple Agents from a template
193
-
194
- Parameters
195
- ----------
196
- project : str
197
- The project slug
198
-
199
- template_version : str
200
- The template version, formatted as {template-name}:{version-number} or {template-name}:latest
201
-
202
- tags : typing.Optional[typing.Sequence[str]]
203
- The tags to assign to the agent
204
-
205
- agent_name : typing.Optional[str]
206
- The name of the agent, optional otherwise a random one will be assigned
207
-
208
- memory_variables : typing.Optional[typing.Dict[str, str]]
209
- The memory variables to assign to the agent
210
-
211
- tool_variables : typing.Optional[typing.Dict[str, str]]
212
- The tool variables to assign to the agent
213
-
214
- identity_ids : typing.Optional[typing.Sequence[str]]
215
- The identity ids to assign to the agent
216
-
217
- request_options : typing.Optional[RequestOptions]
218
- Request-specific configuration.
219
-
220
- Returns
221
- -------
222
- TemplatesCreateAgentsResponse
223
- 201
224
-
225
- Examples
226
- --------
227
- import asyncio
228
-
229
- from letta_client import AsyncLetta
230
-
231
- client = AsyncLetta(
232
- token="YOUR_TOKEN",
233
- )
234
-
235
-
236
- async def main() -> None:
237
- await client.templates.create_agents(
238
- project="project",
239
- template_version="template_version",
240
- )
241
-
242
-
243
- asyncio.run(main())
244
- """
245
- _response = await self._client_wrapper.httpx_client.request(
246
- f"v1/templates/{jsonable_encoder(project)}/{jsonable_encoder(template_version)}/agents",
247
- method="POST",
248
- json={
249
- "tags": tags,
250
- "agent_name": agent_name,
251
- "memory_variables": memory_variables,
252
- "tool_variables": tool_variables,
253
- "identity_ids": identity_ids,
254
- },
255
- headers={
256
- "content-type": "application/json",
257
- },
258
- request_options=request_options,
259
- omit=OMIT,
260
- )
261
- try:
262
- if 200 <= _response.status_code < 300:
263
- return typing.cast(
264
- TemplatesCreateAgentsResponse,
265
- construct_type(
266
- type_=TemplatesCreateAgentsResponse, # type: ignore
267
- object_=_response.json(),
268
- ),
269
- )
270
- _response_json = _response.json()
271
- except JSONDecodeError:
272
- raise ApiError(status_code=_response.status_code, body=_response.text)
273
- raise ApiError(status_code=_response.status_code, body=_response_json)
88
+ self.agents = AsyncAgentsClient(client_wrapper=self._client_wrapper)
274
89
 
275
90
  async def listtemplates(
276
91
  self,