feat(sdk, docs): expose agent_custom_instructions for agent-scoped extraction (#6809)

This commit is contained in:
Saket Aryan
2026-08-05 22:12:10 +05:30
committed by GitHub
parent 3f717e5459
commit 12c47f5249
14 changed files with 375 additions and 8 deletions
+6
View File
@@ -734,6 +734,7 @@ class MemoryClient:
memory_depth: Optional[str] = None,
usecase_setting: Optional[str] = None,
multilingual: Optional[bool] = None,
agent_custom_instructions: Optional[str] = None,
) -> Dict[str, Any]:
"""Update the project settings.
@@ -744,6 +745,7 @@ class MemoryClient:
memory_depth: Memory depth for the project.
usecase_setting: Usecase setting for the project.
multilingual: Whether to use the input language for memory storage and retrieval.
agent_custom_instructions: New extraction instructions for agent-scoped memories.
Returns:
Dictionary containing the API response.
@@ -768,6 +770,7 @@ class MemoryClient:
"memory_depth": memory_depth,
"usecase_setting": usecase_setting,
"multilingual": multilingual,
"agent_custom_instructions": agent_custom_instructions,
}.items()
if v is not None
},
@@ -1636,6 +1639,7 @@ class AsyncMemoryClient:
memory_depth: Optional[str] = None,
usecase_setting: Optional[str] = None,
multilingual: Optional[bool] = None,
agent_custom_instructions: Optional[str] = None,
) -> Dict[str, Any]:
"""Update the project settings.
@@ -1646,6 +1650,7 @@ class AsyncMemoryClient:
memory_depth: Memory depth for the project.
usecase_setting: Usecase setting for the project.
multilingual: Whether to use the input language for memory storage and retrieval.
agent_custom_instructions: New extraction instructions for agent-scoped memories.
Returns:
Dictionary containing the API response.
@@ -1670,6 +1675,7 @@ class AsyncMemoryClient:
"memory_depth": memory_depth,
"usecase_setting": usecase_setting,
"multilingual": multilingual,
"agent_custom_instructions": agent_custom_instructions,
}.items()
if v is not None
},
+28 -4
View File
@@ -177,6 +177,7 @@ class BaseProject(ABC):
self,
custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None,
agent_custom_instructions: Optional[str] = None,
) -> Dict[str, Any]:
"""
Update project settings.
@@ -184,6 +185,7 @@ class BaseProject(ABC):
Args:
custom_instructions: New instructions for the project
custom_categories: New categories for the project
agent_custom_instructions: New extraction instructions for agent-scoped memories
Returns:
Dictionary containing the API response.
@@ -396,6 +398,7 @@ class Project(BaseProject):
custom_categories: Optional[List[str]] = None,
multilingual: Optional[bool] = None,
decay: Optional[bool] = None,
agent_custom_instructions: Optional[str] = None,
) -> Dict[str, Any]:
"""
Update project settings.
@@ -407,6 +410,7 @@ class Project(BaseProject):
decay: Toggle Memory Decay for this project. When True, search-time
ranking boosts recently-used memories and gently dampens stale ones; when
False, ranking is restored to the pre-decay behaviour. Off by default.
agent_custom_instructions: New extraction instructions for agent-scoped memories
Returns:
Dictionary containing the API response.
@@ -418,10 +422,17 @@ class Project(BaseProject):
NetworkError: If network connectivity issues occur.
ValueError: If org_id or project_id are not set.
"""
if custom_instructions is None and custom_categories is None and multilingual is None and decay is None:
if (
custom_instructions is None
and custom_categories is None
and multilingual is None
and decay is None
and agent_custom_instructions is None
):
raise ValueError(
"At least one parameter must be provided for update: "
"custom_instructions, custom_categories, multilingual, decay"
"custom_instructions, custom_categories, multilingual, decay, "
"agent_custom_instructions"
)
payload = self._prepare_params(
@@ -430,6 +441,7 @@ class Project(BaseProject):
"custom_categories": custom_categories,
"multilingual": multilingual,
"decay": decay,
"agent_custom_instructions": agent_custom_instructions,
}
)
response = self._client.patch(
@@ -445,6 +457,7 @@ class Project(BaseProject):
"custom_categories": custom_categories,
"multilingual": multilingual,
"decay": decay,
"agent_custom_instructions": agent_custom_instructions,
"sync_type": "sync",
},
)
@@ -709,6 +722,7 @@ class AsyncProject(BaseProject):
custom_categories: Optional[List[str]] = None,
multilingual: Optional[bool] = None,
decay: Optional[bool] = None,
agent_custom_instructions: Optional[str] = None,
) -> Dict[str, Any]:
"""
Update project settings.
@@ -720,6 +734,7 @@ class AsyncProject(BaseProject):
decay: Toggle Memory Decay for this project. When True, search-time
ranking boosts recently-used memories and gently dampens stale ones; when
False, ranking is restored to the pre-decay behaviour. Off by default.
agent_custom_instructions: New extraction instructions for agent-scoped memories
Returns:
Dictionary containing the API response.
@@ -731,10 +746,17 @@ class AsyncProject(BaseProject):
NetworkError: If network connectivity issues occur.
ValueError: If org_id or project_id are not set.
"""
if custom_instructions is None and custom_categories is None and multilingual is None and decay is None:
if (
custom_instructions is None
and custom_categories is None
and multilingual is None
and decay is None
and agent_custom_instructions is None
):
raise ValueError(
"At least one parameter must be provided for update: "
"custom_instructions, custom_categories, multilingual, decay"
"custom_instructions, custom_categories, multilingual, decay, "
"agent_custom_instructions"
)
payload = self._prepare_params(
@@ -743,6 +765,7 @@ class AsyncProject(BaseProject):
"custom_categories": custom_categories,
"multilingual": multilingual,
"decay": decay,
"agent_custom_instructions": agent_custom_instructions,
}
)
response = await self._client.patch(
@@ -758,6 +781,7 @@ class AsyncProject(BaseProject):
"custom_categories": custom_categories,
"multilingual": multilingual,
"decay": decay,
"agent_custom_instructions": agent_custom_instructions,
"sync_type": "async",
},
)
+6
View File
@@ -28,6 +28,9 @@ class AddMemoryOptions(BaseModel):
default=None, description="Custom categories for memory classification"
)
custom_instructions: Optional[str] = Field(default=None, description="Custom instructions for fact extraction")
agent_custom_instructions: Optional[str] = Field(
default=None, description="Custom instructions for fact extraction from agent-scoped memories"
)
timestamp: Optional[int] = Field(default=None, description="Unix timestamp for the memory")
expiration_date: Optional[str] = Field(default=None, description="Expiration date in YYYY-MM-DD format")
structured_data_schema: Optional[Dict[str, Any]] = Field(
@@ -107,6 +110,9 @@ class ProjectUpdateOptions(BaseModel):
"""Options for project update operations."""
custom_instructions: Optional[str] = Field(default=None, description="Custom instructions for fact extraction")
agent_custom_instructions: Optional[str] = Field(
default=None, description="Custom instructions for fact extraction from agent-scoped memories"
)
custom_categories: Optional[List[Dict[str, Any]]] = Field(
default=None, description="Custom categories for classification"
)