Comprehensive audit of all ~100 doc pages against the actual code, fixing: Reference docs: - HERMES_API_TIMEOUT default 900 -> 1800 (env-vars) - TERMINAL_DOCKER_IMAGE default python:3.11 -> nikolaik/python-nodejs (env-vars) - compression.summary_model default shown as gemini -> actually empty string (env-vars) - Add missing GOOGLE_API_KEY, GEMINI_API_KEY, GEMINI_BASE_URL env vars (env-vars) - Add missing /branch (/fork) slash command (slash-commands) - Fix hermes-cli tool count 39 -> 38 (toolsets-reference) - Fix hermes-api-server drop list to include text_to_speech (toolsets-reference) - Fix total tool count 47 -> 48, standalone 14 -> 15 (tools-reference) User guide: - web_extract.timeout default 30 -> 360 (configuration) - Remove display.theme_mode (not implemented in code) (configuration) - Remove display.background_process_notifications (not in defaults) (configuration) - Browser inactivity timeout 300/5min -> 120/2min (browser) - Screenshot path browser_screenshots -> cache/screenshots (browser) - batch_runner default model claude-sonnet-4-20250514 -> claude-sonnet-4.6 - Add minimax to TTS provider list (voice-mode) - Remove credential_pool_strategies from auth.json example (credential-pools) - Fix Slack token path platforms/slack/ -> root ~/.hermes/ (slack) - Fix Matrix store path for new installs (matrix) - Fix WhatsApp session path for new installs (whatsapp) - Fix HomeAssistant config from gateway.json to config.yaml (homeassistant) - Fix WeCom gateway start command (wecom) Developer guide: - Fix tool/toolset counts in architecture overview - Update line counts: main.py ~5500, setup.py ~3100, run.py ~7500, mcp_tool ~2200 - Replace nonexistent agent/memory_store.py with memory_manager.py + memory_provider.py - Update _discover_tools() list: remove honcho_tools, add skill_manager_tool - Add session_search and delegate_task to intercepted tools list (agent-loop) - Fix budget warning: two-tier system (70% caution, 90% warning) (agent-loop) - Fix gateway auth order (per-platform first, global last) (gateway-internals) - Fix email_adapter.py -> email.py, add webhook.py + api_server.py (gateway-internals) - Add 7 missing providers to provider-runtime list Other: - Add Docker --cap-add entries to security doc - Fix Python version 3.10+ -> 3.11+ (contributing) - Fix AGENTS.md discovery claim (not hierarchical walk) (tips) - Fix cron 'add' -> canonical 'create' (cron-internals) - Add pre_api_request/post_api_request hooks to plugin guide - Add Google/Gemini provider to providers page - Clarify OPENAI_BASE_URL deprecation (providers)
8.5 KiB
sidebar_position, title, description
| sidebar_position | title | description |
|---|---|---|
| 12 | Batch Processing | Generate agent trajectories at scale — parallel processing, checkpointing, and toolset distributions |
Batch Processing
Batch processing lets you run the Hermes agent across hundreds or thousands of prompts in parallel, generating structured trajectory data. This is primarily used for training data generation — producing ShareGPT-format trajectories with tool usage statistics that can be used for fine-tuning or evaluation.
Overview
The batch runner (batch_runner.py) processes a JSONL dataset of prompts, running each through a full agent session with tool access. Each prompt gets its own isolated environment. The output is structured trajectory data with full conversation history, tool call statistics, and reasoning coverage metrics.
Quick Start
# Basic batch run
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 run
python batch_runner.py \
--dataset_file=data/prompts.jsonl \
--batch_size=10 \
--run_name=my_first_run \
--resume
# List available toolset distributions
python batch_runner.py --list_distributions
Dataset Format
The input dataset is a JSONL file (one JSON object per line). Each entry must have a prompt field:
{"prompt": "Write a Python function that finds the longest palindromic substring"}
{"prompt": "Create a REST API endpoint for user authentication using Flask"}
{"prompt": "Debug this error: TypeError: cannot unpack non-iterable NoneType object"}
Entries can optionally include:
imageordocker_image: A container image to use for this prompt's sandbox (works with Docker, Modal, and Singularity backends)cwd: Working directory override for the task's terminal session
Configuration Options
| Parameter | Default | Description |
|---|---|---|
--dataset_file |
(required) | Path to JSONL dataset |
--batch_size |
(required) | Prompts per batch |
--run_name |
(required) | Name for this run (used for output dir and checkpointing) |
--distribution |
"default" |
Toolset distribution to sample from |
--model |
claude-sonnet-4.6 |
Model to use |
--base_url |
https://openrouter.ai/api/v1 |
API base URL |
--api_key |
(env var) | API key for model |
--max_turns |
10 |
Maximum tool-calling iterations per prompt |
--num_workers |
4 |
Parallel worker processes |
--resume |
false |
Resume from checkpoint |
--verbose |
false |
Enable verbose logging |
--max_samples |
all | Only process first N samples from dataset |
--max_tokens |
model default | Maximum tokens per model response |
Provider Routing (OpenRouter)
| Parameter | Description |
|---|---|
--providers_allowed |
Comma-separated providers to allow (e.g., "anthropic,openai") |
--providers_ignored |
Comma-separated providers to ignore (e.g., "together,deepinfra") |
--providers_order |
Comma-separated preferred provider order |
--provider_sort |
Sort by "price", "throughput", or "latency" |
Reasoning Control
| Parameter | Description |
|---|---|
--reasoning_effort |
Effort level: xhigh, high, medium, low, minimal, none |
--reasoning_disabled |
Completely disable reasoning/thinking tokens |
Advanced Options
| Parameter | Description |
|---|---|
--ephemeral_system_prompt |
System prompt used during execution but NOT saved to trajectories |
--log_prefix_chars |
Characters to show in log previews (default: 100) |
--prefill_messages_file |
Path to JSON file with prefill messages for few-shot priming |
Toolset Distributions
Each prompt gets a randomly sampled set of toolsets from a distribution. This ensures training data covers diverse tool combinations. Use --list_distributions to see all available distributions.
In the current implementation, distributions assign a probability to each individual toolset. The sampler flips each toolset independently, then guarantees that at least one toolset is enabled. This is different from a hand-authored table of prebuilt combinations.
Output Format
All output goes to data/<run_name>/:
data/my_run/
├── trajectories.jsonl # Combined final output (all batches merged)
├── batch_0.jsonl # Individual batch results
├── batch_1.jsonl
├── ...
├── checkpoint.json # Resume checkpoint
└── statistics.json # Aggregate tool usage stats
Trajectory Format
Each line in trajectories.jsonl is a JSON object:
{
"prompt_index": 42,
"conversations": [
{"from": "human", "value": "Write a function..."},
{"from": "gpt", "value": "I'll create that function...",
"tool_calls": [...]},
{"from": "tool", "value": "..."},
{"from": "gpt", "value": "Here's the completed function..."}
],
"metadata": {
"batch_num": 2,
"timestamp": "2026-01-15T10:30:00",
"model": "anthropic/claude-sonnet-4.6"
},
"completed": true,
"partial": false,
"api_calls": 3,
"toolsets_used": ["terminal", "file"],
"tool_stats": {
"terminal": {"count": 2, "success": 2, "failure": 0},
"read_file": {"count": 1, "success": 1, "failure": 0}
},
"tool_error_counts": {
"terminal": 0,
"read_file": 0
}
}
The conversations field uses a ShareGPT-like format with from and value fields. Tool stats are normalized to include all possible tools with zero defaults, ensuring consistent schema across entries for HuggingFace datasets compatibility.
Checkpointing
The batch runner has robust checkpointing for fault tolerance:
- Checkpoint file: Saved after each batch completes, tracking which prompt indices are done
- Content-based resume: On
--resume, the runner scans existing batch files and matches completed prompts by their actual text content (not just indices), enabling recovery even if the dataset order changes - Failed prompts: Only successfully completed prompts are marked as done — failed prompts will be retried on resume
- Batch merging: On completion, all batch files (including from previous runs) are merged into a single
trajectories.jsonl
How Resume Works
- Scan all
batch_*.jsonlfiles for completed prompts (by content matching) - Filter the dataset to exclude already-completed prompts
- Re-batch the remaining prompts
- Process only the remaining prompts
- Merge all batch files (old + new) into final output
Quality Filtering
The batch runner applies automatic quality filtering:
- No-reasoning filter: Samples where zero assistant turns contain reasoning (no
<REASONING_SCRATCHPAD>or native thinking tokens) are discarded - Corrupted entry filter: Entries with hallucinated tool names (not in the valid tool list) are filtered out during the final merge
- Reasoning statistics: Tracks percentage of turns with/without reasoning across the entire run
Statistics
After completion, the runner prints comprehensive statistics:
- Tool usage: Call counts, success/failure rates per tool
- Reasoning coverage: Percentage of assistant turns with reasoning
- Samples discarded: Count of samples filtered for lacking reasoning
- Duration: Total processing time
Statistics are also saved to statistics.json for programmatic analysis.
Use Cases
Training Data Generation
Generate diverse tool-use trajectories for fine-tuning:
python batch_runner.py \
--dataset_file=data/coding_prompts.jsonl \
--batch_size=20 \
--run_name=coding_v1 \
--model=anthropic/claude-sonnet-4.6 \
--num_workers=8 \
--distribution=default \
--max_turns=15
Model Evaluation
Evaluate how well a model uses tools across standardized prompts:
python batch_runner.py \
--dataset_file=data/eval_suite.jsonl \
--batch_size=10 \
--run_name=eval_gpt4 \
--model=openai/gpt-4o \
--num_workers=4 \
--max_turns=10
Per-Prompt Container Images
For benchmarks requiring specific environments, each prompt can specify its own container image:
{"prompt": "Install numpy and compute eigenvalues of a 3x3 matrix", "image": "python:3.11-slim"}
{"prompt": "Compile this Rust program and run it", "image": "rust:1.75"}
{"prompt": "Set up a Node.js Express server", "image": "node:20-alpine", "cwd": "/app"}
The batch runner verifies Docker images are accessible before running each prompt.