This section covers advanced features and internal systems that extend Hermes Agent's capabilities beyond basic conversation loops. These topics are relevant for power users, system administrators, and developers working on the codebase.
For core agent functionality, see Core Agent. For tool configuration, see Tool System. For memory systems, see Memory and Sessions and Honcho Integration.
Context compression automatically manages conversation length by summarizing middle turns when approaching the model's token limit. This prevents context overflow errors and reduces API costs while preserving conversation continuity.
The compression system tracks actual token usage from API responses and triggers summarization when crossing a configurable threshold. It preserves the system prompt, recent turns, and conversation structure while condensing middle history into a summary message using a specialized handoff template SUMMARY_PREFIX agent/context_compressor.py95-122 The system enforces a "no-persistence-marker" invariant during compaction to ensure assembled messages are correctly flushed to the session database agent/context_compressor.py154-180
Context Compression Flow
Sources: agent/context_compressor.py95-122 agent/context_compressor.py154-180 agent/context_compressor.py252-261 agent/context_compressor.py365-410
The ContextCompressor class in agent/context_compressor.py202-250 handles all compression logic. It uses an auxiliary client via call_llm agent/context_compressor.py28 for summarization to avoid disrupting the main model's state.
| Property | Type | Description |
|---|---|---|
threshold_percent | float | Compression trigger threshold (default 0.85) agent/context_compressor.py220 |
protect_first_n | int | Number of initial turns to preserve (default 2) agent/context_compressor.py221 |
protect_last_n | int | Number of recent turns to preserve (default 2) agent/context_compressor.py222 |
Key Methods:
update_from_response(usage): Updates tracked token counts from API response agent/context_compressor.py252-261should_compress(): Returns True if last_prompt_tokens exceeds threshold agent/context_compressor.py263-273compress(messages): Orchestrates the full compression pipeline, including tool output pruning agent/context_compressor.py365-410Sources: agent/context_compressor.py202-410 agent/context_compressor.py28
For details, see Context Compression.
Provider runtime resolution determines which LLM provider and credentials to use at agent initialization time. This system supports multiple authentication methods, automatic fallbacks, and multi-credential pooling for same-provider failover.
The system resolves credentials during agent initialization via init_agent agent/agent_init.py9-13 It handles model-specific metadata fetching and autoraises agent/agent_init.py36-41 Error handling and smart failover are managed by the classify_api_error pipeline which maps errors to FailoverReason types agent/error_classifier.py30-31
Provider and Credential Space Mapping
Sources: agent/agent_init.py9-13 agent/context_compressor.py28-30 agent/error_classifier.py30-31 hermes_cli/runtime_provider.py101-140
The api_mode determines how messages and tool calls are formatted. The _detect_api_mode_for_url helper auto-detects transport requirements (e.g., codex_responses for OpenAI/xAI or anthropic_messages for direct Anthropic endpoints) based on the base URL hermes_cli/runtime_provider.py101-140 The system strips internal metadata like _compressed_summary agent/context_compressor.py138 or _db_persisted agent/context_compressor.py140 before sending requests to strict providers agent/context_compressor.py130-137
Sources: hermes_cli/runtime_provider.py101-140 agent/context_compressor.py130-140
For details, see Provider Runtime Resolution.
The cron system allows scheduling arbitrary agent tasks with platform-specific delivery. Jobs run unattended and can send results to any configured messaging platform via the gateway.
Scheduled tasks are managed via the GatewayRunner gateway/run.py7 and integrated with the scheduler. This allows for persistent goals and periodic check-ins. The Chronos NAS-mediated cron provider plugin supports scale-to-zero hosted agents.
Sources: gateway/run.py7
For details, see Cron and Scheduled Tasks.
Hermes provides built-in diagnostic commands for troubleshooting configuration, connectivity, and system state.
hermes doctor: Checks configuration and dependencies hermes_cli/main.py20hermes status: Shows status of all components hermes_cli/main.py16check_compression_model_feasibility: A startup probe that warns if the auxiliary compression model's context window is smaller than the main model's compression threshold agent/conversation_compression.py5-9Sources: hermes_cli/main.py16 hermes_cli/main.py20 agent/conversation_compression.py5-9
For details, see Diagnostic Tools.
Hermes integrates with Language Server Protocol (LSP) for semantic diagnostics and provides a computer_use tool for macOS desktop control.
The LSP integration in agent/lsp/ wires semantic diagnostics (e.g., pyright, gopls, rust-analyzer) into the write_file and patch tools to ensure code quality during agentic edits.
The computer_use tool enables Hermes to control the macOS desktop via cua-driver, allowing clicking, typing, and screenshot interaction for GUI-based tasks.
For details, see LSP and Computer Use.
The Agent Client Protocol (ACP) allows Hermes to be used as a backend for IDEs like VS Code and Zed.
For details, see ACP Server and IDE Integration.
Hermes supports a plugin-based architecture for extending both context management and memory capabilities.
The MemoryProvider abstract base class defines the interface for different memory backends. The init_agent function handles the bootstrap of these components, including the StreamingContextScrubber and StreamingThinkScrubber agent/agent_init.py33-44
Sources: agent/agent_init.py33-44
The system discovers and loads plugins to extend functionality. The ContextEngine plugin architecture allows for swapping compression backends and managing external memory contexts agent/context_compressor.py29-30
Sources: agent/context_compressor.py29-30
For details, see Plugins and Memory Providers.
Hermes Agent supports internationalization to provide a localized user experience across its CLI and gateway interfaces.
locales/ directory.For details, see Internationalization (i18n).
Refresh this wiki
This wiki was recently refreshed. Please wait 4 days to refresh again.