Skip to content

feat: One gateway for multiple agent profiles.#24914

Open
unliftedq wants to merge 1 commit into
NousResearch:mainfrom
unliftedq:one-gateway-for-multi-agent
Open

feat: One gateway for multiple agent profiles.#24914
unliftedq wants to merge 1 commit into
NousResearch:mainfrom
unliftedq:one-gateway-for-multi-agent

Conversation

@unliftedq

Copy link
Copy Markdown

What does this PR do?

Lets a single gateway process serve multiple Hermes profiles as switchable agents — instead of needing one gateway per profile bound to a separate platform credential.

User-facing surface

Input Effect
/profile Show the chat's active profile + host info
/profile ls List all available profiles
/profile coder Bind this chat to the coder profile (persisted)
/profile default Reset to default
@coder fix bug Route only this turn to coder; binding intact
(every reply) Prefixed with [<agent>], toggleable via gateway.show_agent_name

Isolation guarantees

  • Memory / skills / SOUL.md: hard-isolated per profile (existing ~/.hermes/profiles/<name>/ layout)
  • Session / transcript: each (chat, agent) pair has its own session_id — switching back to a previously-used agent resumes its own conversation, no leakage from other agents
  • Gateway runtime state (sessions DB, host platform tokens): stays in the host profile

Mechanism

  • HERMES_HOME becomes a ContextVar; get_hermes_home() consults it first → per-turn agent swap with no env-var rebind
  • _run_agent wraps the executor in agent_home_scope(<agent.home>) so AIAgent construction + run-conversation see the right paths
  • build_session_key takes agent_name(chat, agent) pairs get distinct session_keys → distinct transcripts; chat bindings persist to sessions/chat_bindings.json
  • default agent keeps the legacy agent:main:... prefix → zero migration for existing state.db / sessions.json

Details see #24913

Related Issue

Fixes #24913

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

How to Test

  1. Added comprehensive unit tests
  2. Test locally.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform:

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: one gateway serves multiple agents — switch via /profile <name> or @<name>

2 participants