Hermes Agent Archive / Skills

Injecting Messages

From Official Docs · October 5, 2026

Plugins can inject messages into a CLI conversation or a known gateway session using ctx.inject_message() : Signature: ctx.inject_message(content: str, role: str = "user", *, session_key: str | None = None) -> bool In CLI mode: If the agent is idle (waiting for user input), the message is queued as the next input and starts a new turn. If the agent is mid-turn (actively running), the message interrupts the current operation - the same as a user typing a new message and pressing Enter. For non- "user" roles, the content is prefixed with [role] (e.g. [system] ... ). Returns True if the message was queued successfully. In gateway mode: session_key is required and must identify an existing gateway session. It is the stable routing key, not the CLI session ID. Hermes reuses that session's stored platform, chat, thread, profile, and conversation history. Plugins cannot supply a new chat route through this API. Hermes rechecks the stored route against the gateway's current authorisation rules before dispatch. Routes that relied only on an adapter-time or upstream authorisation decision are rejected unless Hermes can revalidate them from current core allowlists, pairing, or explicit allow-…

From the official Hermes Agent documentation.

# Active CLI conversation
ctx.inject_message("New data arrived from the webhook", role="user")

# Existing gateway conversation
ctx.inject_message(
    "New data arrived from the webhook",
    role="user",
    session_key="agent:main:telegram:dm:123456789",
)