You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Hermes Agent's current delegate_task, sub-agents are fully isolated by design — they cannot see each other's work, access the parent's memory, or share any state. Each child gets a fresh conversation, its own terminal session, and no access to sibling results. This isolation is good for safety but creates a real problem for multi-step workflows: downstream tasks often need context from upstream tasks, and the only way to pass it is through the parent agent, which burns tokens and adds latency.
CAMEL-AI's Workforce system solves this with shared memory pools — workers in a coordinated workflow can read from (and write to) a shared knowledge base, so step 2 can directly access what step 1 discovered without routing through a coordinator.
Adding shared memory to Hermes's workflow delegation would make multi-step tasks dramatically more efficient and higher quality.
Workers operate in a shared context where they can access results from other workers
The Task object carries state (OPEN/RUNNING/DONE/FAILED) and results
When a downstream task's dependencies are satisfied, it receives the upstream results as additional context
Workers can also write to a shared memory pool that persists across the workflow
The Problem This Solves in Hermes
Current flow (wasteful):
Parent delegates "Research API" to Agent A
→ Agent A returns 5-page summary to parent
Parent reads summary, extracts relevant parts
Parent delegates "Implement client" to Agent B with extracted context
→ Agent B returns implementation to parent
Parent reads implementation
Parent delegates "Write tests" to Agent C with implementation context
→ Agent C returns tests
Every handoff goes through the parent, which must:
Read the full output (consumes context window)
Extract the relevant parts (risks losing important details)
Reformat as context for the next agent (adds tokens)
With shared memory:
Parent creates workflow with shared scratchpad
Agent A writes research findings to shared scratchpad
Agent B reads research from scratchpad, writes implementation
Agent C reads implementation from scratchpad, writes tests
Parent gets final aggregate result
No token waste on parent relay. No information loss from summarization. Each agent gets exactly the context it needs.
Current State in Hermes Agent
Sub-agent isolation (delegate_tool.py):
Children get fresh AIAgent instances with empty conversation history
Only the goal and context strings from the parent are available
Children cannot access: parent memory, sibling results, shared files (beyond the filesystem)
Batch mode (up to 3 parallel) returns individual summaries — no cross-agent visibility
Filesystem as implicit shared state:
Sub-agents CAN read/write to the shared filesystem
In practice, this is how context gets passed today: Agent A writes to a file, Agent B reads it
But this is fragile — no guarantees about timing, naming conventions, or cleanup
And it only works for local/Docker backends, not Modal/SSH
Memory system (tools/memory_tool.py):
Persistent memory exists but is the PARENT's memory
Sub-agents are explicitly blocked from accessing it (memory is in the blocked tools list)
This is a codebase change to tools/delegate_tool.py and potentially a new agent/shared_context.py module. It modifies core delegation mechanics — not a skill, not a standalone tool.
What We'd Need
SharedContext object — A thread-safe key-value store scoped to a workflow execution
Read/write tools for sub-agents — context_read(key) and context_write(key, value) tools available to children in workflow mode
Lifecycle management — Context created when workflow starts, cleaned up when it ends
Scope control — Define which agents can read/write which keys (prevents all-to-all chaos)
When step completes, its designated outputs are stored in the scratchpad
Downstream steps get scratchpad contents injected into their context automatically
Read-only by default — agents read upstream results but can't modify them
Implementation:
SharedContext class: thread-safe dict with get(key), set(key, value), keys()
Passed to child agents via a lightweight context_read tool (read-only)
Write happens automatically: step output is stored under the step's declared writes keys
Deliverable: Efficient context passing between workflow steps without parent relay
Phase 2: Active Shared Memory (Depends on Phase 1)
Allow agents to actively read and write during execution, not just at step boundaries:
# Agent A (during execution):context_write("discovered_endpoints", ["/v1/charges", "/v1/customers", ...])
context_write("auth_method", "Bearer token via API key")
# Agent B (during execution, after A completes):endpoints=context_read("discovered_endpoints")
auth=context_read("auth_method")
Sub-agents get both context_read and context_write tools
Overview
In Hermes Agent's current
delegate_task, sub-agents are fully isolated by design — they cannot see each other's work, access the parent's memory, or share any state. Each child gets a fresh conversation, its own terminal session, and no access to sibling results. This isolation is good for safety but creates a real problem for multi-step workflows: downstream tasks often need context from upstream tasks, and the only way to pass it is through the parent agent, which burns tokens and adds latency.CAMEL-AI's Workforce system solves this with shared memory pools — workers in a coordinated workflow can read from (and write to) a shared knowledge base, so step 2 can directly access what step 1 discovered without routing through a coordinator.
Adding shared memory to Hermes's workflow delegation would make multi-step tasks dramatically more efficient and higher quality.
Depends on: #344 (Workflow Formulas + Multi-Agent Orchestration — provides the workflow DAG infrastructure)
Related: #375 (Inception Prompting), #376 (Debate Mode), #346 (Structured Memory System)
Research Findings
How CAMEL-AI's Shared Memory Works
In CAMEL's Workforce:
The Problem This Solves in Hermes
Current flow (wasteful):
Every handoff goes through the parent, which must:
With shared memory:
No token waste on parent relay. No information loss from summarization. Each agent gets exactly the context it needs.
Current State in Hermes Agent
Sub-agent isolation (
delegate_tool.py):goalandcontextstrings from the parent are availableFilesystem as implicit shared state:
Memory system (
tools/memory_tool.py):memoryis in the blocked tools list)Implementation Plan
Skill vs. Tool Classification
This is a codebase change to
tools/delegate_tool.pyand potentially a newagent/shared_context.pymodule. It modifies core delegation mechanics — not a skill, not a standalone tool.What We'd Need
context_read(key)andcontext_write(key, value)tools available to children in workflow modePhased Rollout
Phase 1: Workflow Scratchpad (Depends on #344)
A simple shared scratchpad for workflow steps:
writesandreadsImplementation:
SharedContextclass: thread-safe dict withget(key),set(key, value),keys()context_readtool (read-only)writeskeysPhase 2: Active Shared Memory (Depends on Phase 1)
Allow agents to actively read and write during execution, not just at step boundaries:
context_readandcontext_writetoolsPhase 3: Cross-Workflow Memory & Persistent Shared Context
Pros & Cons
Pros
threading.Lock(already used in delegate_tool.py) makes concurrent access safeCons / Risks
Open Questions
References
tools/delegate_tool.py— Current isolated sub-agent spawning