Skip to main content

upstash-hermes-memory

An Upstash Redis memory provider for Hermes Agent, built on the same Redis Search layout as @upstash/agentkit-sdk's AgentMemory and ChatHistory. A memory your AI SDK app saves is recalled by your Hermes agent, and the other way round.

What it does in Hermes

  • Recall: before each turn, the memories closest to the user's message are added to the prompt.
  • Chat history: after each turn, the session's transcript is saved as a searchable document.
  • Mirroring: facts the built-in memory tool adds are also saved to Redis.
  • Tools: upstash_memory_save, upstash_memory_search, upstash_memory_forget and upstash_chat_search (search past conversations).

Subagents, cron jobs and context flushes can read memory but never write it.

Setup

# into the Python environment Hermes runs in
pip install upstash-hermes-memory

Then select it in Hermes's config.yaml:

memory:
  provider: upstash

And give it a database, in your environment or ~/.hermes/.env (hermes memory setup asks for these):

Variable
UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN Required. From the Upstash console.
UPSTASH_HERMES_USER_ID Whose memories these are. Defaults to the gateway user, then the Hermes profile name, then default.
UPSTASH_HERMES_MEMORY_PREFIX, UPSTASH_HERMES_CHAT_PREFIX Key prefixes. Default agentkit:memory and agentkit:chat, the TS SDK's defaults, so the two share memories.

Redis layout

Key Index
Memory agentkit:memory:<user>:<id> → JSON {text, userId, createdAt, ...metadata} agentkit_memory (text, userId)
Chat agentkit:chat:<user>:<session> → JSON {userId, sessionId, userMessages, modelMessages, messages, createdAt, updatedAt} agentkit_chat

User and session ids are used as they are, so the same id reads the same keys from Hermes and the TS SDK. Like the TS SDK, the provider refuses a user id with : (the key separator), and keeps no transcript for a session id with one. Indexes are created on first use. AgentMemory and ChatHistory are importable on their own for use outside Hermes.

Development

uv sync --all-packages && pnpm py:lint && pnpm py:test   # Redis tests need UPSTASH_REDIS_REST_* set
uv run python python/hermes-memory/e2e/hermes_e2e.py     # a real Hermes session, needs OPENAI_API_KEY

The e2e script installs the package into a temporary directory and runs Hermes with a temporary HERMES_HOME, so your own Hermes install is not touched. Hermes's built-in memory is turned off there. One session saves two facts; a fresh session started right after must name them without calling any tool (checked in Hermes's state.db), so they can only come from the automatic recall; and a control session as another user must not know them. The script then checks the keys and transcripts in Redis (and, if packages/sdk is built, that the TS AgentMemory recalls them too) before cleaning up.

Metadata

Release files for upstash-hermes-memory 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for upstash-hermes-memory 0.1.0
File Size Uploaded Provenance Actions
upstash_hermes_memory-0.1.0.tar.gz 24.1 kB Without provenance Details for upstash_hermes_memory-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for upstash-hermes-memory 0.1.0
File Interpreter ABI Platform Actions
upstash_hermes_memory-0.1.0-py3-none-any.whl Python 3 none any Details for upstash_hermes_memory-0.1.0-py3-none-any.whl

Total release size: 40.3 kB

Release files / upstash_hermes_memory-0.1.0.tar.gz

Download URL upstash_hermes_memory-0.1.0.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0f861ee510acb17b03939ad9a25cf5e3870083955cc33ccb3ad43af6fdc0d036
BLAKE2b-256 checksum
How to use checksums
8083e1f6621ba24b1cfb60396986ed7e2820bd0c7c25bec64eb867ff381cd48d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / upstash_hermes_memory-0.1.0-py3-none-any.whl

Download URL upstash_hermes_memory-0.1.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a08ab8a4fd9a2e66b10409b31f39d4a40a017fca34aa0116fdaf29b4628d8419
BLAKE2b-256 checksum
How to use checksums
851d759b034fc38af9738c9d66bfd1fc75b2452f9b62b181eab8cf6171c549e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for upstash-hermes-memory 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page