Guardrails
Control which memories an agent can access for a task.
guardRails control which memories an agent can access. Your server sets them when creating a createAgentTask session. The React SDK only receives a clientToken and cannot expand the rails.
How guardRails apply per task type:
| Task type | guardRails |
|---|---|
EXPLORE_MEMORIES | Required. Both METADATA and SEMANTIC memory types are supported. |
MEMORY_CHAT | Required. Only SEMANTIC memory types are supported. |
MEMORY_SEARCH | Required. Only SEMANTIC memory types are supported. |
EXPLORE_PRODUCT | Optional. Set them when the agent should perform semantic search on memories. The memory types used must be of type SEMANTIC. |
STREAMING_CHAT_COMPLETION | Not supported |
STRUCTURED_CHAT_COMPLETION | Not supported |
How they work
Set guardRails.memoryTypes to a list of memory types the agent may see. Each entry uses exactly one scope. Combining scopes on the same entry is rejected by the API.
| Scope | What the agent can access |
|---|---|
match | Memories of that type whose metadata matches the filter |
memoryIds | Only the listed memories of that type |
includeAll | Every memory of that type |
You can list several memory types in one session. Each entry has its own scope.
Metadata overrides
Each memory type entry can include a metadata array that overrides the stored meta-key schema for that session only:
visible: whether the agent can see that key.description: the description the agent gets for that key, overriding the stored one.
Each entry needs a key plus at least one of visible or description.
Examples
match
{
createAgentTask: {
taskType: 'EXPLORE_MEMORIES',
guardRails: {
memoryTypes: [
{
memoryTypeId: 'mty_...',
match: { organization_id: 'org_...' },
metadata: [
{
key: 'renewal_date',
visible: true,
description: 'ISO-8601 date the contract auto-renews',
},
{
key: 'internal_notes',
visible: false,
},
],
},
],
},
},
}memoryIds
{
createAgentTask: {
taskType: 'MEMORY_CHAT',
guardRails: {
memoryTypes: [
{
memoryTypeId: 'mty_...',
memoryIds: ['mem_...', 'mem_...'],
metadata: [
{
key: 'renewal_date',
visible: true,
description: 'ISO-8601 date the contract auto-renews',
},
],
},
],
},
},
}includeAll
{
createAgentTask: {
taskType: 'MEMORY_SEARCH',
guardRails: {
memoryTypes: [
{
memoryTypeId: 'mty_...',
includeAll: true,
},
],
},
},
}See Sessions for full request bodies per task type, and Explore memories for a complete server route.