mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
feat: add agent_orchestration plugin
Add agent orchestration module with mailbox, manager, hooks, and tools for multi-agent coordination. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e5d41f05d4
commit
4f716d72d1
7 changed files with 1414 additions and 0 deletions
78
agent_orchestration/config.py
Normal file
78
agent_orchestration/config.py
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
"""
|
||||
Agent Orchestration Configuration
|
||||
===================================
|
||||
|
||||
Reads ``orchestration:`` top-level key from Hermes config.yaml.
|
||||
Hermes deep-merges unknown keys transparently, so no core changes needed.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_DEFAULTS: Dict[str, Any] = {
|
||||
"enabled": True,
|
||||
"max_agents": 5,
|
||||
"default_max_iterations": 50,
|
||||
"default_toolsets": ["terminal", "file", "web"],
|
||||
"permissions": {
|
||||
"mode": "inherit",
|
||||
"allowlist": [],
|
||||
"blocklist": [],
|
||||
},
|
||||
"context_sharing": {
|
||||
"enabled": True,
|
||||
"max_shared_context_tokens": 4000,
|
||||
},
|
||||
"mailbox_dir": "", # default: ~/.hermes/orchestration/mailboxes/
|
||||
}
|
||||
|
||||
|
||||
def _load_hermes_config() -> Dict[str, Any]:
|
||||
"""Load the Hermes main config.yaml."""
|
||||
try:
|
||||
from hermes_cli.config import load_config
|
||||
return load_config()
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
|
||||
def load_orchestration_config() -> Dict[str, Any]:
|
||||
"""Load and merge orchestration config with defaults."""
|
||||
cfg = _load_hermes_config()
|
||||
orch = cfg.get("orchestration", {})
|
||||
if not isinstance(orch, dict):
|
||||
orch = {}
|
||||
|
||||
# Deep merge with defaults
|
||||
merged = dict(_DEFAULTS)
|
||||
for key, val in orch.items():
|
||||
if key in merged and isinstance(merged[key], dict) and isinstance(val, dict):
|
||||
merged[key] = {**merged[key], **val}
|
||||
else:
|
||||
merged[key] = val
|
||||
|
||||
# Resolve mailbox_dir
|
||||
if not merged.get("mailbox_dir"):
|
||||
try:
|
||||
from hermes_constants import get_hermes_home
|
||||
merged["mailbox_dir"] = str(
|
||||
get_hermes_home() / "orchestration" / "mailboxes"
|
||||
)
|
||||
except Exception:
|
||||
merged["mailbox_dir"] = os.path.expanduser(
|
||||
"~/.hermes/orchestration/mailboxes"
|
||||
)
|
||||
|
||||
return merged
|
||||
|
||||
|
||||
def get_max_agents() -> int:
|
||||
return int(load_orchestration_config().get("max_agents", 5))
|
||||
|
||||
|
||||
def get_default_toolsets() -> List[str]:
|
||||
return list(load_orchestration_config().get("default_toolsets", ["terminal", "file", "web"]))
|
||||
Loading…
Add table
Add a link
Reference in a new issue