Loading page

Create a local test workspace

You’ll create a small test directory containing a Python script with two deliberate bugs. You’ll use the script to evaluate the end-to-end tool-calling loop of the Hermes Agent in a repeatable way.

Create the test directory:

    

        
        
mkdir -p ~/hermes-test-workspace
cd ~/hermes-test-workspace

    

Create metrics_parser.py with an intentional off-by-one divisor bug and a mismatched dictionary key name:

    

        
        
cat <<'EOF' > ~/hermes-test-workspace/metrics_parser.py
def average_latency(records):
    if not records:
        return 0.0
    total = sum(r["latency"] for r in records)
    return total / (len(records) - 1)

if __name__ == "__main__":
    sample = [
        {"endpoint": "/v1/models", "latency_ms": 12.0},
        {"endpoint": "/v1/chat/completions", "latency_ms": 48.0},
    ]
    print(f"Average latency: {average_latency(sample):.2f} ms")
EOF

    

Running the script reveals the KeyError: 'latency' failure, alongside the division by len(records) - 1 that skews averages and fails on single-item lists:

    

        
        
python3 metrics_parser.py

    

The output is similar to:

    

        
        Traceback (most recent call last):
  File "/Users/user/hermes-test-workspace/metrics_parser.py", line 12, in <module>
    print(f"Average latency: {average_latency(sample):.2f} ms")
                              ~~~~~~~~~~~~~~~^^^^^^^^
  File "/Users/user/hermes-test-workspace/metrics_parser.py", line 4, in average_latency
    total = sum(r["latency"] for r in records)
  File "/Users/user/hermes-test-workspace/metrics_parser.py", line 4, in <genexpr>
    total = sum(r["latency"] for r in records)
                ~^^^^^^^^^^^
KeyError: 'latency'

        
    

Run the multi-step agent prompt

Run Hermes Agent inside ~/hermes-test-workspace with Gemma 4 E4B active on llama-server. You can run interactively with hermes or pass the prompt directly with hermes chat --cli:

    

        
        
hermes chat --cli -q "Inspect the current directory, read metrics_parser.py, diagnose any bugs, fix metrics_parser.py, and run python3 metrics_parser.py to verify the output." --oneshot

    
Note

On the first turn of a new session, Hermes Agent sends an ~11K-token system prompt and tool schemas. With Metal GPU offloading active on Apple M4 Pro, cold prefill finishes in a few seconds. Subsequent tool calls reuse the llama-server key-value (KV) cache.

Observe how the agent runs the full tool loop:

  1. Lists the workspace files and reads metrics_parser.py.
  2. Diagnoses both the r["latency"] key mismatch and the len(records) - 1 divisor bug.
  3. Patches both lines in metrics_parser.py.
  4. Runs python3 metrics_parser.py and confirms Average latency: 30.00 ms.

The output is similar to:

    

        
        Query: Inspect the current directory, read metrics_parser.py, diagnose any bugs,
fix metrics_parser.py, and run python3 metrics_parser.py to verify the output.
...
💻 $ ls -F  0.4s
📖 Read metrics_parser.py
...
🔧 Patch metrics_parser.py
│ metrics_parser.py
│ @@ -1,7 +1,7 @@
│  def average_latency(records):
│      if not records:
│          return 0.0
│ -    total = sum(r["latency"] for r in records)
│ +    total = sum(r["latency_ms"] for r in records)
│      return total / (len(records) - 1)
│
│  if __name__ == "__main__":
🔧 Patch metrics_parser.py
│ metrics_parser.py
│ @@ -2,7 +2,7 @@
│      if not records:
│          return 0.0
│      total = sum(r["latency_ms"] for r in records)
│ -    return total / (len(records) - 1)
│ +    return total / len(records)
│
│  if __name__ == "__main__":
│      sample = [
💻 $ python3 metrics_parser.py  0.8s
────────────────────────────────────────
☤ Hermes
The code was diagnosed with a KeyError (using "latency" instead of "latency_ms") and a potential ZeroDivisionError/logical error (dividing by N-1 instead of N). Fixes implemented:
1. Changed r["latency"] to r["latency_ms"] in average_latency.
2. Changed the denominator in average_latency from len(records) - 1 to len(records) to ensure the correct simple average is calculated and prevent division by zero for single-record inputs.
Execution of python3 metrics_parser.py verified the fix, producing the output: Average latency: 30.00 ms
────────────────────────────────────────

Session:        local-9c2f2bdee7306a37eeb5f3a92a7e2bdb92715a28f5c150922c632d689897d3b8
Duration:       47s
Messages:       12 (1 user, 10 tool calls)

        
    

Monitor system resources while running

While llama-server runs, open a separate terminal to inspect its resident set size (RSS) and physical memory footprint. Also check the overall system memory pressure:

    

        
        
ps -o pid=,rss=,comm= -p $(pgrep -n llama-server) | awk '{printf "PID=%s RSS=%.2f GiB CMD=%s\n", $1, $2/1048576, $3}'
top -l 1 -s 0 | grep PhysMem
footprint -p $(pgrep -n llama-server) | grep -E "Footprint:|mapped file|TOTAL"

    

The output is similar to:

    

        
        PID=65968 RSS=3.62 GiB CMD=./build/bin/llama-server
PhysMem: 23G used (9489M wired, 5828M compressor), 279M unused.
llama-server [65968]: 64-bit    Footprint: 955 MB (16384 bytes per page)
    0 B    2878 MB          0 B         22    mapped file
 955 MB    2884 MB      6608 KB       3991    TOTAL

        
    

With Gemma 4 E4B, a 64K context window, and a q8_0 KV cache, llama-server uses about 955 MB of dirty physical footprint. It also uses ~2.8–4.3 GB of clean memory-mapped weights. This fits comfortably on Apple silicon Macs with 16 GB or more of unified memory.

Observed agentic performance

The following table summarizes the observed run for Gemma 4 E4B on an Apple M4 Pro. The Mac has 24 GB of unified memory and Metal GPU offload:

MetricGemma 4 E4B (Q4_0, Metal)
Tool-call format reliabilityClean tool calls (terminal, read_file, patch)
Diagnosis and fix accuracyIdentified and patched both bugs cleanly before verification
Total wall-clock completion time47s (cold ~11K-token prefill, plus 10 tool calls across 12 messages)
llama-server memory (RSS and dirty footprint)~3.62 GiB RSS (955 MB dirty footprint + 2.8 GB mapped file)

What you’ve accomplished

You’ve connected Nous Research Hermes Agent to your local llama-server endpoint and used it to fix both bugs in metrics_parser.py. You’ve verified the output of the script.

You can extend the Learning Path setup by making the following updates:

  • Run llama-server as a launchd service: Create a user LaunchAgent plist in ~/Library/LaunchAgents/. This starts your local Metal inference server automatically at login.
  • Connect local Model Context Protocol (MCP) servers to Hermes Agent: Attach MCP servers for local Git repositories, databases, or documentation search.
  • Experiment with larger models or speculative decoding: Test larger quantized models on 24 GB–64 GB Macs. You can also evaluate llama.cpp speculative decoding with draft models.