Skip to content

Feature Request: Native Multi-Agent Support #7517

@SamMaxknow

Description

@SamMaxknow

Feature Request: Native Multi-Agent Support
Summary
Add native multi-agent support to Hermes Agent, allowing a single gateway process to serve multiple named agents with isolated sessions, personas, memory, and tool configurations — similar to OpenClaw's multi-agent architecture.
Problem Statement
Currently, Hermes operates as a single-agent system:
Session keys are hardcoded with agent:main: prefix (gateway/session.py:477-484)
SOUL.md is loaded from a single global path (/.hermes/SOUL.md)
Memory is global (
/.hermes/memories/)
All conversations for a user share one agent identity and context
This creates two major problems:

  1. Context Pollution & Token Waste
    When a user discusses multiple unrelated topics (e.g., investment analysis, project management, daily chat) with the same agent, all conversations accumulate in a single session. This:
    Increases token consumption as unrelated context grows
    Degrades reasoning quality as the model processes irrelevant information
    Compression helps but is lossy and doesn't solve the fundamental mixing problem
  2. No Role Specialization
    Users cannot have specialized agents (e.g., a finance expert vs. a coding assistant) with distinct personas, knowledge bases, and behavioral rules.
    Proposed Design
    Core Change: Parameterized Agent Name in Session Keys
    The single most impactful change is replacing the hardcoded "main" in build_session_key():

Current (gateway/session.py ~line 477)

key = f"agent:main:{platform}:{chat_type}:{chat_id}"

Proposed

key = f"agent:{agent_name}:{platform}:{chat_type}:{chat_id}"

This naturally cascades through session isolation, agent caching, and transcript storage.
Agent Configuration Schema

config.yaml

agents:

default: main # which agent handles unmatched messages

main:

soul: agents/main/SOUL.md           # persona file

memory_dir: agents/main/memories/   # isolated memory

model: xiaomi/mimo-v2-pro           # per-agent model override

description: "General assistant"

finance:

soul: agents/finance/SOUL.md

memory_dir: agents/finance/memories/

model: deepseek/deepseek-chat

description: "Investment analysis specialist"

coach:

soul: agents/coach/SOUL.md

memory_dir: agents/coach/memories/

model: xiaomi/mimo-v2-pro

description: "Management coaching"

Message Routing
Multiple routing strategies (in priority order):
Platform binding — Different chat accounts/channels → different agents
agents:

finance:

bindings:

  - platform: feishu

    chat_id: "ou_xxxx"

  - platform: telegram

    chat_id: "-1001234"

Explicit command — User prefixes message with agent name
@Finance 分析一下宁德时代的估值
Keyword/intent detection — Optional, config-gated
routing:

mode: explicit # "binding" | "explicit" | "auto"

Default fallback — Unmatched messages go to agents.default
Resource Isolation Matrix
Agent-to-Agent Communication (Optional, Phase 2)
The main/default agent can dispatch to other agents:
delegate_task(

target_agent="finance",

goal="Analyze BYD stock valuation",

context="User wants investment advice for EV sector"

)

Backward Compatibility
If agents section is absent from config.yaml, behavior is identical to current single-agent mode
Existing agent:main: sessions continue to work
Profile system (hermes profile) remains for full process isolation use cases
Implementation Scope
Phase 1 (Core — Minimal Viable Multi-Agent)
Parameterize agent:main: → agent:{name}: in gateway/session.py
Add agents config schema in gateway/config.py
Per-agent SOUL.md loading in agent/prompt_builder.py
Per-agent memory directory in tools/memory_tool.py
Platform binding-based routing in gateway/run.py
Phase 2 (Enhanced)
Explicit @agent command routing
Per-agent model override
Agent-to-agent delegation
Per-agent tool permissions
hermes agents CLI subcommand for management
Phase 3 (Advanced)
Intent-based auto-routing
Shared memory pools (agents can opt-in to shared context)
Agent performance analytics (per-agent token tracking)
Precedent
OpenClaw (the predecessor system) implemented this architecture successfully with:
3 concurrent agents (Elon/main, Jobs/coach, Buffett/investment)
Per-agent Feishu bot accounts for routing
Symlinked shared rules (CORE_RULES.md, BEST_PRACTICES.md)
Per-agent SQLite memory databases
Per-agent session directories
Token Efficiency Analysis
Related Code Locations
gateway/session.py:445 — build_session_key(), hardcoded agent:main:
gateway/session.py:504 — SessionStore
gateway/run.py:463 — GatewayRunner, agent caching
agent/prompt_builder.py:838 — load_soul_md(), single global SOUL.md
tools/memory_tool.py — global memory scoping
hermes_cli/profiles.py — existing profile system (process-level, not concurrent)
tools/delegate_tool.py:196 — _build_child_agent(), ephemeral subagent pattern
Labels
enhancement, architecture, multi-agent

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt buildercomp/gatewayGateway runner, session dispatch, deliverytype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions