Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Hermes Agent Sub-Agent Delegation and Batch Processing

Hermes Agent Sub-Agent Delegation and Batch Processing

This chapter introduces two parallel-processing capabilities of Hermes: sub-agent delegation lets a main Agent distribute tasks to multiple sub-agents for parallel execution, while the batch-processing system runs the Agent in parallel over hundreds of Prompts and generates structured training data.


Sub-Agent Delegation and Parallelism

Hermes supports delegating tasks from the main Agent to sub-agents, enabling parallel workflows.

Sub-agents are implemented through the delegation following toolset:

Example

File path: ~/.hermes/config.yaml

Make sure the delegation toolset is enabled

toolsets

:

 - delegation

The main Agent uses the spawn_agent or spawn_parallel tool to spawn sub-agents.

The following pseudocode illustrates the mechanism of parallel delegation:

Example

Parallel delegation mechanism of the Agent within a session (pseudocode, illustrating the principle)

spawn_parallel dispatches multiple sub-agents at the same time, each executing independently

spawn_parallel

(

[

 

{

"prompt"

:

"Analyze Q1 sales data and generate a trend report"

}

,

 

{

"prompt"

:

"Analyze Q2 sales data and generate a trend report"

}

,

 

{

"prompt"

:

"Analyze Q3 sales data and generate a trend report"

}

]

)

The three sub-agents work in parallel, and the results are aggregated and returned to the main Agent

Background Tasks

Start a background task directly within a session:

Example

Start a background task in the session

/

background checks all servers and reports any downtime

Kanban Multi-Agent Collaboration

The Kanban toolset provides more structured multi-agent collaboration: an orchestrator Agent distributes tasks to the board, and multiple worker Agents claim and execute them:

Example

Enable the kanban toolset (must be enabled explicitly; even all/* will not enable it automatically)

hermes tools

enable

kanban

Add a role description to the Profile so the orchestrator knows each Agent's capabilities

hermes profile create researcher \

 

--description

"Good at reading source code and external documentation, and producing research reports"

hermes profile create coder \

 

--description

"Good at implementing features, fixing bugs, and writing tests"

The Kanban toolset must be enabled explicitly - even all or * will not turn it on automatically. This is intentional, because multi-agent collaboration consumes more tokens.


Batch Processing and RL Training Data Generation

Batch processing lets you run the Agent in parallel over hundreds or thousands of Prompts, generating structured trajectory data - mainly used for generating and evaluating model fine-tuning training data.

Quick Start

Example

Prepare a Prompt dataset in JSONL format

cat

data

/

prompts.jsonl

{"prompt": "Write a Python function to find the longest palindromic substring"}

{"prompt": "Create a user-authentication REST API endpoint with Flask"}

{"prompt": "Debug this error: TypeError: cannot unpack non-iterable"}

Run batch processing

python batch_runner.py \

    --dataset_file=data

/

prompts.jsonl \

    --batch_size=

10

\

    --run_name=my_first_run \

   

--model

=anthropic

/

claude-sonnet-

4

6

\

    --num_workers=

4

Resume an interrupted task from a checkpoint

python batch_runner.py \

    --dataset_file=data

/

prompts.jsonl \

    --batch_size=

10

\

    --run_name=my_first_run \

   

--resume

Dataset Format

Each line is a JSON object and must contain the prompt field, and may optionally include additional context:

Example

{"prompt": "Write a Python function to find palindromes"}

{"prompt": "Debug this error", "cwd": "/home/user/project", "docker_image": "python:3.12"}

Main Parameters

Parameters Default value Description
--dataset_file Required Path to the JSONL dataset
--batch_size Required Number of Prompts per batch
--run_name Required Run name (used for the output directory and resuming)
--model claude-sonnet-4.6 Model to use
--num_workers 4 Number of parallel worker processes
--max_turns 10 Maximum tool-call rounds per Prompt
--distribution "default" Toolset distribution (randomly sampling different tool combinations)
--reasoning_effort — Reasoning effort: none/minimal/low/medium/high/xhigh
--resume false Resume from checkpoint

Output Structure

Batch processing generates the following directory structure:



data/my_first_run/

├── trajectories.jsonl    # 最终合并输出(所有批次)

├── batch_0.jsonl         # 各批次结果

├── batch_1.jsonl

├── checkpoint.json       # 断点续传记录

└── statistics.json       # 工具使用统计

Each trajectory is output in ShareGPT format, including the full conversation history, tool-call records, and reasoning coverage statistics:

Example

{

  "prompt_index": 42,

  "conversations": [

    {"from": "human", "value": "Write a function to find palindromes..."},

    {"from": "gpt", "value": "I'll create this function...",

     "tool_calls": [{"name": "terminal", "arguments": {...}}]},

    {"from": "tool", "value": "...execution result..."},

    {"from": "gpt", "value": "Here is the completed function..."}

  ],

  "completed": true,

  "toolsets_used": ["terminal", "file"],

  "tool_stats": {

    "terminal": {"count": 2, "success": 2, "failure": 0}

  }

}

Quality Filtering

Two filters are automatically applied after a batch run completes:

Filter Rule Purpose
Zero-reasoning filter Samples without any reasoning traces are discarded Ensure the output includes a thinking process and improve training-data quality
Hallucinated tool-name filter Entries containing tool calls not in the valid tool list are filtered out Exclude invalid tool calls produced by model hallucinations

Reasoning traces refer to the marker or native thinking tokens. The filtered data is better suited for model fine-tuning.

Integration with the Atropos RL Environment

Batch processing can directly generate Atropos-compatible training data:

Example

Generate Atropos-compatible training data

python batch_runner.py \

    --dataset_file=data

/

coding_tasks.jsonl \

    --run_name=atropos_run \

   

--model

=nous-hermes-

3.1

\

    --num_workers=

8

\

    --reasoning_effort=high

The output trajectories.jsonl can be used directly as training input for Atropos