hermes-agent/tools
teknium1 b159002078 feat: multi-agent architecture — named agents with routing, tool policies, and isolated workspaces
Implements the full multi-agent system for Hermes Agent, allowing a single
installation to host multiple named agents, each with its own model,
personality, toolset, workspace, and session history.

## New Files

- gateway/agent_registry.py: AgentConfig, ToolPolicy, SubagentPolicy,
  AgentRegistry, TOOL_PROFILES (minimal/coding/messaging/full), and
  normalize_tool_config() for shorthand YAML parsing

- gateway/router.py: BindingRouter with 7-tier deterministic routing
  (chat_id > peer > guild+type > guild > platform+type > platform > default)

## Core Changes

- model_tools.py: get_tool_definitions() accepts agent_tool_policy for
  per-agent tool filtering; handle_function_call() extended enabled_tools
  check to gate ALL tool calls (defense-in-depth)

- gateway/session.py: build_session_key() now accepts agent_id and dm_scope
  parameters, replacing hardcoded 'agent:main' with 'agent:{agent_id}'

- tools/memory_tool.py: MemoryStore accepts memory_dir parameter for
  per-agent memory isolation

- agent/prompt_builder.py: build_context_files_prompt() accepts
  agent_workspace for SOUL.md lookup; build_skills_system_prompt()
  accepts agent_skills_dir for per-agent skill overlay

- run_agent.py: AIAgent accepts agent_tool_policy and agent_workspace,
  passes policy through to get_tool_definitions()

- gateway/run.py: Initializes AgentRegistry + BindingRouter, resolves
  agent per-message in _handle_message(), passes config to _run_agent(),
  adds /agents command

- cli.py: --agent flag for selecting named agent profiles, /agents
  slash command, agent config override for model/personality/tools

- hermes_cli/config.py: agents/bindings in DEFAULT_CONFIG, version 7

- tools/delegate_tool.py: Configurable max_depth per-agent, tool policy
  inheritance from parent to child

## Config Format

agents:
  main:
    default: true
  coder:
    model: anthropic/claude-sonnet-4
    personality: 'You are a coding assistant.'
    tools: coding  # or [tool1, tool2] or {profile: x, deny: [...]}

bindings:
  - agent: coder
    telegram: '-100123456'

## Tests

168 new tests across 3 test files (agent_registry, router, integration).
All 3106 tests pass.
2026-03-11 03:21:12 -07:00
..
environments fix: Docker backend fails when docker is not in PATH (macOS gateway) 2026-03-10 20:45:13 -07:00
__init__.py
…
approval.py Merge PR #724: feat: --yolo flag to bypass all approval prompts 2026-03-10 20:56:30 -07:00
browser_tool.py Merge PR #709: fix: close log file handles to prevent resource leaks 2026-03-10 16:26:29 -07:00
checkpoint_manager.py
…
clarify_tool.py
…
code_execution_tool.py fix: improve read-loop detection — consecutive-only, correct thresholds, fix bugs 2026-03-10 16:25:41 -07:00
cronjob_tools.py
…
debug_helpers.py
…
delegate_tool.py feat: multi-agent architecture — named agents with routing, tool policies, and isolated workspaces 2026-03-11 03:21:12 -07:00
file_operations.py
…
file_tools.py fix: improve read-loop detection — consecutive-only, correct thresholds, fix bugs 2026-03-10 16:25:41 -07:00
fuzzy_match.py
…
homeassistant_tool.py
…
honcho_tools.py
…
image_generation_tool.py
…
interrupt.py
…
mcp_tool.py
…
memory_tool.py feat: multi-agent architecture — named agents with routing, tool policies, and isolated workspaces 2026-03-11 03:21:12 -07:00
mixture_of_agents_tool.py
…
openrouter_client.py
…
patch_parser.py
…
process_registry.py
…
registry.py
…
rl_training_tool.py fix: call _stop_training_run on early-return failure paths 2026-03-10 17:09:51 -07:00
send_message_tool.py
…
session_search_tool.py
…
skill_manager_tool.py
…
skills_guard.py
…
skills_hub.py
…
skills_sync.py
…
skills_tool.py Merge PR #617: Improve skills tool error handling 2026-03-10 04:32:26 -07:00
terminal_tool.py fix: Docker backend fails when docker is not in PATH (macOS gateway) 2026-03-10 20:45:13 -07:00
todo_tool.py
…
transcription_tools.py
…
tts_tool.py
…
vision_tools.py
…
web_tools.py
…