数据库
需要为 AI Agent 在 Redis Cloud…
在 Redis Cloud 的 Iris Redis Agent Memory (RAM) 数据面上记录会话事件、创建或搜索长期记忆、配置记忆存储并调优后台记忆提升。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
需要为 AI Agent 在 Redis特定
解决思路
- 在 Redis Cloud 创建 Memory service:访问 https://cloud.redis.io/#/agent-memory 创建服务。
- 使用 store API key 认证 SDK:配置 bearer token 到 `AGENT_MEMORY_API_KEY`。
- 配置默认 store ID:设置 `AGENT_MEMORY_STORE_ID`。
- 使用生产 data-plane URL `https://gcp-us-east4.memory.redis.io`;实际 URL 以 Cloud console 中 provision 后显示的为准。
- Python 端使用官方 SDK:`pip install redis-agent-memory`,使用 `AgentMemory` 类。
- TypeScript 端使用官方 SDK:`npm add @redis-iris/agent-memory`,使用 `AgentMemory` 类。
- 理解两层记忆:Session memory 是每个 session 的 append-only conversation history(working memory);Long-term memory 是可语义搜索的记录,可从 sessions 提取或直接创建。
- 在 session events 与 direct long-term memory 之间做选择:记录会话/工作记忆时用 session events;需要可语义搜索的持久事实时写 long-term memory。
- 追加 session event:调用 `AgentMemory.add_session_event(...)`(Python)或 `addSessionEvent(...)`(TypeScript)。
- 检索 session memory 和 individual events。
- 批量创建 long-term memories,并使用 idempotent IDs。
- 语义搜索 long-term memory,并带 filters:调用 `search_long_term_memory(...)`(Python)或 `searchLongTermMemory(...)`(TypeScript)。
- 用 `namespace`、`ownerId`、`topics`、`memoryType` 组织 long-term memory 记录。
- 利用后台 promotion:Redis Cloud 管理的 promotion worker 会从 session events 提取 durable facts 并写入 long-term memory。
- 按优先级实施:1 `setup-` Setup & Cloud Service (HIGH),2 `session-` Session Memory / Events (HIGH),3 `ltm-` Long-Term Memory (HIGH),4 `promotion-` Memory Promotion (MEDIUM)。
- 查阅 `references/` 下对应规则文件获取详细说明和 Python/TypeScript 示例:`references/setup-cloud-service.md`、`references/setup-auth-token.md`、`references/session-when-to-use.md`、`references/session-add-event.md`、`references/session-retrieval.md`、`references/ltm-bulk-create.md`、`references/ltm-search.md`、`references/ltm-organize.md`、`references/promotion-overview.md`。
- 每个 rule file 包含:为什么重要简述、正确示例(Python 和 TypeScript SDK 代码)、一个 “Incorrect” 示例或 “When to use / When NOT needed” 指引、额外上下文和引用。
适用边界 · 注意事项
- 不适用于未使用 Redis Cloud 或 Iris Redis Agent Memory (RAM) 的项目。
- 不需要跨会话持久记忆、长期记忆语义搜索或后台记忆提升时,不必引入。
- 无法配置 `AGENT_MEMORY_API_KEY` / `AGENT_MEMORY_STORE_ID`,或不能使用官方 Python/TypeScript SDK 的环境不适用。