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
Every elevator call button in a building — the one in the lobby, the one on the fifth floor, the one by the loading dock — reaches into the exact same elevator control system, whichever button happens to get pressed. In Hermes, a terminal session, the desktop app, a Telegram chat, and a 3am cron job all reach into that same shared machinery, one AIAgent object, rather than each running its own separate setup.
Why it matters
Every entry point into Hermes — CLI commands, the desktop app, a gateway connection, a cron trigger — talks to the same AIAgent object rather than maintaining its own execution path. That shared core is what lets a skill built for a Telegram conversation work unmodified inside a scheduled cron job or a subagent delegation. Without this unification, adding a new surface would mean re-implementing turn handling instead of wiring into one runtime.
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.
- Typing a request in the terminal makes hermes_cli build one AIAgent tied to that person’s session.
- 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.
- 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 toagent.system_prompt.build_system_prompt, API kwargs construction to the chat-completion helper, and streaming requests tointerruptible_streaming_api_call.
Workflows
- No first-pass workflow mapping yet; this concept still appears in the vault graph through articles and source evidence.
Related articles
- No article currently mentions this concept by name/alias often enough to qualify (see mention-mining policy).
