anamulhaque1268
V2EX  ›  问与答

Hermes Agent 多用户 / Multi-tenant 应该怎么设计?一个实例服务多个用户可行吗?

  •  
  •   anamulhaque1268 · 20h 18m ago · 597 views
    最近在研究 Hermes Agent ,准备把它作为一个多用户应用的 Agent runtime ,想请教一下熟悉 Hermes / MCP / Agent 架构的朋友。

    我的需求比较简单:

    多个用户使用同一套 AI 能力,例如:

    相同的 system prompt
    相同的模型
    公共 Skills
    公共 MCP
    Web Search
    公共知识库

    但是每个用户必须拥有独立的:

    conversation/session
    long-term memory
    user profile/preferences
    reminders / cron jobs
    private data
    MCP credentials / permissions

    例如:

    Hermes

    ┌───────┼───────┐
    ▼ ▼ ▼
    User A User B User C

    我目前主要纠结两个方案。

    方案一:多个用户共享一个 Hermes instance

    通过:

    user_id
    session_key

    来区分用户。

    例如:

    user:10001
    user:10002
    user:10003

    Hermes 本身负责:

    reasoning
    skills
    MCP
    tool calling

    用户相关的数据则由应用层隔离。

    这种方式看起来最合理,也方便以后横向扩展。

    但我比较担心 Hermes 内部的一些状态,例如:

    USER.md
    memory
    session
    cron
    MCP context

    是否完全适合 multi-tenant 环境。

    例如 User A 告诉 Agent:

    我叫张三,我住上海。

    有没有可能由于 memory / context 设计问题,后面 User B 的 context 中出现 User A 的信息?

    方案二:每个用户一个 Hermes Profile
    User A → Hermes Profile A
    User B → Hermes Profile B
    User C → Hermes Profile C

    隔离肯定更简单。

    但是如果未来有:

    10,000 users
    100,000 users

    显然不太希望维护 10 万个 Hermes profiles 。

    而且实际上大部分用户使用的是完全相同的 Agent ,只是 personal memory / credentials 不一样。

    我目前比较倾向的结构

    把 Hermes 当成一个 stateless / semi-stateless Agent runtime 。

    例如:

    Hermes Worker Pool
    / | \
    Hermes 1 Hermes 2 Hermes 3
    \ | /
    Backend

    ┌─────────────┼─────────────┐
    ▼ ▼ ▼
    User DB Memory DB Job/Cron DB

    每次请求:

    request

    identify user_id

    load user context/memory

    Hermes executes

    save updated state

    也就是说:

    Hermes = Agent execution/runtime

    Application = identity + isolation + persistence

    而不是:

    1 user = 1 Hermes

    另外还有一个我比较关心的问题:private MCP 。

    公共 MCP 比较简单:

    Search MCP
    Knowledge MCP
    Weather MCP

    大家共享即可。

    但是如果不同用户连接自己的服务:

    User A → Obsidian
    User B → Google Calendar
    User C → Notion

    这种情况下大家一般怎么处理?

    例如:

    根据 user_id 动态加载对应 credentials ?
    MCP Server 自己做 multi-tenant ?
    每个用户启动一个 MCP Server ?
    在 Hermes 外面增加一层 MCP gateway ?
    Hermes 有没有推荐的设计方式?

    想请教一下:

    Hermes 一个 instance 服务多个用户是否可靠?
    Hermes 的 memory/session 是否真正支持 user-level isolation ?
    USER.md 这种全局状态在 multi-user 环境应该怎么处理?
    长期 memory 最好放 Hermes ,还是放外部 DB ?
    user-specific MCP credentials 大家会怎么隔离?
    大规模部署时,是不是应该采用 Hermes worker pool ,而不是一个用户一个 profile ?
    有没有人已经用 Hermes 做过类似的 multi-tenant 架构?

    目前还在做 POC ,主要想先把架构方向确定下来,避免后面因为 memory / permissions / MCP isolation 重新设计。

    如果有踩坑经验,非常欢迎分享。
    2 replies    2026-08-19 13:29:36 +08:00
    chpw98hv
        1
    chpw98hv  
       10h 8m ago   ❤️ 1
    Hermes Agent 的 profile 不能做到隔离,用户能访问到其他用户的文件。Github 上 invergent-ai/surogates 之类的项目比较适合多用户隔离的需求
    anamulhaque1268
        2
    anamulhaque1268  
    OP
       5h 13m ago
    @chpw98hv 谢谢推荐,我刚看了一下 Surogates ,确实更贴合多用户隔离的需求,尤其是 user-level memory 、workspace 和 MCP credentials 这块。我先研究一下它的架构,Hermes 可能先保留做单用户 POC 。这个方向很有帮助,感谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3363 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 10:42 · PVG 18:42 · LAX 03:42 · JFK 06:42
    ♥ Do have faith in what you're doing.