letta-client 1.0.0a10__py3-none-any.whl → 1.0.0a12__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/_client.py +28 -1
- letta_client/_streaming.py +44 -8
- letta_client/_version.py +1 -1
- letta_client/resources/__init__.py +14 -0
- letta_client/resources/agents/agents.py +0 -8
- letta_client/resources/agents/blocks.py +15 -17
- letta_client/resources/agents/files.py +10 -13
- letta_client/resources/agents/folders.py +10 -13
- letta_client/resources/agents/messages.py +14 -4
- letta_client/resources/agents/tools.py +10 -13
- letta_client/resources/archives.py +10 -12
- letta_client/resources/batches/batches.py +10 -12
- letta_client/resources/batches/messages.py +11 -14
- letta_client/resources/blocks/blocks.py +19 -22
- letta_client/resources/folders/agents.py +10 -13
- letta_client/resources/folders/files.py +9 -12
- letta_client/resources/folders/folders.py +10 -12
- letta_client/resources/groups/groups.py +1 -17
- letta_client/resources/identities/blocks.py +7 -7
- letta_client/resources/identities/identities.py +11 -29
- letta_client/resources/mcp_servers/__init__.py +47 -0
- letta_client/resources/mcp_servers/mcp_servers.py +1165 -0
- letta_client/resources/mcp_servers/refresh.py +192 -0
- letta_client/resources/mcp_servers/tools.py +351 -0
- letta_client/resources/runs/runs.py +11 -13
- letta_client/resources/steps/steps.py +1 -9
- letta_client/resources/tags.py +10 -13
- letta_client/resources/tools.py +14 -16
- letta_client/types/__init__.py +13 -4
- letta_client/types/agent_create_params.py +1 -5
- letta_client/types/agents/__init__.py +2 -3
- letta_client/types/agents/file_list_response.py +14 -3
- letta_client/types/agents/folder_list_response.py +7 -3
- letta_client/types/agents/letta_streaming_response.py +70 -0
- letta_client/types/agents/tool_list_response.py +10 -0
- letta_client/types/archive_list_response.py +10 -0
- letta_client/types/batch_list_response.py +10 -0
- letta_client/types/batches/__init__.py +1 -0
- letta_client/types/batches/message_list_response.py +12 -0
- letta_client/types/{block_list_response.py → block_response.py} +5 -5
- letta_client/types/folder_list_response.py +10 -0
- letta_client/types/folders/agent_list_response.py +2 -1
- letta_client/types/folders/file_list_response.py +7 -4
- letta_client/types/group_create_params.py +1 -5
- letta_client/types/group_modify_params.py +1 -5
- letta_client/types/identities/__init__.py +0 -1
- letta_client/types/identity_create_params.py +1 -5
- letta_client/types/identity_list_response.py +10 -0
- letta_client/types/identity_upsert_params.py +1 -5
- letta_client/types/mcp_server_create_params.py +67 -0
- letta_client/types/mcp_server_create_response.py +74 -0
- letta_client/types/mcp_server_list_response.py +86 -0
- letta_client/types/mcp_server_modify_params.py +76 -0
- letta_client/types/mcp_server_modify_response.py +74 -0
- letta_client/types/mcp_server_retrieve_response.py +74 -0
- letta_client/types/mcp_servers/__init__.py +8 -0
- letta_client/types/mcp_servers/refresh_trigger_params.py +12 -0
- letta_client/types/mcp_servers/tool_list_response.py +10 -0
- letta_client/types/mcp_servers/tool_run_params.py +15 -0
- letta_client/types/mcp_servers/tool_run_response.py +43 -0
- letta_client/types/run_list_response.py +10 -0
- letta_client/types/step_list_params.py +1 -5
- letta_client/types/tag_list_response.py +2 -1
- letta_client/types/tool.py +28 -28
- letta_client/types/tool_list_response.py +10 -0
- {letta_client-1.0.0a10.dist-info → letta_client-1.0.0a12.dist-info}/METADATA +1 -1
- {letta_client-1.0.0a10.dist-info → letta_client-1.0.0a12.dist-info}/RECORD +69 -52
- letta_client/types/agents/block_list_response.py +0 -63
- letta_client/types/agents/block_modify_response.py +0 -63
- letta_client/types/agents/block_retrieve_response.py +0 -63
- letta_client/types/block_create_response.py +0 -63
- letta_client/types/block_modify_response.py +0 -63
- letta_client/types/block_retrieve_response.py +0 -63
- letta_client/types/identities/block_list_response.py +0 -63
- {letta_client-1.0.0a10.dist-info → letta_client-1.0.0a12.dist-info}/WHEEL +0 -0
- {letta_client-1.0.0a10.dist-info → letta_client-1.0.0a12.dist-info}/licenses/LICENSE +0 -0
letta_client/_client.py
CHANGED
|
@@ -49,6 +49,7 @@ from .resources.batches import batches
|
|
|
49
49
|
from .resources.folders import folders
|
|
50
50
|
from .resources.templates import templates
|
|
51
51
|
from .resources.identities import identities
|
|
52
|
+
from .resources.mcp_servers import mcp_servers
|
|
52
53
|
from .types.health_response import HealthResponse
|
|
53
54
|
|
|
54
55
|
__all__ = [
|
|
@@ -64,7 +65,7 @@ __all__ = [
|
|
|
64
65
|
]
|
|
65
66
|
|
|
66
67
|
ENVIRONMENTS: Dict[str, str] = {
|
|
67
|
-
"cloud": "https://
|
|
68
|
+
"cloud": "https://api.letta.com",
|
|
68
69
|
"local": "http://localhost:8283",
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -83,11 +84,13 @@ class Letta(SyncAPIClient):
|
|
|
83
84
|
tags: tags.TagsResource
|
|
84
85
|
batches: batches.BatchesResource
|
|
85
86
|
templates: templates.TemplatesResource
|
|
87
|
+
mcp_servers: mcp_servers.McpServersResource
|
|
86
88
|
with_raw_response: LettaWithRawResponse
|
|
87
89
|
with_streaming_response: LettaWithStreamedResponse
|
|
88
90
|
|
|
89
91
|
# client options
|
|
90
92
|
api_key: str
|
|
93
|
+
project_id: str | None
|
|
91
94
|
|
|
92
95
|
_environment: Literal["cloud", "local"] | NotGiven
|
|
93
96
|
|
|
@@ -95,6 +98,7 @@ class Letta(SyncAPIClient):
|
|
|
95
98
|
self,
|
|
96
99
|
*,
|
|
97
100
|
api_key: str | None = None,
|
|
101
|
+
project_id: str | None = None,
|
|
98
102
|
environment: Literal["cloud", "local"] | NotGiven = not_given,
|
|
99
103
|
base_url: str | httpx.URL | None | NotGiven = not_given,
|
|
100
104
|
timeout: float | Timeout | None | NotGiven = not_given,
|
|
@@ -127,6 +131,8 @@ class Letta(SyncAPIClient):
|
|
|
127
131
|
)
|
|
128
132
|
self.api_key = api_key
|
|
129
133
|
|
|
134
|
+
self.project_id = project_id
|
|
135
|
+
|
|
130
136
|
self._environment = environment
|
|
131
137
|
|
|
132
138
|
base_url_env = os.environ.get("LETTA_BASE_URL")
|
|
@@ -164,6 +170,8 @@ class Letta(SyncAPIClient):
|
|
|
164
170
|
_strict_response_validation=_strict_response_validation,
|
|
165
171
|
)
|
|
166
172
|
|
|
173
|
+
self._default_stream_cls = Stream
|
|
174
|
+
|
|
167
175
|
self.archives = archives.ArchivesResource(self)
|
|
168
176
|
self.tools = tools.ToolsResource(self)
|
|
169
177
|
self.folders = folders.FoldersResource(self)
|
|
@@ -177,6 +185,7 @@ class Letta(SyncAPIClient):
|
|
|
177
185
|
self.tags = tags.TagsResource(self)
|
|
178
186
|
self.batches = batches.BatchesResource(self)
|
|
179
187
|
self.templates = templates.TemplatesResource(self)
|
|
188
|
+
self.mcp_servers = mcp_servers.McpServersResource(self)
|
|
180
189
|
self.with_raw_response = LettaWithRawResponse(self)
|
|
181
190
|
self.with_streaming_response = LettaWithStreamedResponse(self)
|
|
182
191
|
|
|
@@ -197,6 +206,7 @@ class Letta(SyncAPIClient):
|
|
|
197
206
|
return {
|
|
198
207
|
**super().default_headers,
|
|
199
208
|
"X-Stainless-Async": "false",
|
|
209
|
+
"X-Project": self.project_id if self.project_id is not None else Omit(),
|
|
200
210
|
**self._custom_headers,
|
|
201
211
|
}
|
|
202
212
|
|
|
@@ -204,6 +214,7 @@ class Letta(SyncAPIClient):
|
|
|
204
214
|
self,
|
|
205
215
|
*,
|
|
206
216
|
api_key: str | None = None,
|
|
217
|
+
project_id: str | None = None,
|
|
207
218
|
environment: Literal["cloud", "local"] | None = None,
|
|
208
219
|
base_url: str | httpx.URL | None = None,
|
|
209
220
|
timeout: float | Timeout | None | NotGiven = not_given,
|
|
@@ -239,6 +250,7 @@ class Letta(SyncAPIClient):
|
|
|
239
250
|
http_client = http_client or self._client
|
|
240
251
|
return self.__class__(
|
|
241
252
|
api_key=api_key or self.api_key,
|
|
253
|
+
project_id=project_id or self.project_id,
|
|
242
254
|
base_url=base_url or self.base_url,
|
|
243
255
|
environment=environment or self._environment,
|
|
244
256
|
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
|
@@ -320,11 +332,13 @@ class AsyncLetta(AsyncAPIClient):
|
|
|
320
332
|
tags: tags.AsyncTagsResource
|
|
321
333
|
batches: batches.AsyncBatchesResource
|
|
322
334
|
templates: templates.AsyncTemplatesResource
|
|
335
|
+
mcp_servers: mcp_servers.AsyncMcpServersResource
|
|
323
336
|
with_raw_response: AsyncLettaWithRawResponse
|
|
324
337
|
with_streaming_response: AsyncLettaWithStreamedResponse
|
|
325
338
|
|
|
326
339
|
# client options
|
|
327
340
|
api_key: str
|
|
341
|
+
project_id: str | None
|
|
328
342
|
|
|
329
343
|
_environment: Literal["cloud", "local"] | NotGiven
|
|
330
344
|
|
|
@@ -332,6 +346,7 @@ class AsyncLetta(AsyncAPIClient):
|
|
|
332
346
|
self,
|
|
333
347
|
*,
|
|
334
348
|
api_key: str | None = None,
|
|
349
|
+
project_id: str | None = None,
|
|
335
350
|
environment: Literal["cloud", "local"] | NotGiven = not_given,
|
|
336
351
|
base_url: str | httpx.URL | None | NotGiven = not_given,
|
|
337
352
|
timeout: float | Timeout | None | NotGiven = not_given,
|
|
@@ -364,6 +379,8 @@ class AsyncLetta(AsyncAPIClient):
|
|
|
364
379
|
)
|
|
365
380
|
self.api_key = api_key
|
|
366
381
|
|
|
382
|
+
self.project_id = project_id
|
|
383
|
+
|
|
367
384
|
self._environment = environment
|
|
368
385
|
|
|
369
386
|
base_url_env = os.environ.get("LETTA_BASE_URL")
|
|
@@ -401,6 +418,8 @@ class AsyncLetta(AsyncAPIClient):
|
|
|
401
418
|
_strict_response_validation=_strict_response_validation,
|
|
402
419
|
)
|
|
403
420
|
|
|
421
|
+
self._default_stream_cls = AsyncStream
|
|
422
|
+
|
|
404
423
|
self.archives = archives.AsyncArchivesResource(self)
|
|
405
424
|
self.tools = tools.AsyncToolsResource(self)
|
|
406
425
|
self.folders = folders.AsyncFoldersResource(self)
|
|
@@ -414,6 +433,7 @@ class AsyncLetta(AsyncAPIClient):
|
|
|
414
433
|
self.tags = tags.AsyncTagsResource(self)
|
|
415
434
|
self.batches = batches.AsyncBatchesResource(self)
|
|
416
435
|
self.templates = templates.AsyncTemplatesResource(self)
|
|
436
|
+
self.mcp_servers = mcp_servers.AsyncMcpServersResource(self)
|
|
417
437
|
self.with_raw_response = AsyncLettaWithRawResponse(self)
|
|
418
438
|
self.with_streaming_response = AsyncLettaWithStreamedResponse(self)
|
|
419
439
|
|
|
@@ -434,6 +454,7 @@ class AsyncLetta(AsyncAPIClient):
|
|
|
434
454
|
return {
|
|
435
455
|
**super().default_headers,
|
|
436
456
|
"X-Stainless-Async": f"async:{get_async_library()}",
|
|
457
|
+
"X-Project": self.project_id if self.project_id is not None else Omit(),
|
|
437
458
|
**self._custom_headers,
|
|
438
459
|
}
|
|
439
460
|
|
|
@@ -441,6 +462,7 @@ class AsyncLetta(AsyncAPIClient):
|
|
|
441
462
|
self,
|
|
442
463
|
*,
|
|
443
464
|
api_key: str | None = None,
|
|
465
|
+
project_id: str | None = None,
|
|
444
466
|
environment: Literal["cloud", "local"] | None = None,
|
|
445
467
|
base_url: str | httpx.URL | None = None,
|
|
446
468
|
timeout: float | Timeout | None | NotGiven = not_given,
|
|
@@ -476,6 +498,7 @@ class AsyncLetta(AsyncAPIClient):
|
|
|
476
498
|
http_client = http_client or self._client
|
|
477
499
|
return self.__class__(
|
|
478
500
|
api_key=api_key or self.api_key,
|
|
501
|
+
project_id=project_id or self.project_id,
|
|
479
502
|
base_url=base_url or self.base_url,
|
|
480
503
|
environment=environment or self._environment,
|
|
481
504
|
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
|
|
@@ -558,6 +581,7 @@ class LettaWithRawResponse:
|
|
|
558
581
|
self.tags = tags.TagsResourceWithRawResponse(client.tags)
|
|
559
582
|
self.batches = batches.BatchesResourceWithRawResponse(client.batches)
|
|
560
583
|
self.templates = templates.TemplatesResourceWithRawResponse(client.templates)
|
|
584
|
+
self.mcp_servers = mcp_servers.McpServersResourceWithRawResponse(client.mcp_servers)
|
|
561
585
|
|
|
562
586
|
self.health = to_raw_response_wrapper(
|
|
563
587
|
client.health,
|
|
@@ -579,6 +603,7 @@ class AsyncLettaWithRawResponse:
|
|
|
579
603
|
self.tags = tags.AsyncTagsResourceWithRawResponse(client.tags)
|
|
580
604
|
self.batches = batches.AsyncBatchesResourceWithRawResponse(client.batches)
|
|
581
605
|
self.templates = templates.AsyncTemplatesResourceWithRawResponse(client.templates)
|
|
606
|
+
self.mcp_servers = mcp_servers.AsyncMcpServersResourceWithRawResponse(client.mcp_servers)
|
|
582
607
|
|
|
583
608
|
self.health = async_to_raw_response_wrapper(
|
|
584
609
|
client.health,
|
|
@@ -600,6 +625,7 @@ class LettaWithStreamedResponse:
|
|
|
600
625
|
self.tags = tags.TagsResourceWithStreamingResponse(client.tags)
|
|
601
626
|
self.batches = batches.BatchesResourceWithStreamingResponse(client.batches)
|
|
602
627
|
self.templates = templates.TemplatesResourceWithStreamingResponse(client.templates)
|
|
628
|
+
self.mcp_servers = mcp_servers.McpServersResourceWithStreamingResponse(client.mcp_servers)
|
|
603
629
|
|
|
604
630
|
self.health = to_streamed_response_wrapper(
|
|
605
631
|
client.health,
|
|
@@ -621,6 +647,7 @@ class AsyncLettaWithStreamedResponse:
|
|
|
621
647
|
self.tags = tags.AsyncTagsResourceWithStreamingResponse(client.tags)
|
|
622
648
|
self.batches = batches.AsyncBatchesResourceWithStreamingResponse(client.batches)
|
|
623
649
|
self.templates = templates.AsyncTemplatesResourceWithStreamingResponse(client.templates)
|
|
650
|
+
self.mcp_servers = mcp_servers.AsyncMcpServersResourceWithStreamingResponse(client.mcp_servers)
|
|
624
651
|
|
|
625
652
|
self.health = async_to_streamed_response_wrapper(
|
|
626
653
|
client.health,
|
letta_client/_streaming.py
CHANGED
|
@@ -55,11 +55,29 @@ class Stream(Generic[_T]):
|
|
|
55
55
|
iterator = self._iter_events()
|
|
56
56
|
|
|
57
57
|
for sse in iterator:
|
|
58
|
-
|
|
58
|
+
if sse.data.startswith("[DONE]"):
|
|
59
|
+
break
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
if sse.event == "error":
|
|
62
|
+
body = sse.data
|
|
63
|
+
|
|
64
|
+
try:
|
|
65
|
+
body = sse.json()
|
|
66
|
+
err_msg = f"{body}"
|
|
67
|
+
except Exception:
|
|
68
|
+
err_msg = sse.data or f"Error code: {response.status_code}"
|
|
69
|
+
|
|
70
|
+
raise self._client._make_status_error(
|
|
71
|
+
err_msg,
|
|
72
|
+
body=body,
|
|
73
|
+
response=self.response,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
if sse.event is None:
|
|
77
|
+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
78
|
+
|
|
79
|
+
# As we might not fully consume the response stream, we need to close it explicitly
|
|
80
|
+
response.close()
|
|
63
81
|
|
|
64
82
|
def __enter__(self) -> Self:
|
|
65
83
|
return self
|
|
@@ -119,11 +137,29 @@ class AsyncStream(Generic[_T]):
|
|
|
119
137
|
iterator = self._iter_events()
|
|
120
138
|
|
|
121
139
|
async for sse in iterator:
|
|
122
|
-
|
|
140
|
+
if sse.data.startswith("[DONE]"):
|
|
141
|
+
break
|
|
142
|
+
|
|
143
|
+
if sse.event == "error":
|
|
144
|
+
body = sse.data
|
|
145
|
+
|
|
146
|
+
try:
|
|
147
|
+
body = sse.json()
|
|
148
|
+
err_msg = f"{body}"
|
|
149
|
+
except Exception:
|
|
150
|
+
err_msg = sse.data or f"Error code: {response.status_code}"
|
|
151
|
+
|
|
152
|
+
raise self._client._make_status_error(
|
|
153
|
+
err_msg,
|
|
154
|
+
body=body,
|
|
155
|
+
response=self.response,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
if sse.event is None:
|
|
159
|
+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
123
160
|
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
...
|
|
161
|
+
# As we might not fully consume the response stream, we need to close it explicitly
|
|
162
|
+
await response.aclose()
|
|
127
163
|
|
|
128
164
|
async def __aenter__(self) -> Self:
|
|
129
165
|
return self
|
letta_client/_version.py
CHANGED
|
@@ -104,6 +104,14 @@ from .identities import (
|
|
|
104
104
|
IdentitiesResourceWithStreamingResponse,
|
|
105
105
|
AsyncIdentitiesResourceWithStreamingResponse,
|
|
106
106
|
)
|
|
107
|
+
from .mcp_servers import (
|
|
108
|
+
McpServersResource,
|
|
109
|
+
AsyncMcpServersResource,
|
|
110
|
+
McpServersResourceWithRawResponse,
|
|
111
|
+
AsyncMcpServersResourceWithRawResponse,
|
|
112
|
+
McpServersResourceWithStreamingResponse,
|
|
113
|
+
AsyncMcpServersResourceWithStreamingResponse,
|
|
114
|
+
)
|
|
107
115
|
|
|
108
116
|
__all__ = [
|
|
109
117
|
"ArchivesResource",
|
|
@@ -184,4 +192,10 @@ __all__ = [
|
|
|
184
192
|
"AsyncTemplatesResourceWithRawResponse",
|
|
185
193
|
"TemplatesResourceWithStreamingResponse",
|
|
186
194
|
"AsyncTemplatesResourceWithStreamingResponse",
|
|
195
|
+
"McpServersResource",
|
|
196
|
+
"AsyncMcpServersResource",
|
|
197
|
+
"McpServersResourceWithRawResponse",
|
|
198
|
+
"AsyncMcpServersResourceWithRawResponse",
|
|
199
|
+
"McpServersResourceWithStreamingResponse",
|
|
200
|
+
"AsyncMcpServersResourceWithStreamingResponse",
|
|
187
201
|
]
|
|
@@ -191,7 +191,6 @@ class AgentsResource(SyncAPIResource):
|
|
|
191
191
|
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
192
192
|
tool_rules: Optional[Iterable[agent_create_params.ToolRule]] | Omit = omit,
|
|
193
193
|
tools: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
194
|
-
x_project: str | Omit = omit,
|
|
195
194
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
196
195
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
197
196
|
extra_headers: Headers | None = None,
|
|
@@ -306,8 +305,6 @@ class AgentsResource(SyncAPIResource):
|
|
|
306
305
|
|
|
307
306
|
tools: The tools used by the agent.
|
|
308
307
|
|
|
309
|
-
x_project: The project slug to associate with the agent (cloud only).
|
|
310
|
-
|
|
311
308
|
extra_headers: Send extra headers
|
|
312
309
|
|
|
313
310
|
extra_query: Add additional query parameters to the request
|
|
@@ -316,7 +313,6 @@ class AgentsResource(SyncAPIResource):
|
|
|
316
313
|
|
|
317
314
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
318
315
|
"""
|
|
319
|
-
extra_headers = {**strip_not_given({"X-Project": x_project}), **(extra_headers or {})}
|
|
320
316
|
return self._post(
|
|
321
317
|
"/v1/agents/",
|
|
322
318
|
body=maybe_transform(
|
|
@@ -1026,7 +1022,6 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1026
1022
|
tool_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1027
1023
|
tool_rules: Optional[Iterable[agent_create_params.ToolRule]] | Omit = omit,
|
|
1028
1024
|
tools: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
1029
|
-
x_project: str | Omit = omit,
|
|
1030
1025
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1031
1026
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1032
1027
|
extra_headers: Headers | None = None,
|
|
@@ -1141,8 +1136,6 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1141
1136
|
|
|
1142
1137
|
tools: The tools used by the agent.
|
|
1143
1138
|
|
|
1144
|
-
x_project: The project slug to associate with the agent (cloud only).
|
|
1145
|
-
|
|
1146
1139
|
extra_headers: Send extra headers
|
|
1147
1140
|
|
|
1148
1141
|
extra_query: Add additional query parameters to the request
|
|
@@ -1151,7 +1144,6 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
1151
1144
|
|
|
1152
1145
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
1153
1146
|
"""
|
|
1154
|
-
extra_headers = {**strip_not_given({"X-Project": x_project}), **(extra_headers or {})}
|
|
1155
1147
|
return await self._post(
|
|
1156
1148
|
"/v1/agents/",
|
|
1157
1149
|
body=await async_maybe_transform(
|
|
@@ -21,9 +21,7 @@ from ...pagination import SyncArrayPage, AsyncArrayPage
|
|
|
21
21
|
from ..._base_client import AsyncPaginator, make_request_options
|
|
22
22
|
from ...types.agents import block_list_params, block_modify_params
|
|
23
23
|
from ...types.agent_state import AgentState
|
|
24
|
-
from ...types.
|
|
25
|
-
from ...types.agents.block_modify_response import BlockModifyResponse
|
|
26
|
-
from ...types.agents.block_retrieve_response import BlockRetrieveResponse
|
|
24
|
+
from ...types.block_response import BlockResponse
|
|
27
25
|
|
|
28
26
|
__all__ = ["BlocksResource", "AsyncBlocksResource"]
|
|
29
27
|
|
|
@@ -59,7 +57,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
59
57
|
extra_query: Query | None = None,
|
|
60
58
|
extra_body: Body | None = None,
|
|
61
59
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
|
-
) ->
|
|
60
|
+
) -> BlockResponse:
|
|
63
61
|
"""
|
|
64
62
|
Retrieve a core memory block from an agent.
|
|
65
63
|
|
|
@@ -83,7 +81,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
83
81
|
options=make_request_options(
|
|
84
82
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
85
83
|
),
|
|
86
|
-
cast_to=
|
|
84
|
+
cast_to=BlockResponse,
|
|
87
85
|
)
|
|
88
86
|
|
|
89
87
|
def list(
|
|
@@ -101,7 +99,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
101
99
|
extra_query: Query | None = None,
|
|
102
100
|
extra_body: Body | None = None,
|
|
103
101
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
104
|
-
) -> SyncArrayPage[
|
|
102
|
+
) -> SyncArrayPage[BlockResponse]:
|
|
105
103
|
"""
|
|
106
104
|
Retrieve the core memory blocks of a specific agent.
|
|
107
105
|
|
|
@@ -133,7 +131,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
133
131
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
134
132
|
return self._get_api_list(
|
|
135
133
|
f"/v1/agents/{agent_id}/core-memory/blocks",
|
|
136
|
-
page=SyncArrayPage[
|
|
134
|
+
page=SyncArrayPage[BlockResponse],
|
|
137
135
|
options=make_request_options(
|
|
138
136
|
extra_headers=extra_headers,
|
|
139
137
|
extra_query=extra_query,
|
|
@@ -150,7 +148,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
150
148
|
block_list_params.BlockListParams,
|
|
151
149
|
),
|
|
152
150
|
),
|
|
153
|
-
model=
|
|
151
|
+
model=BlockResponse,
|
|
154
152
|
)
|
|
155
153
|
|
|
156
154
|
def attach(
|
|
@@ -259,7 +257,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
259
257
|
extra_query: Query | None = None,
|
|
260
258
|
extra_body: Body | None = None,
|
|
261
259
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
262
|
-
) ->
|
|
260
|
+
) -> BlockResponse:
|
|
263
261
|
"""
|
|
264
262
|
Updates a core memory block of an agent.
|
|
265
263
|
|
|
@@ -333,7 +331,7 @@ class BlocksResource(SyncAPIResource):
|
|
|
333
331
|
options=make_request_options(
|
|
334
332
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
335
333
|
),
|
|
336
|
-
cast_to=
|
|
334
|
+
cast_to=BlockResponse,
|
|
337
335
|
)
|
|
338
336
|
|
|
339
337
|
|
|
@@ -368,7 +366,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
368
366
|
extra_query: Query | None = None,
|
|
369
367
|
extra_body: Body | None = None,
|
|
370
368
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
371
|
-
) ->
|
|
369
|
+
) -> BlockResponse:
|
|
372
370
|
"""
|
|
373
371
|
Retrieve a core memory block from an agent.
|
|
374
372
|
|
|
@@ -392,7 +390,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
392
390
|
options=make_request_options(
|
|
393
391
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
394
392
|
),
|
|
395
|
-
cast_to=
|
|
393
|
+
cast_to=BlockResponse,
|
|
396
394
|
)
|
|
397
395
|
|
|
398
396
|
def list(
|
|
@@ -410,7 +408,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
410
408
|
extra_query: Query | None = None,
|
|
411
409
|
extra_body: Body | None = None,
|
|
412
410
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
413
|
-
) -> AsyncPaginator[
|
|
411
|
+
) -> AsyncPaginator[BlockResponse, AsyncArrayPage[BlockResponse]]:
|
|
414
412
|
"""
|
|
415
413
|
Retrieve the core memory blocks of a specific agent.
|
|
416
414
|
|
|
@@ -442,7 +440,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
442
440
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
443
441
|
return self._get_api_list(
|
|
444
442
|
f"/v1/agents/{agent_id}/core-memory/blocks",
|
|
445
|
-
page=AsyncArrayPage[
|
|
443
|
+
page=AsyncArrayPage[BlockResponse],
|
|
446
444
|
options=make_request_options(
|
|
447
445
|
extra_headers=extra_headers,
|
|
448
446
|
extra_query=extra_query,
|
|
@@ -459,7 +457,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
459
457
|
block_list_params.BlockListParams,
|
|
460
458
|
),
|
|
461
459
|
),
|
|
462
|
-
model=
|
|
460
|
+
model=BlockResponse,
|
|
463
461
|
)
|
|
464
462
|
|
|
465
463
|
async def attach(
|
|
@@ -568,7 +566,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
568
566
|
extra_query: Query | None = None,
|
|
569
567
|
extra_body: Body | None = None,
|
|
570
568
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
571
|
-
) ->
|
|
569
|
+
) -> BlockResponse:
|
|
572
570
|
"""
|
|
573
571
|
Updates a core memory block of an agent.
|
|
574
572
|
|
|
@@ -642,7 +640,7 @@ class AsyncBlocksResource(AsyncAPIResource):
|
|
|
642
640
|
options=make_request_options(
|
|
643
641
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
644
642
|
),
|
|
645
|
-
cast_to=
|
|
643
|
+
cast_to=BlockResponse,
|
|
646
644
|
)
|
|
647
645
|
|
|
648
646
|
|
|
@@ -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
|
|
11
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
14
14
|
from ..._response import (
|
|
@@ -17,8 +17,7 @@ from ..._response import (
|
|
|
17
17
|
async_to_raw_response_wrapper,
|
|
18
18
|
async_to_streamed_response_wrapper,
|
|
19
19
|
)
|
|
20
|
-
from ...
|
|
21
|
-
from ..._base_client import AsyncPaginator, make_request_options
|
|
20
|
+
from ..._base_client import make_request_options
|
|
22
21
|
from ...types.agents import file_list_params
|
|
23
22
|
from ...types.agents.file_list_response import FileListResponse
|
|
24
23
|
from ...types.agents.file_open_response import FileOpenResponse
|
|
@@ -64,7 +63,7 @@ class FilesResource(SyncAPIResource):
|
|
|
64
63
|
extra_query: Query | None = None,
|
|
65
64
|
extra_body: Body | None = None,
|
|
66
65
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
67
|
-
) ->
|
|
66
|
+
) -> FileListResponse:
|
|
68
67
|
"""
|
|
69
68
|
Get the files attached to an agent with their open/closed status.
|
|
70
69
|
|
|
@@ -98,9 +97,8 @@ class FilesResource(SyncAPIResource):
|
|
|
98
97
|
"""
|
|
99
98
|
if not agent_id:
|
|
100
99
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
101
|
-
return self.
|
|
100
|
+
return self._get(
|
|
102
101
|
f"/v1/agents/{agent_id}/files",
|
|
103
|
-
page=SyncNextFilesPage[FileListResponse],
|
|
104
102
|
options=make_request_options(
|
|
105
103
|
extra_headers=extra_headers,
|
|
106
104
|
extra_query=extra_query,
|
|
@@ -119,7 +117,7 @@ class FilesResource(SyncAPIResource):
|
|
|
119
117
|
file_list_params.FileListParams,
|
|
120
118
|
),
|
|
121
119
|
),
|
|
122
|
-
|
|
120
|
+
cast_to=FileListResponse,
|
|
123
121
|
)
|
|
124
122
|
|
|
125
123
|
def close(
|
|
@@ -268,7 +266,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
268
266
|
"""
|
|
269
267
|
return AsyncFilesResourceWithStreamingResponse(self)
|
|
270
268
|
|
|
271
|
-
def list(
|
|
269
|
+
async def list(
|
|
272
270
|
self,
|
|
273
271
|
agent_id: str,
|
|
274
272
|
*,
|
|
@@ -285,7 +283,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
285
283
|
extra_query: Query | None = None,
|
|
286
284
|
extra_body: Body | None = None,
|
|
287
285
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
288
|
-
) ->
|
|
286
|
+
) -> FileListResponse:
|
|
289
287
|
"""
|
|
290
288
|
Get the files attached to an agent with their open/closed status.
|
|
291
289
|
|
|
@@ -319,15 +317,14 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
319
317
|
"""
|
|
320
318
|
if not agent_id:
|
|
321
319
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
322
|
-
return self.
|
|
320
|
+
return await self._get(
|
|
323
321
|
f"/v1/agents/{agent_id}/files",
|
|
324
|
-
page=AsyncNextFilesPage[FileListResponse],
|
|
325
322
|
options=make_request_options(
|
|
326
323
|
extra_headers=extra_headers,
|
|
327
324
|
extra_query=extra_query,
|
|
328
325
|
extra_body=extra_body,
|
|
329
326
|
timeout=timeout,
|
|
330
|
-
query=
|
|
327
|
+
query=await async_maybe_transform(
|
|
331
328
|
{
|
|
332
329
|
"after": after,
|
|
333
330
|
"before": before,
|
|
@@ -340,7 +337,7 @@ class AsyncFilesResource(AsyncAPIResource):
|
|
|
340
337
|
file_list_params.FileListParams,
|
|
341
338
|
),
|
|
342
339
|
),
|
|
343
|
-
|
|
340
|
+
cast_to=FileListResponse,
|
|
344
341
|
)
|
|
345
342
|
|
|
346
343
|
async def close(
|
|
@@ -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
|
|
11
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
14
14
|
from ..._response import (
|
|
@@ -17,8 +17,7 @@ from ..._response import (
|
|
|
17
17
|
async_to_raw_response_wrapper,
|
|
18
18
|
async_to_streamed_response_wrapper,
|
|
19
19
|
)
|
|
20
|
-
from ...
|
|
21
|
-
from ..._base_client import AsyncPaginator, make_request_options
|
|
20
|
+
from ..._base_client import make_request_options
|
|
22
21
|
from ...types.agents import folder_list_params
|
|
23
22
|
from ...types.agent_state import AgentState
|
|
24
23
|
from ...types.agents.folder_list_response import FolderListResponse
|
|
@@ -61,7 +60,7 @@ class FoldersResource(SyncAPIResource):
|
|
|
61
60
|
extra_query: Query | None = None,
|
|
62
61
|
extra_body: Body | None = None,
|
|
63
62
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
64
|
-
) ->
|
|
63
|
+
) -> FolderListResponse:
|
|
65
64
|
"""
|
|
66
65
|
Get the folders associated with an agent.
|
|
67
66
|
|
|
@@ -91,9 +90,8 @@ class FoldersResource(SyncAPIResource):
|
|
|
91
90
|
"""
|
|
92
91
|
if not agent_id:
|
|
93
92
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
94
|
-
return self.
|
|
93
|
+
return self._get(
|
|
95
94
|
f"/v1/agents/{agent_id}/folders",
|
|
96
|
-
page=SyncArrayPage[FolderListResponse],
|
|
97
95
|
options=make_request_options(
|
|
98
96
|
extra_headers=extra_headers,
|
|
99
97
|
extra_query=extra_query,
|
|
@@ -110,7 +108,7 @@ class FoldersResource(SyncAPIResource):
|
|
|
110
108
|
folder_list_params.FolderListParams,
|
|
111
109
|
),
|
|
112
110
|
),
|
|
113
|
-
|
|
111
|
+
cast_to=FolderListResponse,
|
|
114
112
|
)
|
|
115
113
|
|
|
116
114
|
def attach(
|
|
@@ -214,7 +212,7 @@ class AsyncFoldersResource(AsyncAPIResource):
|
|
|
214
212
|
"""
|
|
215
213
|
return AsyncFoldersResourceWithStreamingResponse(self)
|
|
216
214
|
|
|
217
|
-
def list(
|
|
215
|
+
async def list(
|
|
218
216
|
self,
|
|
219
217
|
agent_id: str,
|
|
220
218
|
*,
|
|
@@ -229,7 +227,7 @@ class AsyncFoldersResource(AsyncAPIResource):
|
|
|
229
227
|
extra_query: Query | None = None,
|
|
230
228
|
extra_body: Body | None = None,
|
|
231
229
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
232
|
-
) ->
|
|
230
|
+
) -> FolderListResponse:
|
|
233
231
|
"""
|
|
234
232
|
Get the folders associated with an agent.
|
|
235
233
|
|
|
@@ -259,15 +257,14 @@ class AsyncFoldersResource(AsyncAPIResource):
|
|
|
259
257
|
"""
|
|
260
258
|
if not agent_id:
|
|
261
259
|
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
|
|
262
|
-
return self.
|
|
260
|
+
return await self._get(
|
|
263
261
|
f"/v1/agents/{agent_id}/folders",
|
|
264
|
-
page=AsyncArrayPage[FolderListResponse],
|
|
265
262
|
options=make_request_options(
|
|
266
263
|
extra_headers=extra_headers,
|
|
267
264
|
extra_query=extra_query,
|
|
268
265
|
extra_body=extra_body,
|
|
269
266
|
timeout=timeout,
|
|
270
|
-
query=
|
|
267
|
+
query=await async_maybe_transform(
|
|
271
268
|
{
|
|
272
269
|
"after": after,
|
|
273
270
|
"before": before,
|
|
@@ -278,7 +275,7 @@ class AsyncFoldersResource(AsyncAPIResource):
|
|
|
278
275
|
folder_list_params.FolderListParams,
|
|
279
276
|
),
|
|
280
277
|
),
|
|
281
|
-
|
|
278
|
+
cast_to=FolderListResponse,
|
|
282
279
|
)
|
|
283
280
|
|
|
284
281
|
async def attach(
|