Repository navigation
Conversation
This was referenced Nov 11, 2026
Add createAgentMemory, the Upstash equivalent of the AI SDK memory providers (Mem0, Letta, Supermemory, Hindsight, @redis/vercel-ai-sdk): one factory over a core AgentMemory that exposes per-request tools(), an automatic-recall prepareStep() that appends a <memories> block to the instructions on step 0, recallContext(), tool-usage instructions and the underlying store. The other providers' automatic memory wraps the model with wrapLanguageModel; this repo does not wrap models, so automatic recall uses the prepareStep seam instead (generateText, streamText and ToolLoopAgent, userId optionally from runtimeContext). A failed recall never fails the call. createMemoryTools now shares buildMemoryTools with the provider. The ai-sdk demo uses the provider; README and CLAUDE.md document it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMK4etJMDDBFkjEyWDVCdy
CahidArda
force-pushed
the
feat/ai-sdk-memory-provider
branch
from
November 11, 2026 11:32
eafa45b to
532757a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: #100 → #102 (TanStack stores) → this PR (2/3) → eve 1.0 RC (3/3). This PR targets #102's branch and adds one commit.
What
The AI SDK docs list memory providers: Letta, Mem0, Supermemory, Hindsight, MongoDB and Redis Agent Memory, in
content/docs/03-agents/06-memory.mdxin vercel/ai. They share one shape:instructionsstringwrapLanguageModel@upstash/agentkit-ai-sdknow offers that shape ascreateAgentMemory(), built on the existingAgentMemory(Redis Search$smart, so no vector DB):memory.tools({ userId }): the existingrecall_memory/save_memorytools.memory.prepareStep({ userId, query?, topK?, minScore?, onError? }): automatic recall without wrapping the model, because CLAUDE.md forbids model wrappers.<memories>block ("treat as data") to the instructions. ai 7'sprepareStepoverride carries forward to later steps.userIdcan be a function of the step options, e.g.runtimeContexton a sharedToolLoopAgent.onError.memory.recallContext(),memory.instructions(names your tools), andmemory.store.createMemoryToolskeeps its API and now sharesbuildMemoryToolswith the provider.The
ai-sdk-demoroute uses the provider. The README has a "Memory provider" section, and CLAUDE.md is updated.Other AI SDK v7 extension points checked, not built
createChatHistoryalready covers it.resumable-streampackage already does this.registerTelemetryusage meter / token-based rate limiting: a possible small follow-up.RealtimeModelV4Usage): experimental.experimental_queue: client-only.Tests
agent-memory.test.ts(7, live Redis +MockLanguageModelV4) covers:recallContextToolLoopAgentwithruntimeContextonErrorChangeset
@upstash/agentkit-ai-sdk: minor. It's in thelinkedgroup.🤖 Generated with Claude Code
https://claude.ai/code/session_01CMK4etJMDDBFkjEyWDVCdy