Skip to content

Entry & Boot Flow

源码版本v2026.7.20

Responsibility

Turn "a hermes command / a gateway message" into "an agent running in memory". The entry layer is deliberately thin — run_agent.py only forwards and assembles the CLI; the real dependency injection lives in agent_init.py. This way the gateway, TUI, CLI, ACP, and cron all share the same initialization path.

Key Files

Data Flow

  1. The user runs hermes (CLI) or the gateway main() starts (run_agent.py:22965).
  2. The process goes through hermes_bootstrap.py for path/environment fixes, then enters CLI main:6434 or the gateway loop.
  3. An AIAgent:400 instance is constructed; its __init__ forwards to init_agent:276.
  4. init_agent resolves providers, toolsets, compression thresholds, custom provider extra_body, etc., assembling a runnable agent object.
  5. The gateway holds this agent inside GatewayRunner in gateway/run.py and feeds each inbound message to run_conversation:588.

Summary

The entry layer is "forward + assemble" and holds no business logic. AIAgent is a thin shell; init_agent is the assembly center. Once you understand this chain, the Agent Main Loop is just "what happens when a message is fed in".

Unofficial community learning site. Content based on the MIT-licensed NousResearch/hermes-agent source.