Skip to content

Commit 2d7df08

Browse files
authored
feat(examples): S3, Redis, Postgres SessionStore reference adapters (#842)
Stacked on #837. (Replaces #841, which was merged into #837's branch by mistake — this re-splits it.) Three copy-in reference `SessionStore` adapters under `examples/session_stores/`: - **S3** (`s3_session_store.py`) — JSONL part files per append; mirrors `@anthropic-ai/claude-agent-sdk-s3` (TS) - **Redis** (`redis_session_store.py`) — RPUSH/LRANGE lists + zset session index; mirrors the TS Redis reference - **Postgres** (`postgres_session_store.py`) — `asyncpg` + jsonb rows with bigserial seq; new (no TS equivalent) Not shipped in the wheel — these live in `examples/`, users copy the file they need into their project. The sdist does include `examples/` so the references travel with source releases. Backend deps are in the optional `[examples]` group only. **Tests** — 678 passed, 3 skipped (env-gated live suites) - All test modules `importorskip` on their backend client so default CI is unaffected. - S3 unit tests use `moto` in-process; Redis uses `fakeredis`; both pass the full conformance suite. - Live e2e modules for all three are env-gated (`SESSION_STORE_S3_*`, `SESSION_STORE_REDIS_URL`, `SESSION_STORE_POSTGRES_URL`) and skip otherwise. - Verified locally against moto, fakeredis, and dockerized `postgres:16-alpine`. Zero secrets / internal refs in the diff (scanned). **Review follow-ups** (9 commits total) - Docs: Production checklist, Retention → `delete_session_via_store`, scrubbed internal TS path refs, S3 ref now points at the public TS example path, README notes Redis key separator + Postgres schema divergence. - Build: sdist manifest now includes `examples/`. - Tests: Redis + Postgres conformance tests swapped `isinstance(store, SessionStore)` → `_store_implements()` after #837 dropped `@runtime_checkable` from the base Protocol.
1 parent 6e3d54f commit 2d7df08

12 files changed

Lines changed: 2854 additions & 0 deletions

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ env/
2828
.venv
2929
uv.lock
3030

31+
# Local env files (live-backend test credentials etc.)
32+
.env
33+
.env.*
34+
3135
# IDEs
3236
.vscode/
3337
.idea/

0 commit comments

Comments
 (0)