Academy → Practical GuidesOfficial documentation · Arabic guidance

Delegation & Parallel Work

أنماط التفويض والعمل المتوازي

Intermediate8 min readLesson 193 questions✓ 2026-08-18
Before you read

What this page is, and what it holds.

This page covers Delegation & Parallel Work. It carries a source warning and takes about 8 minutes to read. Each helper spends from your budget. Use them for work that genuinely splits.

9sections
8code examples
1tables
0commands
1,329source words
The official one-line description

When and how to use subagent delegation — patterns for parallel research, code review, and multi-file work

What you will be able to do

Outcomes taken from this page, not a template.

  • Understand what الوكلاء الفرعيون is and when you need it.
  • Read the table and take only the row that applies to you.
  • Avoid the mistake the source warns about.
Page map

Jump to the part you need.

  1. 01When to Delegate
  2. 02Pattern: Parallel Research
  3. 03Pattern: Code Review
  4. 04Pattern: Compare Alternatives
  5. 05Pattern: Multi-File Refactoring
  6. 06Pattern: Gather Then Analyze
  7. 07Inherited Tool Access
  8. 08Constraints
  9. 09Tips
The full official page

Nothing summarised away.

The documentation body below is reproduced from the official source so commands and identifiers stay exact. Each section carries a short note describing what it contains.

Hermes can spawn isolated child agents to work on tasks in parallel. Each subagent gets its own conversation, terminal session, and toolset. Only the final summary comes back — intermediate tool calls never enter your context window.

For the full feature reference, see Subagent Delegation.

---

When to Delegate

Explains the idea itself. Read it slowly; the later sections build on it.

Good candidates for delegation:

  • Reasoning-heavy subtasks (debugging, code review, research synthesis)
  • Tasks that would flood your context with intermediate data
  • Parallel independent workstreams (research A and B simultaneously)
  • Fresh-context tasks where you want the agent to approach without bias

Use something else:

  • Single tool call → just use the tool directly
  • Mechanical multi-step work with logic between steps → execute_code
  • Tasks needing user interaction → subagents can't use clarify
  • Quick file edits → do them directly
  • Durable long-running work that must survive session closure or process restart → cronjob or terminal(background=True, notify_on_complete=True). Top-level delegation is asynchronous but still process-local.

---

Pattern: Parallel Research

Explains the idea itself. Read it slowly; the later sections build on it.

Research three topics simultaneously and get structured summaries back:

Text6 lines
Research these three topics in parallel:
1. Current state of WebAssembly outside the browser
2. RISC-V server chip adoption in 2025
3. Practical quantum computing applications

Focus on recent developments and key players.

Behind the scenes, Hermes uses:

Python14 lines
delegate_task(tasks=[
    {
        "goal": "Research WebAssembly outside the browser in 2025",
        "context": "Focus on: runtimes (Wasmtime, Wasmer), cloud/edge use cases, WASI progress"
    },
    {
        "goal": "Research RISC-V server chip adoption",
        "context": "Focus on: server chips shipping, cloud providers adopting, software ecosystem"
    },
    {
        "goal": "Research practical quantum computing applications",
        "context": "Focus on: error correction breakthroughs, real-world use cases, key companies"
    }
])

All three run concurrently. Each subagent searches the web independently and returns a summary. The parent agent then synthesizes them into a coherent briefing.

---

Pattern: Code Review

Carries a warning. Read it before running anything here. The upstream warning appears below.

Delegate a security review to a fresh-context subagent that approaches the code without preconceptions:

Text3 lines
Review the authentication module at src/auth/ for security issues.
Check for SQL injection, JWT validation problems, password handling,
and session management. Fix anything you find and run the tests.

The key is the context field — it must include everything the subagent needs:

Python8 lines
delegate_task(
    goal="Review src/auth/ for security issues and fix any found",
    context="""Project at /home/user/webapp. Python 3.11, Flask, PyJWT, bcrypt.
    Auth files: src/auth/login.py, src/auth/jwt.py, src/auth/middleware.py
    Test command: pytest tests/auth/ -v
    Focus on: SQL injection, JWT validation, password hashing, session management.
    Fix issues found and verify tests pass."""
)

---

Pattern: Compare Alternatives

Explains the idea itself. Read it slowly; the later sections build on it.

Evaluate multiple approaches to the same problem in parallel, then pick the best:

Text8 lines
I need to add full-text search to our Django app. Evaluate three approaches
in parallel:
1. PostgreSQL tsvector (built-in)
2. Elasticsearch via django-elasticsearch-dsl
3. Meilisearch via meilisearch-python

For each: setup complexity, query capabilities, resource requirements,
and maintenance overhead. Compare them and recommend one.

Each subagent researches one option independently. Because they're isolated, there's no cross-contamination — each evaluation stands on its own merits. The parent agent gets all three summaries and makes the comparison.

---

Pattern: Multi-File Refactoring

Explains the idea itself. Read it slowly; the later sections build on it.

Split a large refactoring task across parallel subagents, each handling a different part of the codebase:

Python26 lines
delegate_task(tasks=[
    {
        "goal": "Refactor all API endpoint handlers to use the new response format",
        "context": """Project at /home/user/api-server.
        Files: src/handlers/users.py, src/handlers/auth.py, src/handlers/billing.py
        Old format: return {"data": result, "status": "ok"}
        New format: return APIResponse(data=result, status=200).to_dict()
        Import: from src.responses import APIResponse
        Run tests after: pytest tests/handlers/ -v"""
    },
    {
        "goal": "Update all client SDK methods to handle the new response format",
        "context": """Project at /home/user/api-server.
        Files: sdk/python/client.py, sdk/python/models.py
        Old parsing: result = response.json()["data"]
        New parsing: result = response.json()["data"] (same key, but add status code checking)
        Also update sdk/python/tests/test_client.py"""
    },
    {
        "goal": "Update API documentation to reflect the new response format",
        "context": """Project at /home/user/api-server.
        Docs at: docs/api/. Format: Markdown with code examples.
        Update all response examples from old format to new format.
        Add a 'Response Format' section to docs/api/overview.md explaining the schema."""
    }
])

---

Pattern: Gather Then Analyze

Explains the idea itself. Read it slowly; the later sections build on it.

Use execute_code for mechanical data gathering, then delegate the reasoning-heavy analysis:

Python29 lines
# Step 1: Mechanical gathering (execute_code is better here — no reasoning needed)
execute_code("""
from hermes_tools import web_search, web_extract

results = []
for query in ["AI funding Q1 2026", "AI startup acquisitions 2026", "AI IPOs 2026"]:
    r = web_search(query, limit=5)
    for item in r["data"]["web"]:
        results.append({"title": item["title"], "url": item["url"], "desc": item["description"]})

# Extract full content from top 5 most relevant
urls = [r["url"] for r in results[:5]]
content = web_extract(urls)

# Save for the analysis step

with open("/tmp/ai-funding-data.json", "w") as f:
    json.dump({"search_results": results, "extracted": content["results"]}, f)
print(f"Collected {len(results)} results, extracted {len(content['results'])} pages")
""")

# Step 2: Reasoning-heavy analysis (delegation is better here)
delegate_task(
    goal="Analyze AI funding data and write a market report",
    context="""Raw data at /tmp/ai-funding-data.json contains search results and
    extracted web pages about AI funding, acquisitions, and IPOs in Q1 2026.
    Write a structured market report: key deals, trends, notable players,
    and outlook. Focus on deals over $100M."""
)

This is often the most efficient pattern: execute_code handles the 10+ sequential tool calls cheaply, then a subagent does the single expensive reasoning task with a clean context.

---

Inherited Tool Access

Explains the idea itself. Read it slowly; the later sections build on it.

Subagents inherit the parent's enabled toolsets. delegate_task does not accept a model-facing toolsets parameter, so delegated work cannot grant itself capabilities that the parent does not have. Configure the parent's tools before starting the conversation when a delegated task needs web, terminal, file, or other access. Hermes still strips child-blocked tools such as clarify, memory, and send_message; children keep execute_code for programmatic tool calling.

---

Constraints

Settings you configure once. Change one at a time so you can see what each does.

  • Default 3 parallel tasks: batches default to 3 concurrent subagents (configurable via delegation.max_concurrent_children in config.yaml, no hard ceiling, only a floor of 1)
  • Nested delegation is opt-in: leaf subagents (default) cannot call delegate_task, clarify, memory, or execute_code. Orchestrator subagents (role="orchestrator") retain delegate_task for further delegation, but only when delegation.max_spawn_depth is raised above the default of 1 (floor 1, no ceiling); the other three remain blocked. Disable globally via delegation.orchestrator_enabled: false.

Tuning Concurrency and Depth

ConfigDefaultRangeEffect
max_concurrent_children3>=1Parallel batch size per delegate_task call
max_spawn_depth1>=1How many delegation levels can spawn further

Example: running 30 parallel workers with nested subagents:

YAML3 lines
delegation:
  max_concurrent_children: 30
  max_spawn_depth: 2
  • Separate terminals — each subagent gets its own terminal session with separate working directory and state
  • No conversation history — subagents see only the goal and context the parent agent passes when calling delegate_task
  • Default 50 iterations — set max_iterations lower for simple tasks to save cost
  • Not durable — top-level delegation runs in the background and posts its result back later, but it remains tied to the owning session and Hermes process. Session closure, /stop, /new, or a process restart can cancel or strand in-progress work. Use cronjob or terminal(background=True, notify_on_complete=True) for work that must survive those boundaries.

---

Tips

Explains the idea itself. Read it slowly; the later sections build on it.

Be specific in goals. "Fix the bug" is too vague. "Fix the TypeError in api/handlers.py line 47 where process_request() receives None from parse_body()" gives the subagent enough to work with.

Include file paths. Subagents don't know your project structure. Always include absolute paths to relevant files, the project root, and the test command.

Use delegation for context isolation. Sometimes you want a fresh perspective. Delegating forces you to articulate the problem clearly, and the subagent approaches it without the assumptions that built up in your conversation.

Check results. Subagent summaries are just that — summaries. If a subagent says "fixed the bug and tests pass," verify by running the tests yourself or reading the diff.

---

For the complete delegation reference — all parameters, ACP integration, and advanced configuration — see Subagent Delegation.

Knowledge check

3 questions answered by this page alone.

Every option is a real identifier from the Hermes documentation. The wrong ones are real too, just from other pages.

1. Which warning does the source state in this lesson?
2. Which of these headings does not appear in this lesson?
3. Which configuration key appears in this lesson's examples?