Skip to content

Add durable profile-agent orchestration via agent_control#43030

Open
dodo-reach wants to merge 1 commit into
NousResearch:mainfrom
dodo-reach:codex/agent-control-orchestration
Open

Add durable profile-agent orchestration via agent_control#43030
dodo-reach wants to merge 1 commit into
NousResearch:mainfrom
dodo-reach:codex/agent-control-orchestration

Conversation

@dodo-reach

Copy link
Copy Markdown
Contributor

Summary

This PR restores the work from #18493 after the original fork branch was deleted and GitHub could not reopen the closed pull request.

This PR adds agent_control: a durable orchestration layer that lets Hermes profiles manage other Hermes profiles as persistent peer agents over ACP.

The core idea is simple: delegate_task is for disposable subagents, Kanban is for asynchronous task-board workflows, and agent_control is for direct manager/team orchestration. A Hermes orchestrator can now command named specialist profiles with their own memory, tools, skills, config, and resumable session history.

This turns Hermes profiles into composable agent teammates without inventing a separate swarm runtime. It reuses the primitives Hermes already trusts: profiles for identity, ACP for process/session control, toolsets for capability boundaries, and SQLite for durable state.

This builds on the external orchestration direction from #14009, but moves the control plane into Hermes as an opt-in toolset designed for production reliability.

What changed

  • Add a lightweight ACP stdio JSON-RPC client for Hermes profile sessions.
  • Add a durable SQLite-backed control plane for profile-agent handles, runs, and leases.
  • Add the agent_control toolset and tools:
    • agent_start
    • agent_prompt
    • agent_status
    • agent_list
    • agent_fork
  • Keep editor ACP behavior unchanged by default.
  • Allow agent-control ACP subprocesses to use the controlled profile's CLI toolsets.
  • Prevent delegate_task children from inheriting agent_control.
  • Keep dangerous permission approval policy outside the model-facing schema; trusted local automation can opt into one-shot approvals only via process/admin configuration.
  • Omit model-facing cancellation until Hermes has an async or pollable run API with ACP response dispatching strong enough to cancel in-flight work reliably.
  • Add user docs and an ADR comparing delegate_task, agent_control, and Kanban.
  • Convert the existing Kanban architecture diagram to Mermaid so docs diagram lint stays green when website docs are touched.

Reliability notes

  • SQLite session leases are keyed by (profile, session_id), so duplicate handles or separate orchestrator profiles cannot race the same ACP session history.
  • agent_fork takes the same source-session lease before branching history.
  • Expired leases are marked as errors instead of leaving handles stuck.
  • Existing ACP sessions are loaded strictly; missing sessions fail instead of silently creating ghost state.
  • Dangerous permission requests fail closed by default.
  • The model cannot set approval_policy="allow_once" through tool arguments; permissive behavior requires HERMES_AGENT_CONTROL_APPROVAL_POLICY=allow_once.
  • agent_control is gated on the ACP extra.

Tests

  • .venv/bin/python -m pytest tests/acp/test_client.py tests/agent/test_orchestration.py tests/acp/test_session.py tests/tools/test_delegate.py tests/tools/test_registry.py::TestBuiltinDiscovery::test_matches_previous_manual_builtin_tool_set -q
    • 190 passed
  • .venv/bin/python -m compileall acp_adapter/client.py acp_adapter/session.py agent/orchestration.py tools/agent_control_tool.py hermes_cli/tools_config.py tests/acp/test_client.py tests/acp/test_session.py tests/agent/test_orchestration.py tests/tools/test_delegate.py tests/tools/test_registry.py
  • agent_control registry smoke check
  • agent_control toolset smoke check
  • .venv/bin/ascii-guard lint website/docs
  • npm run build
    • completed successfully with the venv Python on PATH so the skill metadata prebuild matches CI's pyyaml setup.
  • git diff --check

The targeted test set covers the new ACP client, the durable orchestration control plane, ACP toolset behavior, and the regression that prevents delegate_task children from inheriting agent_control. The full repository suite is left to CI.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/acp Agent Communication Protocol adapter comp/agent Core agent loop, run_agent.py, prompt builder tool/delegate Subagent delegation labels Jun 9, 2026
flooryyyy added a commit to flooryyyy/hermes-agent that referenced this pull request Jun 11, 2026
Source: PR NousResearch#43030 (dodo-reach), NousResearch/hermes-agent

Adds persistent peer agent control via ACP:
- acp_adapter/client.py — JSON-RPC ACP client (spawns hermes profiles as subprocesses)
- agent/orchestration.py — SQLite control plane (leases, handles, runs)
- tools/agent_control_tool.py — 5 tools: agent_spawn, agent_kill, agent_list, agent_prompt, agent_fork
- Fail-closed security — all agent operations denied unless admin opts in via env var
- 190 tests across tests/acp, tests/agent, tests/tools

Conflicts resolved:
- tests/tools/test_registry.py — kept both test methods (dynamic discovery + manual set)
- website/docs/reference/toolsets-reference.md — added agent_control row, kept browser CDP gating
- website/docs/user-guide/features/kanban.md — kept ASCII art diagram (not mermaid)
- website/sidebars.ts — kept both sidebar entries (programmatic-integration + agent-orchestration-adr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/acp Agent Communication Protocol adapter comp/agent Core agent loop, run_agent.py, prompt builder P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants