Model Call
What it is
The moment Hermes sends the constructed context to the selected model provider.
In plain terms
Think of dropping a letter into a mailbox: you don’t need to know or care which truck, plane, or courier actually carries it to its destination — you just seal the envelope, drop it in, and it’s gone. The model call is that same handoff point: everything Hermes has gathered gets packaged up and sent off to whichever AI provider is currently switched on, without the rest of the conversation loop needing to know or care which one.
Why it matters
Everything assembled during turn context — history, memory, tools, guardrails — funnels toward one narrow moment: the actual request sent to whichever provider is currently configured, local or hosted. Keeping that boundary explicit is what lets a provider get swapped mid-project without touching the turn loop itself, only the routing configuration. It’s also the point retry-and-fallback logic watches closest, since provider timeouts and rate limits surface here before anywhere else in the turn.
How it works
Once the turn loop is ready to ask the model something, build_api_kwargs (agent/chat_completion_helpers.py) assembles the actual request — messages, tools, token limits, reasoning settings — shaped to whichever transport is active: OpenAI-style chat completions, Anthropic’s native Messages API, AWS Bedrock’s Converse API, or Codex-style Responses. Before anything goes out, request middleware gets first crack at rewriting it; a pre_api_request plugin hook then fires with the now-final request, but that hook can only observe it, not change it (agent/conversation_loop.py). Hermes prefers to stream the reply back even when nothing is listening for live text, because streaming gives it fine-grained health checks — a stale-stream timer and a read timeout — that a plain, blocking request can’t provide, catching a connection that’s gone quiet before the whole turn stalls.
A concrete example
A user has Hermes configured against Claude through an OAuth-authenticated Anthropic connection. Mid-project, they switch the base URL to a local llama.cpp server instead. The turn loop doesn’t change at all — it still assembles the same conversation history and tool list — but the model call step now builds OpenAI-style kwargs instead of Anthropic Messages kwargs and opens a stream to the new endpoint. The user notices only that responses now come from the local model; everything upstream of that one request-building step stayed identical.
How it connects
This note belongs to the Runtime family. Its closest neighboring concepts are: Turn Finalizer, Retry And Fallback, 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).
