curl -X PUT "https://api.memanto.ai/agents/my-agent/policy" \
-H "x-api-key: $MEMANTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"retention": {
"context": "30d",
"event": "90d"
},
"rules": [
{
"name": "pin-instructions",
"match": {
"type": [
"instruction"
]
},
"expire_after": "never"
}
],
"purge_expired_after": "never"
}'
{
"agent_id": "my-agent",
"policy": {
"version": 1,
"retention": {
"context": "30d",
"event": "90d"
},
"rules": [
{
"name": "pin-instructions",
"match": {
"type": [
"instruction"
]
},
"expire_after": "never"
}
],
"purge_expired_after": "never"
}
}
Expiry Policy
Set Policy
Replace the agent’s expiry policy.
PUT
/
agents
/
{agent_id}
/
policy
curl -X PUT "https://api.memanto.ai/agents/my-agent/policy" \
-H "x-api-key: $MEMANTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"retention": {
"context": "30d",
"event": "90d"
},
"rules": [
{
"name": "pin-instructions",
"match": {
"type": [
"instruction"
]
},
"expire_after": "never"
}
],
"purge_expired_after": "never"
}'
{
"agent_id": "my-agent",
"policy": {
"version": 1,
"retention": {
"context": "30d",
"event": "90d"
},
"rules": [
{
"name": "pin-instructions",
"match": {
"type": [
"instruction"
]
},
"expire_after": "never"
}
],
"purge_expired_after": "never"
}
}
Overview
Replaces the agent’s expiry policy. Saving a policy doesn’t expire anything; Apply Policy does. The policy format (retention, rules, purge_expired_after) is the same as on Memanto local; see Set Policy and Memory lifecycle.
Authentication
Your Memanto Cloud API key (
mk_...). See Authentication.Path Parameters
Body
How long each memory type stays active, such as
"30d", "6mo", "1y" or "never". Types: fact, preference, goal, decision, artifact, learning, event, instruction, relationship, context, observation, commitment, error.Checked in order; the first match wins over
retention. Each has a name, a match (type, tags, provenance, source, confidence_below) and an expire_after.curl -X PUT "https://api.memanto.ai/agents/my-agent/policy" \
-H "x-api-key: $MEMANTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"retention": {
"context": "30d",
"event": "90d"
},
"rules": [
{
"name": "pin-instructions",
"match": {
"type": [
"instruction"
]
},
"expire_after": "never"
}
],
"purge_expired_after": "never"
}'
{
"agent_id": "my-agent",
"policy": {
"version": 1,
"retention": {
"context": "30d",
"event": "90d"
},
"rules": [
{
"name": "pin-instructions",
"match": {
"type": [
"instruction"
]
},
"expire_after": "never"
}
],
"purge_expired_after": "never"
}
}