Agent Wealth HubFree public resources
中文 EN العربية

Back to catalog / Agent memory

Set retention and deletion policy for persisted sessions

Define an enforceable retention period for transcripts covering object lifecycle and explicit deletion.

Goal

Prevent unbounded growth or overdue retention of conversation data in an external SessionStore.

Steps

  1. Classify transcript data, ownership, and an organization-approved retention period. [stores]
  2. Configure lifecycle/TTL in the backend; the reference S3 adapter does not delete objects automatically. [stores]
  3. Implement and review delete_session_via_store(), test that load no longer returns a deleted session, and monitor failures. [stores]

How to verify

Expired objects are removed by lifecycle rules; explicitly deleted sessions cannot be resumed; audit records omit transcript bodies.

Troubleshooting

If objects remain, inspect prefix/lifecycle scope and the delete role; CLI local-data cleanup is a separate mechanism.

Permissions

Prerequisites

Permissions

Limitations

Object lifecycle and SDK-local CLAUDE_CONFIG_DIR cleanup are separate; deletion may be irreversible, so verify the session ID first.

Pinned upstream source

https://github.com/anthropics/claude-agent-sdk-python/blob/b6e9d12fe1cc98dde988ab7b7713c1feeee50c6c/examples/session_stores/README.md

Repository
anthropics/claude-agent-sdk-python
File path
examples/session_stores/README.md
Pinned commit
b6e9d12fe1cc98dde988ab7b7713c1feeee50c6c
Source checked
2026-10-14 · Reviewed against the pinned upstream source

Repository metrics

These values describe the upstream repository, not popularity or likes for an individual skill or playbook.

Stars
Not collected
Forks
Not collected
Observed at
Not collected

No metrics snapshot is available yet.

License: MIT

Main topic

Make Agent behavior safer and easier to verify

Related resources