Skip to content

[EPIC-D][LOU-D30] createAgent({ store }) wires sessions, checkpoints and approvals from one store - #94

Merged
LinuxDevil merged 2 commits into
mainfrom
lou-d30-one-store-option
Oct 1, 2026
Merged

LinuxDevil merged 2 commits into
mainfrom
lou-d30-one-store-option

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

What

  • New AgentStore interface ({ sessions?: SessionStore; checkpoints?: CheckpointStore; approvals?: ApprovalStore }, exported from the root). SqliteStore already satisfies it. New memoryStore() returns in-memory sessions, checkpoints and approvals (src/storage/agentStore.ts).
  • createAgent({ store }):
    • agent.session({ id }) takes its transcript store from store.sessions and its checkpoint store from store.checkpoints. A session's own store (a SessionStore, or { sessions, checkpoints }) and its checkpointStore still win, one part at a time (withDefaultStores() in src/session/AgentSession.ts).
    • store.approvals is the default approvalStore. An explicit approvalStore still wins.
    • SendOptions.sessionId: send() / stream() become durable runs checkpointed in store.checkpoints. Passing it without a checkpoint store throws a clear error. Without it, runs are not checkpointed. agent.approvals.resolve() keeps checkpointing a run that paused under a sessionId.
  • agent.resume(sessionId): if a run is checkpointed under that id, it resumes it through the executor path (input: []), or returns null if that run already finished. Otherwise it delegates to agent.session({ id }).resume(). It returns null when nothing is pending, and throws SessionAwaitingApprovalError while an approval is waiting.
  • Docs: the README SQLite example is shorter. docs/sessions.md ("Durable sessions", "Choosing a store", which now includes the file-based AgentStore combination FileSessionStore + LocalStorageCheckpointStore + StorageServiceApprovalStore), docs/durable-execution.md (a one-shot durable run with no AgentExecutor), approvals.md, configuration.md and api-overview.md are updated. llms-full.txt is regenerated. CHANGELOG has an Added entry.

Why

This completes differentiator 1 in the audit ("host-agnostic durable sessions in one option"). Before, a durable job needed AgentBuilder + ToolRegistry + AgentExecutor + manual transcript saves. Now one store option wires everything. The durable-job reference agent drops from about 60 to 25 non-blank lines (22 of them code).

Acceptance criteria

  • createAgent({ store }) with the exported AgentStore interface. SqliteStore satisfies it, memoryStore() is added, and the file-based combination is documented.
  • With store: sessions default their session and checkpoint stores from it, approvals default from it, and send() / stream() use store.checkpoints only when sessionId is passed (SendOptions.sessionId added). Explicit per-call options still win.
  • agent.resume(sessionId) resumes a pending durable run or session turn and returns null when nothing is pending.
  • Reference agent rewritten (25 non-blank lines; type-checked against src/ and the packed build). README, docs/sessions.md and docs/durable-execution.md use store (snippets type-checked). llms regenerated, CHANGELOG updated.
  • Tests (src/createAgentStore.test.ts) run with mockModel against both memoryStore() and SqliteStore(':memory:'). They cover session defaults, approval pause + resolve through store.approvals, crash + agent.resume() through store.checkpoints (session turn and one-shot sessionId run), and explicit-option precedence.

How verified

  • npx tsc --noEmit: no errors
  • npm run lint: 0 errors, 405 warnings (the same as main; the changed files have 0 warnings)
  • npm run test:types: Type Errors no errors
  • npx vitest run: Test Files 145 passed (145); Tests 2099 passed | 3 skipped (2102)
  • npm run build && npm run build --workspace=packages/create-loushy-agent: success
  • npm run docs:verify-snippets -- --skip-build: all 109 snippet(s) type-check against src/; 6 also run cleanly
  • npm run docs:llms:check: exit 0
  • npm run test:coverage && npm run fallow: coverage run passed (145 files); fallow "No issues found" and exit 0. The only duplication it reports already exists on main (Anthropic/OpenAI providers).

🤖 Generated with Claude Code

https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR


Generated by Claude Code

claude added 2 commits October 1, 2026 15:02
…and approvals from one store

- AgentStore { sessions?, checkpoints?, approvals? } (exported) and
  memoryStore(); SqliteStore already satisfies it.
- createAgent({ store }): agent.session({ id }) defaults its transcript and
  checkpoint stores from it (part by part; a session's own store /
  checkpointStore win), store.approvals is the default approvalStore.
- SendOptions.sessionId: send()/stream() become durable runs checkpointed
  in store.checkpoints; agent.approvals.resolve() keeps checkpointing them.
- agent.resume(id): finishes an interrupted durable run, else the session's
  pending turn; null when nothing is pending.
- Docs (README, sessions, durable-execution, approvals, configuration,
  api-overview), llms-full.txt, CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR
@LinuxDevil
LinuxDevil merged commit ca4b82a into main Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants