Hindsight:会学习的 Agent 记忆系统
面向 AI Agent 的长期记忆系统,让智能体不只是记住对话,而是持续学习。
- 浏览
- 8
- 访问
- 0
- 下载
- 0
- Stars
- 63,689
- 版本
- v1.3.0
- 平台
- Windows、macOS、Linux
详细介绍
项目简介
Hindsight 是一个 Agent 记忆系统,目标是让智能体随着时间推移不断学习,而不只是回放对话历史。它针对 RAG、知识图谱等方案的不足进行改进,并在长期记忆任务上取得领先表现。
项目在 LongMemEval 基准上达到 state-of-the-art,相关结果由 Virginia Tech Sanghani Center for Artificial Intelligence and Data Analytics 与 The Washington Post 的研究人员独立复现。Hindsight 已被财富 500 强企业和多家 AI 初创公司用于生产环境。

主要功能
- 三种核心操作:
retain存储信息、recall搜索记忆、reflect生成结合情境的回复。 - 记忆类型与观察:支持多种记忆类型、observations、mental models & pages、decision models 以及 memory banks。
- LLM Wrapper:通过
wrap_openai()/wrap_anthropic()包装现有 LLM 客户端,自动在调用前召回记忆、调用后保存对话,底层基于 LiteLLM,可覆盖 100+ 模型。 - 多语言客户端:提供 Python、Node.js / TypeScript、Go SDK 以及 CLI 和 REST API。
- 60+ 集成:多数集成无需改动代码。
- 多 LLM 提供商:支持 25+ 提供商,包括 OpenAI、Anthropic、Gemini、Groq、Bedrock、Vertex AI、DeepSeek、Ollama、LM Studio、llama.cpp 以及任意 OpenAI 兼容端点。
- 多种部署方式:Docker、pip 裸机安装、Kubernetes Helm、Python 嵌入式(无需独立服务器)以及托管的 Hindsight Cloud。
安装与使用
启动服务
Docker 方式(推荐):
export OPENAI_API_KEY=sk-xxx
docker run -it --pull always --name hindsight --restart unless-stopped -p 8888:8888 -p 9999:9999 \
-e HINDSIGHT_API_LLM_API_KEY=$OPENAI_API_KEY \
-v hindsight-data:/home/hindsight/.pg0 \
ghcr.io/vectorize-io/hindsight:latest
API 位于 http://localhost:8888,UI 位于 http://localhost:9999。
pip 裸机方式:
pip install hindsight-api
export HINDSIGHT_API_LLM_API_KEY=sk-xxx
hindsight-api
连接客户端
pip install hindsight-client -U # Python
npm install @vectorize-io/hindsight-client # Node.js / TypeScript
go get github.com/vectorize-io/hindsight/hindsight-clients/go # Go
curl -fsSL https://hindsight.vectorize.io/get-cli | bash # CLI
Python 示例:
from hindsight_client import Hindsight
client = Hindsight(base_url="http://localhost:8888")
client.retain(bank_id="my-bank", content="Alice works at Google as a software engineer")
client.recall(bank_id="my-bank", query="What does Alice do?")
client.reflect(bank_id="my-bank", query="Tell me about Alice")
给现有 Agent 加记忆
pip install hindsight-litellm
from openai import OpenAI
from hindsight_litellm import wrap_openai
client = wrap_openai(
OpenAI(),
bank_id="user-123",
hindsight_api_url="http://localhost:8888",
)
Python 嵌入式
pip install hindsight-all -U
import os
from hindsight import HindsightServer, HindsightClient
with HindsightServer(
llm_provider="openai",
llm_model="gpt-5-mini",
llm_api_key=os.environ["OPENAI_API_KEY"]
) as server:
client = HindsightClient(base_url=server.url)
client.retain(bank_id="my-bank", content="Alice works at Google")
results = client.recall(bank_id="my-bank", query="Where does Alice work?")
注意事项
- 支持 Linux(x86_64、ARM64)、macOS(Apple Silicon 与 Intel)、Windows(x86_64);Intel Mac 裸机安装需使用
hindsight-all-slim。 - 使用 Docker 外接 PostgreSQL 时,可进入
docker/docker-compose执行docker compose up。 - Kubernetes 可通过 Helm 安装:
helm install hindsight oci://ghcr.io/vectorize-io/charts/hindsight \
--set api.llm.provider=openai \
--set api.llm.apiKey=sk-xxx \
--set postgresql.enabled=true
- 企业部署还支持 Oracle AI Database。
- 不想自建服务时,可使用 Hindsight Cloud,将客户端指向
https://api.hindsight.vectorize.io并配置 API Key。 - 完整文档、集成列表、Cookbook 与基准测试见项目官网与仓库链接。
本作品整理自 GitHub 开源项目 vectorize-io/hindsight,原作者 @vectorize-io,许可证 MIT。中文介绍由 AI 根据项目 README 整理,以原仓库为准。
更新记录
- v1.3.0当前版本
## What's Changed * docs: changelog for v1.2.3 by @nicoloboschi in https://github.com/vectorize-io/hindsight/pull/6714 * fix(release): slim image no longer overwrites :latest by @nicoloboschi in https://github.com/vectorize-io/hindsight/pull/6728 * feat(mcp): per-bank MCP server instructions in the initialize response by @cdbartholomew in https://github.com/vectorize-io/hindsight/pull/6712 * docs: replace retired Claude Code plugin text and dead integration link in blog and guides by @chrislatimer in https://github.com/vectorize-io/hindsight/pull/6716 * fix(knowledge): bound the work of cutting a video, and drop files that fail for good by @cdbartholomew in https://github.com/vectorize-io/hindsight/pull/6711 * Point 2 OpenCode blog posts to the Hindsight Coding Agents plugin (retired OpenCode install lines) by @chrislatimer in https://github.com/vectorize-io/hindsight/pull/6718 * fix(knowledge): a table is never one oversized passage, and staged passages move inside the command timeout
- v1.2.3
修复知识库摄入异常、损坏及大文件时失败、重试或内存耗尽的问题;更新 README 中的演示视频;为 hermes 增加 reflect_budget,并让 cron 运行跳过自动 recall;修复控制面重复 gzip 的问题。
- v1.2.1
修复管理端帮助信息、API 标识与分页限制、编码代理调查、Hermes 会话记忆重复写入与客户端兼容等问题,并更新文档与变更日志。
评论