Runtime

Agent Runtime

The top-level runtime object that connects CLI, desktop, gateways, cron, and transports to the agent loop.

Concept-specific field plateAgent Runtimehx-graph-context-concept-agent-runtimeLoading visual preview…
View full-size visual

Agent Runtime

What it is

The top-level runtime object that connects CLI, desktop, gateways, cron, and transports to the agent loop.

In plain terms

Each entrance to a building can have its own staffed desk while still sending work into the same back-office process. Hermes follows that pattern: CLI, gateway, and cron paths create separately configured AIAgent instances, then converge on the shared conversation machinery instead of sharing one live object.

Why it matters

Hermes reuses the AIAgent class and downstream turn-processing path across entry surfaces, but it does not reuse one AIAgent instance for every CLI command, gateway conversation, and cron run. Keeping that distinction clear explains how each surface can carry its own session, platform fields, callbacks, and credentials while still benefiting from common turn handling.

How it works

AIAgent (run_agent.py) is one Python class holding every configuration knob a turn might need: provider and model, streaming and tool-progress callbacks, and platform-identifying fields like platform, chat_id, and gateway_session_key. Its constructor is a thin forwarder into agent/agent_init.py, which does the real setup work. A CLI command, a scheduled entry in cron/scheduler.py, and a live connection handled by gateway/run.py each build their own AIAgent instance with different platform values and callbacks wired in, but from that point on every one of them calls the same agent.run_conversation(…) method to process a message — the object underneath doesn’t know or care which surface asked.

A concrete example

A user keeps a skill that drafts a weekly newsletter.

  1. Typing a request in the terminal makes hermes_cli build one AIAgent tied to that person’s session.
  2. Every Monday at 6am, cron/scheduler.py builds a second, separate AIAgent for the same skill with nobody watching, and calls run_conversation on it directly.
  3. Both objects then run through identical machinery afterward — same context assembly, same tool execution — so the draft comes back the same way whether a person triggered it or a timer did.

How it connects

This note belongs to the Runtime family. Its closest neighboring concepts are: Session State, Turn Loop, Personal OS.

Source evidence

  • vendor/hermes-agent/run_agent.py:1892-1902#AIAgent._flush_messages_to_session_db — Verified Source Map evidence for AIAgent. AIAgent uses thin forwarding methods to delegate system-prompt construction to agent.system_prompt.build_system_prompt, API kwargs construction to the chat-completion helper, and streaming requests to interruptible_streaming_api_call.

Workflows

  • No first-pass workflow mapping yet; this concept still appears in the vault graph through articles and source evidence.
  • Hermes Agent Explained: Why an Agent Harness Matters More Than Another Chat Window
  • Inside Hermes: How the Agent Loop, Context, Memory, Gateways, and Cron Jobs Work Together