Skip to content

Commit 94b5348

Browse files
feat(memory): agent identity memory store attachments — API layer
1 parent af81ef3 commit 94b5348

6 files changed

Lines changed: 117 additions & 7 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 23
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta/warp-api-e752e75a35d88b84870729ef94b0c32783172983420cbff1b204ca14375553f7.yml
3-
openapi_spec_hash: 34787afc1e1c84a643431a0f0eb352ae
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta/warp-api-2783b07289e9f71f07550497c5180824f3dbc92477b5d1d8a80fa6dce4e3b8b6.yml
3+
openapi_spec_hash: e1d4cff965beed1ec255bf387d55d940
44
config_hash: 5a6e285f6e3a958a887b31b972a3f49c

src/oz_agent_sdk/resources/agent/agent_.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def create(
5252
name: str,
5353
base_model: Optional[str] | Omit = omit,
5454
description: Optional[str] | Omit = omit,
55+
memory_stores: Iterable[agent_create_params.MemoryStore] | Omit = omit,
5556
secrets: Iterable[agent_create_params.Secret] | Omit = omit,
5657
skills: SequenceNotStr[str] | Omit = omit,
5758
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -73,6 +74,10 @@ def create(
7374
7475
description: Optional description of the agent
7576
77+
memory_stores: Optional list of memory stores to attach to the agent. Each store must be
78+
team-owned by the same team as the agent. Duplicate UIDs within a single request
79+
are rejected.
80+
7681
secrets: Optional list of secrets associated with the agent. Duplicate names within a
7782
single request are rejected. Each entry is unioned into the run-time secret
7883
scope when the agent executes.
@@ -99,6 +104,7 @@ def create(
99104
"name": name,
100105
"base_model": base_model,
101106
"description": description,
107+
"memory_stores": memory_stores,
102108
"secrets": secrets,
103109
"skills": skills,
104110
},
@@ -116,6 +122,7 @@ def update(
116122
*,
117123
base_model: Optional[str] | Omit = omit,
118124
description: Optional[str] | Omit = omit,
125+
memory_stores: Optional[Iterable[agent_update_params.MemoryStore]] | Omit = omit,
119126
name: str | Omit = omit,
120127
secrets: Optional[Iterable[agent_update_params.Secret]] | Omit = omit,
121128
skills: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -137,6 +144,9 @@ def update(
137144
description: Replacement description. Omit or pass `null` to leave unchanged, or use an empty
138145
value to clear.
139146
147+
memory_stores: Replacement list of memory stores. Omit to leave unchanged, pass an empty array
148+
to clear, or pass a non-empty array to replace.
149+
140150
name: The new name for the agent
141151
142152
secrets: Replacement list of secrets. Omit to leave unchanged, pass an empty array to
@@ -161,6 +171,7 @@ def update(
161171
{
162172
"base_model": base_model,
163173
"description": description,
174+
"memory_stores": memory_stores,
164175
"name": name,
165176
"secrets": secrets,
166177
"skills": skills,
@@ -296,6 +307,7 @@ async def create(
296307
name: str,
297308
base_model: Optional[str] | Omit = omit,
298309
description: Optional[str] | Omit = omit,
310+
memory_stores: Iterable[agent_create_params.MemoryStore] | Omit = omit,
299311
secrets: Iterable[agent_create_params.Secret] | Omit = omit,
300312
skills: SequenceNotStr[str] | Omit = omit,
301313
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -317,6 +329,10 @@ async def create(
317329
318330
description: Optional description of the agent
319331
332+
memory_stores: Optional list of memory stores to attach to the agent. Each store must be
333+
team-owned by the same team as the agent. Duplicate UIDs within a single request
334+
are rejected.
335+
320336
secrets: Optional list of secrets associated with the agent. Duplicate names within a
321337
single request are rejected. Each entry is unioned into the run-time secret
322338
scope when the agent executes.
@@ -343,6 +359,7 @@ async def create(
343359
"name": name,
344360
"base_model": base_model,
345361
"description": description,
362+
"memory_stores": memory_stores,
346363
"secrets": secrets,
347364
"skills": skills,
348365
},
@@ -360,6 +377,7 @@ async def update(
360377
*,
361378
base_model: Optional[str] | Omit = omit,
362379
description: Optional[str] | Omit = omit,
380+
memory_stores: Optional[Iterable[agent_update_params.MemoryStore]] | Omit = omit,
363381
name: str | Omit = omit,
364382
secrets: Optional[Iterable[agent_update_params.Secret]] | Omit = omit,
365383
skills: Optional[SequenceNotStr[str]] | Omit = omit,
@@ -381,6 +399,9 @@ async def update(
381399
description: Replacement description. Omit or pass `null` to leave unchanged, or use an empty
382400
value to clear.
383401
402+
memory_stores: Replacement list of memory stores. Omit to leave unchanged, pass an empty array
403+
to clear, or pass a non-empty array to replace.
404+
384405
name: The new name for the agent
385406
386407
secrets: Replacement list of secrets. Omit to leave unchanged, pass an empty array to
@@ -405,6 +426,7 @@ async def update(
405426
{
406427
"base_model": base_model,
407428
"description": description,
429+
"memory_stores": memory_stores,
408430
"name": name,
409431
"secrets": secrets,
410432
"skills": skills,

src/oz_agent_sdk/types/agent/agent_create_params.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from __future__ import annotations
44

55
from typing import Iterable, Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import Literal, Required, TypedDict
77

88
from ..._types import SequenceNotStr
99

10-
__all__ = ["AgentCreateParams", "Secret"]
10+
__all__ = ["AgentCreateParams", "MemoryStore", "Secret"]
1111

1212

1313
class AgentCreateParams(TypedDict, total=False):
@@ -20,6 +20,13 @@ class AgentCreateParams(TypedDict, total=False):
2020
description: Optional[str]
2121
"""Optional description of the agent"""
2222

23+
memory_stores: Iterable[MemoryStore]
24+
"""
25+
Optional list of memory stores to attach to the agent. Each store must be
26+
team-owned by the same team as the agent. Duplicate UIDs within a single request
27+
are rejected.
28+
"""
29+
2330
secrets: Iterable[Secret]
2431
"""
2532
Optional list of secrets associated with the agent. Duplicate names within a
@@ -37,6 +44,19 @@ class AgentCreateParams(TypedDict, total=False):
3744
"""
3845

3946

47+
class MemoryStore(TypedDict, total=False):
48+
"""Reference to a memory store to attach to an agent."""
49+
50+
access: Required[Literal["read_write", "read_only"]]
51+
"""Access level for the store."""
52+
53+
instructions: Required[str]
54+
"""Instructions for how the agent should use this memory store. Must not be empty."""
55+
56+
uid: Required[str]
57+
"""UID of the memory store."""
58+
59+
4060
class Secret(TypedDict, total=False):
4161
"""Reference to a managed secret by name."""
4262

src/oz_agent_sdk/types/agent/agent_response.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22

33
from typing import List, Optional
44
from datetime import datetime
5+
from typing_extensions import Literal
56

67
from ..._models import BaseModel
78

8-
__all__ = ["AgentResponse", "Secret"]
9+
__all__ = ["AgentResponse", "MemoryStore", "Secret"]
10+
11+
12+
class MemoryStore(BaseModel):
13+
"""Reference to a memory store to attach to an agent."""
14+
15+
access: Literal["read_write", "read_only"]
16+
"""Access level for the store."""
17+
18+
instructions: str
19+
"""Instructions for how the agent should use this memory store. Must not be empty."""
20+
21+
uid: str
22+
"""UID of the memory store."""
923

1024

1125
class Secret(BaseModel):
@@ -22,6 +36,12 @@ class AgentResponse(BaseModel):
2236
created_at: datetime
2337
"""When the agent was created (RFC3339)"""
2438

39+
memory_stores: List[MemoryStore]
40+
"""
41+
Memory stores attached to this agent. Always present; empty when no stores are
42+
attached.
43+
"""
44+
2545
name: str
2646
"""Name of the agent"""
2747

src/oz_agent_sdk/types/agent/agent_update_params.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from __future__ import annotations
44

55
from typing import Iterable, Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import Literal, Required, TypedDict
77

88
from ..._types import SequenceNotStr
99

10-
__all__ = ["AgentUpdateParams", "Secret"]
10+
__all__ = ["AgentUpdateParams", "MemoryStore", "Secret"]
1111

1212

1313
class AgentUpdateParams(TypedDict, total=False):
@@ -23,6 +23,13 @@ class AgentUpdateParams(TypedDict, total=False):
2323
Omit or pass `null` to leave unchanged, or use an empty value to clear.
2424
"""
2525

26+
memory_stores: Optional[Iterable[MemoryStore]]
27+
"""Replacement list of memory stores.
28+
29+
Omit to leave unchanged, pass an empty array to clear, or pass a non-empty array
30+
to replace.
31+
"""
32+
2633
name: str
2734
"""The new name for the agent"""
2835

@@ -41,6 +48,19 @@ class AgentUpdateParams(TypedDict, total=False):
4148
"""
4249

4350

51+
class MemoryStore(TypedDict, total=False):
52+
"""Reference to a memory store to attach to an agent."""
53+
54+
access: Required[Literal["read_write", "read_only"]]
55+
"""Access level for the store."""
56+
57+
instructions: Required[str]
58+
"""Instructions for how the agent should use this memory store. Must not be empty."""
59+
60+
uid: Required[str]
61+
"""UID of the memory store."""
62+
63+
4464
class Secret(TypedDict, total=False):
4565
"""Reference to a managed secret by name."""
4666

tests/api_resources/agent/test_agent_.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ def test_method_create_with_all_params(self, client: OzAPI) -> None:
3535
name="name",
3636
base_model="base_model",
3737
description="description",
38+
memory_stores=[
39+
{
40+
"access": "read_write",
41+
"instructions": "instructions",
42+
"uid": "uid",
43+
}
44+
],
3845
secrets=[{"name": "name"}],
3946
skills=["string"],
4047
)
@@ -81,6 +88,13 @@ def test_method_update_with_all_params(self, client: OzAPI) -> None:
8188
uid="uid",
8289
base_model="base_model",
8390
description="description",
91+
memory_stores=[
92+
{
93+
"access": "read_write",
94+
"instructions": "instructions",
95+
"uid": "uid",
96+
}
97+
],
8498
name="name",
8599
secrets=[{"name": "name"}],
86100
skills=["string"],
@@ -254,6 +268,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncOzAPI) ->
254268
name="name",
255269
base_model="base_model",
256270
description="description",
271+
memory_stores=[
272+
{
273+
"access": "read_write",
274+
"instructions": "instructions",
275+
"uid": "uid",
276+
}
277+
],
257278
secrets=[{"name": "name"}],
258279
skills=["string"],
259280
)
@@ -300,6 +321,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncOzAPI) ->
300321
uid="uid",
301322
base_model="base_model",
302323
description="description",
324+
memory_stores=[
325+
{
326+
"access": "read_write",
327+
"instructions": "instructions",
328+
"uid": "uid",
329+
}
330+
],
303331
name="name",
304332
secrets=[{"name": "name"}],
305333
skills=["string"],

0 commit comments

Comments
 (0)