curl -X POST "http://localhost:8000/api/v2/agents/my-agent/policy/preset" \
-H "X-Session-Token: your_session_token" \
-H "Content-Type: application/json" \
-d '{"name": "balanced"}'
{
"agent_id": "my-agent",
"preset": "balanced",
"policy": {
"version": 1,
"retention": { "context": "7d", "event": "30d", "error": "30d" },
"rules": [
{ "name": "pinned", "match": { "tags": ["pinned"] }, "expire_after": "never" }
],
"purge_expired_after": "never"
}
}
{
"detail": "Unknown preset 'nope'. Must be one of: aggressive, balanced, conservative."
}
{
"detail": "Missing session token. Use X-Session-Token header."
}
Expiry Policy
Apply Policy Preset
Adopt a predefined policy bundle as the agent’s policy.
POST
/
api
/
v2
/
agents
/
{agent_id}
/
policy
/
preset
curl -X POST "http://localhost:8000/api/v2/agents/my-agent/policy/preset" \
-H "X-Session-Token: your_session_token" \
-H "Content-Type: application/json" \
-d '{"name": "balanced"}'
{
"agent_id": "my-agent",
"preset": "balanced",
"policy": {
"version": 1,
"retention": { "context": "7d", "event": "30d", "error": "30d" },
"rules": [
{ "name": "pinned", "match": { "tags": ["pinned"] }, "expire_after": "never" }
],
"purge_expired_after": "never"
}
}
{
"detail": "Unknown preset 'nope'. Must be one of: aggressive, balanced, conservative."
}
{
"detail": "Missing session token. Use X-Session-Token header."
}
Overview
Adopts a shipped preset as the agent’s expiry policy, replacing whatever was there. Nothing expires until a sweep runs.This replaces the entire policy, including any rules written by hand. Preview
the preset first with
Get Policy Preset.
Authentication
API clients do not send an API key orAuthorization header.
Session token from Activate Agent. Must match
agent_id.Path Parameters
Body
curl -X POST "http://localhost:8000/api/v2/agents/my-agent/policy/preset" \
-H "X-Session-Token: your_session_token" \
-H "Content-Type: application/json" \
-d '{"name": "balanced"}'
{
"agent_id": "my-agent",
"preset": "balanced",
"policy": {
"version": 1,
"retention": { "context": "7d", "event": "30d", "error": "30d" },
"rules": [
{ "name": "pinned", "match": { "tags": ["pinned"] }, "expire_after": "never" }
],
"purge_expired_after": "never"
}
}
{
"detail": "Unknown preset 'nope'. Must be one of: aggressive, balanced, conservative."
}
{
"detail": "Missing session token. Use X-Session-Token header."
}
Next Steps
- Apply Expiry Policy to run the sweep
- Get Expiry Policy to read it back