Hermes Multi-Agent API Rate Limiting with flock

Preface

In Hermes multi-Agent collaborative tasks, I only have one Nous Portal account, 
and the gateways of these agents are independent, so it is possible that API requests are concentrated in a short period of time, and Nous Portal returns a 429 Too Many Requests error code.

Approach

Start the next request only after one API request is completed?
Assistant 2 discussing hermes plus flock file lock and 429 serialization

Use a separate process to control the rate of API requests?
Chat screenshot showing rate-control daemon design returning GO or WAIT based on last_request_time

Hermes (via mimo-v2-pro model) gave me a better implementation plan
Use flock file lock + status file:

~/.hermes/api_rate_limit  →  content: timestamp of the last request

When Gateway wants to call the API:
  flock(api_rate_limit.lock)
    read(last_time)
    if now - last_time >= interval:
      write(now)           ← Update timestamp
      unlock
      → Send API request
    else:
      wait_time = interval - (now - last_time)
      unlock
      sleep(wait_time)
      → Retry
No additional process is needed; each gateway just checks before calling the API. All agents share the same file, and flock ensures mutually exclusive read/write.

I ended up using the above solution.

It works pretty well.

======

Postscript


Compared with openclaw, all agents are in one openclaw system, you can see that multiple agent definitions are specified in one config.json.
So these agents are inherently connected to the same model provider. When using the same OAuth account, of course the global request rate can be controlled.


========

update

Github

========

Featured Recommendations


Comments