Engineering
Hermes Agent untuk Lanjut: Arsitektur, Security, Enterprise, dan Performance
Level: Advanced / Expert | Bahasa: Indonesia | Prerequisites: Artikel Pemula dan Menengah
Level: Advanced / Expert | Bahasa: Indonesia | Prerequisites: Artikel Pemula dan Menengah Terakhir diperbarui: Juli 2026
Artikel ini membahas Hermes Agent dari perspektif expert β arsitektur internal, custom provider, skill development lanjutan, plugin architecture, MCP advanced, multi-agent orchestration, automation, memory management, security hardening, performance optimization, dan enterprise deployment. Jika Anda belum familiar dengan dasar-dasar Hermes, baca artikel Pemula dan Menengah terlebih dahulu. Artikel ini tidak mengulang konsep dasar; langsung masuk ke materi expert.
Daftar Isi
- Bagian I: Fondasi Teknis 1. Arsitektur Internal Hermes Agent 2. Custom Provider & Model Integration 3. Skill Development Lanjutan 4. Plugin Architecture & Development
- Bagian II: Advanced Integration 5. MCP Advanced Usage 6. Multi-Agent Orchestration 7. Automation & CI/CD Integration
- Bagian III: Operasional & Enterprise 8. Advanced Memory Management 9. Security Hardening 10. Performance & Scaling 11. Enterprise Patterns
Bagian I: Fondasi Teknis (Tier 2)
1. Arsitektur Internal Hermes Agent
Hermes Agent dibangun atas arsitektur tiga-tier yang berpusat pada kelas AIAgent sebagai orchestration engine utama. Pemahaman mendalam tentang arsitektur ini adalah kunci untuk mengoptimalkan, meng-debug, dan memperluas Hermes di lingkungan production. Tanpa memahami bagian ini, Anda tidak bisa melakukan troubleshoot yang efektif atau membangun integrasi tingkat lanjut.
Arsitektur Tiga-Tier
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Presentation Layer β
β CLI β TUI β Dashboard β Gateway (Telegram/Slack/...) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Orchestration Layer β
β AIAgent (run_agent.py) β
β Prompt Assembly β Provider β Parse β Execute β Loop β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Tool & Extension Layer β
β Tool Registry β Skills β Plugins β MCP Servers β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Presentation Layer menerima input dari berbagai gateway β CLI, TUI, Dashboard, Telegram, Discord, Slack, dan WhatsApp. Setiap gateway memiliki adapter yang men-normalize input ke format yang dipahami AIAgent. Gateway juga menangani output formatting dan delivery (misalnya mengirim response ke channel Slack yang tepat).
Orchestration Layer adalah inti dari seluruh sistem. Kelas AIAgent di run_agent.py menangani seluruh siklus: konstruksi prompt, seleksi provider, parsing response, eksekusi tool, dan loop hingga selesai. File ini adalah file terbesar dalam codebase dan paling kritis.
Tool & Extension Layer menyediakan registri tool yang terpisah dari agent loop. Tool registry di-import oleh semua tool files (tools/registry.py), memungkinkan ekstensibilitas tanpa mengubah core agent. Skills, plugins, dan MCP servers semuanya berinteraksi melalui layer ini.
Prompt Processing Pipeline Detail
Ketika Anda mengirim sebuah prompt, berikut adalah pipeline lengkap yang terjadi di balik layar:
- User input masuk melalui gateway (CLI/TUI/Dashboard/Slack/Telegram)
AIAgentmembangun system prompt dari gabungan empat komponen: -SOUL.mdβ personality dan base instructions - Active skills β procedural memory yang relevan dengan task - Memory context β episodic memory dari session sebelumnya - Workspace instructions (AGENTS.md) β konteks project spesifik- Conversation history di-append ke prompt secara incremental
ContextCompressordipanggil jika total token melebihi budget β compressor mempartisi conversation menjadi segments, menjalankan summarization pada segment lama, dan mempertahankan segment terbaru- Request dikirim ke provider melalui transport abstraction layer
- Response diparsed β Hermes mendukung 11 format tool-call parser berbeda untuk kompatibilitas lintas provider
- Tool calls dieksekusi secara sequential atau parallel tergantung konfigurasi
- Results di-append ke conversation, dan loop berlanjut hingga agent selesai atau mencapai batas iterasi
Struktur Direktori ~/.hermes/
~/.hermes/
βββ config.yaml # Konfigurasi utama (provider, model, features)
βββ .env # Environment variables (API keys, tokens)
βββ SOUL.md # System prompt / personality definition
βββ memories/ # Persistent memory (Markdown files per profile)
βββ skills/ # Procedural memory (skill documents)
βββ plugins/ # Python plugin packages
βββ sessions/ # Conversation history per session
βββ profiles/ # Isolated profile directories
βββ cron/ # Scheduled task definitions
βββ mcp_servers.yaml # MCP server configurations
βββ hermes-agent/ # Git checkout of hermes-agent repo
Setiap komponen dalam direktori ini memiliki peran spesifik dan saling berinteraksi. Misalnya, config.yaml mengontrol provider mana yang digunakan, SOUL.md menentukan personality agent, skills/ mempengaruhi bagaimana agent mengeksekusi task, dan memories/ memungkinkan agent mengingat konteks lintas session.
Context Window Management
Context management adalah salah satu tantangan terbesar dalam agent-based systems. Hermes menanganinya melalui ContextCompressor yang terletak di agent/context_compressor.py. Strategi kompresi meliputi: summarize old turns (menggunakan model yang lebih murah), drop low-signal messages (pesan yang tidak menambah konteks), dan preserve tool results (output tool tetap dipertahankan karena kritis untuk kontinuitas task).
TrajectoryCompressor di trajectory_compressor.py menangani post-processing untuk training data β mempertahankan training signal quality sambil fitting ke target token budget. Ini khususnya relevan jika Anda menggunakan Hermes untuk menghasilkan training data.
Gotchas yang perlu diwaspadai:
ContextCompressorbisa kehilangan nuansa penting jikatarget_tokensterlalu agresif β setel minimal 40% darimax_tokens. Misalnya, jikamax_tokensadalah 200000, settarget_tokensminimal 80000- Provider transport abstraction punya edge cases saat switching antar format (Anthropic messages vs OpenAI chat completions)
/v1bisa ter-stripped daribase_urlsaat switching provider β ini known bug yang perlu diwaspadai saat konfigurasi custom providerrun_agent.pyadalah file yang sangat besar β sulit di-navigate tanpa IDE yang baikContextCompressorjuga bisa kehilangan konteks teknis penting seperti error messages dan stack traces jikapreserve_tool_resultstidak disetel ketrue
2. Custom Provider & Model Integration
Hermes mendukung 20+ provider melalui abstraksi transport layer. Setiap provider terhubung melalui salah satu dari empat concrete transport: AnthropicTransport, ChatCompletionsTransport, ResponsesApiTransport, atau BedrockTransport. Pemahaman tentang transport abstraction memungkinkan Anda mengintegrasikan provider yang bahkan belum didukung secara resmi.
Provider Matrix
| Provider | Transport | Notes |
|---|---|---|
| Nous Portal | ChatCompletions | First-class, 400+ model tersedia |
| OpenRouter | ChatCompletions | Aggregator, sub-provider routing |
| OpenAI | ChatCompletions / ResponsesAPI | Direct API, dua transport |
| Anthropic | AnthropicTransport | Native messages format |
| AWS Bedrock | BedrockTransport | IAM authentication |
| Ollama | ChatCompletions | Lokal, http://localhost:11434 |
| vLLM | ChatCompletions | Self-hosted inference |
| OpenAI-compatible | ChatCompletions | Custom base_url |
Credential Pools & Rotation Strategies
Untuk production environment, credential pools memungkinkan rotasi API key otomatis β ini krusial untuk menghindari rate limiting dan meningkatkan availability. Dua strategi rotasi tersedia: round-robin (menggilir key secara berurutan) dan least-used (memilih key yang paling jarang digunakan).
# ~/.hermes/config.yaml
credential_pools:
openrouter:
- api_key: sk-or-key-1
- api_key: sk-or-key-2
- api_key: sk-or-key-3
anthropic:
- api_key: sk-ant-key-a
- api_key: sk-ant-key-b
credential_pool_strategies:
openrouter: round_robin
anthropic: least_used
Provider Routing & Model Fallback
Model routing memungkinkan Anda menggunakan model berbeda untuk task berbeda β model cepat dan murah untuk task ringan, model powerful untuk task kompleks. Fallback memastikan availability tinggi ketika primary provider gagal.
# ~/.hermes/config.yaml
model:
default: anthropic/claude-sonnet-4 # Primary model untuk task kompleks
fast: openai/gpt-4.1-mini # Untuk task ringan (summarization, classification)
fallback: openai/gpt-4.1 # Fallback jika primary gagal
provider_routing:
order:
- anthropic
- openai
- google
allow_fallbacks: true
Ollama Integration (Model Lokal)
Menjalankan model lokal melalui Ollama memberikan kontrol penuh atas data dan menghilangkan dependency pada API eksternal. Namun, tidak semua model lokal mendukung tool calling β pastikan model yang Anda pilih memiliki capability tersebut.
# Install dan pull model
ollama pull hermes3:70b
# Konfigurasi di ~/.hermes/config.yaml
provider: ollama
model:
default: hermes3:70b
base_url: http://localhost:11434
Parameter Tuning
# ~/.hermes/config.yaml
parameters:
temperature: 0.7 # Kreativitas (0.0-1.0)
max_tokens: 4096 # Max output tokens per response
top_p: 0.9 # Nucleus sampling threshold
Gotchas:
- Ollama perlu model yang support tool calling β tidak semua model lokal mendukungnya, cek dokumentasi model sebelum deploy
- Credential pool rotation tidak menangani rate limit per-key secara otomatis β perlu monitoring manual
- BedrockTransport memerlukan IAM credentials β setup lebih kompleks dibanding provider lain
base_urlbisa ter-stripped dari/v1saat switching provider format β known bug
3. Skill Development Lanjutan
Skills adalah procedural memory dalam bentuk Markdown yang di-inject ke system prompt. Berbeda dari plugin (Python code), skills adalah structured instructions yang guide agent behavior tanpa menambah code execution. Skill development lanjutan mencakup conditional logic, error handling, chaining, dan testing strategies.
Skill Lifecycle Lengkap
Create β Load from disk β Inject to system prompt β Agent follows instructions
β Agent optionally improves skill via skill_manage tool β Save back to disk
Agent memiliki akses ke skill_manage tool yang memungkinkannya membuat, meng-update, menghapus, dan mencari skill secara otonom. Skill juga bisa diinstall dari Skills Hub (hermes-agent.nousresearch.com/skills/) yang berisi registry skill dari komunitas. Standar agentskills.io memastikan kompatibilitas lintas agent.
Advanced Skill Document dengan Conditional Logic
Berikut adalah contoh skill yang menunjukkan fitur-fitur lanjutan β conditional logic, error handling, dan structured output:
# Skill: Advanced Code Review
## When to Use
- User asks for code review on PR or diff
- Detecting security vulnerabilities in codebase
- Performance optimization suggestions needed
## Prerequisites
- Must have access to git repository
- Requires `gh` CLI for GitHub integration
- Git repository must be on a branch with changes
## Steps
1. Run `git diff main...HEAD` to get all changes
2. For each changed file:
a. Analyze code patterns and architecture decisions
b. Check for security issues (SQL injection, XSS, auth bypass)
c. Evaluate performance implications (N+1 queries, memory leaks)
3. Generate structured report with severity levels
## Error Handling
- If git diff fails: fall back to `git log --oneline -20`
- If file is binary: skip and note in report
- If GitHub API rate limited: use local git only
## Conditional Logic
- IF changes include Dockerfile: also run container security scan
- IF changes include migrations: verify rollback safety
- IF more than 50 files changed: delegate to subagent per directory
- IF changes affect auth module: require manual approval
## Output Format
- Severity: Critical/High/Medium/Low
- File path and line numbers for each finding
- Suggested fix with code example
- Overall risk score (1-10)
Skill Chaining Pattern
Skill chaining memungkinkan Anda membangun workflow multi-step yang kompleks, di mana setiap step menghasilkan output yang menjadi input step berikutnya:
# Skill: Multi-Step Research Pipeline
## Chain Definition
1. **[deep-research]** β Gather information from multiple sources
2. **[fact-check]** β Verify claims against authoritative sources
3. **[summarize]** β Create executive summary
4. **[publish]** β Format and save to output directory
## Handoff Protocol
- Each step outputs to /tmp/research-step-N.md
- Next step reads previous output as input context
- On failure: retry once, then skip and note gap in final report
## Quality Gates
- Step 1 must find at least 3 sources β otherwise abort
- Step 2 must verify 80%+ claims β otherwise re-run with broader search
- Step 3 summary must be under 500 words β otherwise re-summarize
Testing Skill Secara Terisolasi
Sebelum deploy skill ke production, test secara terisolasi menggunakan profile terpisah:
# Test skill dengan dedicated profile
hermes profile create skill-test
hermes --profile skill-test chat "Test: gunakan skill code-review pada file test.py"
# Atau dengan workspace target yang terisolasi
hermes --workspace-target /tmp/test-project chat "Review this code using advanced-review skill"
Best Practices untuk Production:
- Jaga skill di bawah 2000 token β skill terlalu panjang memakan context window dan mengurangi ruang untuk task aktual
- Gunakan external skill directories untuk team sharing: point ke folder skill tambahan di luar
~/.hermes/skills/ - Skill yang diinstall dari Hub otomatis melalui pipeline security scanning
- Agent bisa meng-overwrite skill yang dibuat user jika diminta "improve" β gunakan explicit naming untuk mencegah ini
- Skill chaining memerlukan koordinasi manual antar step β tidak ada built-in orchestration engine
4. Plugin Architecture & Development
Plugin adalah Python packages yang bisa register custom tools, lifecycle hooks, memory providers, context compression engines, dashboard tabs, gateway platforms, dan provider backends. Berbeda dari skills (Markdown yang di-inject ke prompt), plugins adalah full Python code yang berinteraksi langsung dengan internal agent state melalui PluginContext.
Plugin Categories
Hermes mendukung empat kategori plugin: General plugins (custom tools dan hooks), Provider backends (custom LLM providers), Gateway platforms (custom messaging integrations), dan Image/Video generation backends (custom media generation).
Plugin dengan Lifecycle Hooks
# ~/.hermes/plugins/audit_plugin.py
from hermes.plugins import Plugin, PluginContext
import json
class AuditPlugin(Plugin):
def __init__(self, ctx: PluginContext):
self.ctx = ctx
# Register custom tool yang tersedia untuk agent
ctx.register_tool(
name="custom_audit_search",
description="Search audit logs by keyword",
parameters={"query": {"type": "string"}},
handler=self.search_logs
)
# Subscribe ke lifecycle hooks
ctx.on("before_prompt", self.log_prompt)
ctx.on("on_tool_call", self.log_tool_call)
ctx.on("after_response", self.log_response)
ctx.on("on_error", self.log_error)
ctx.on("on_shutdown", self.cleanup)
def log_prompt(self, prompt: str) -> str:
"""Intercept prompt sebelum dikirim ke LLM"""
with open("/var/log/hermes/audit.log", "a") as f:
f.write(f"PROMPT: {prompt[:200]}...\n")
return prompt # Return modified atau original prompt
def log_tool_call(self, tool_name: str, args: dict):
"""Intercept setiap tool call"""
with open("/var/log/hermes/audit.log", "a") as f:
f.write(f"TOOL: {tool_name} ARGS: {json.dumps(args)[:500]}\n")
def log_response(self, response: str) -> str:
"""Post-process LLM response sebelum dikirim ke user"""
with open("/var/log/hermes/audit.log", "a") as f:
f.write(f"RESPONSE: {response[:200]}...\n")
return response
def log_error(self, error: Exception):
"""Handle errors dalam agent loop"""
with open("/var/log/hermes/audit.log", "a") as f:
f.write(f"ERROR: {str(error)}\n")
def cleanup(self):
"""Cleanup saat agent shutdown"""
pass
def search_logs(self, query: str):
"""Custom tool implementation"""
return {"results": [], "query": query}
Custom Memory Provider
Plugin bisa menyediakan memory provider alternatif β misalnya menggunakan PostgreSQL atau vector database:
from hermes.plugins import MemoryProvider
class PostgresMemoryProvider(MemoryProvider):
def store(self, key: str, value: str, metadata: dict):
"""Store memory entry ke PostgreSQL"""
# Implementation: INSERT INTO memories (key, value, metadata, created_at)
pass
def retrieve(self, query: str, limit: int = 5) -> list:
"""Retrieve relevant memories dengan semantic search"""
# Implementation: SELECT * FROM memories ORDER BY similarity(query, value) LIMIT N
pass
def search(self, query: str) -> list:
"""Full-text search across memories"""
# Implementation: SELECT * FROM memories WHERE value @@ plainto_tsquery(query)
pass
Config-Driven Extensions (Tanpa Python)
Untuk integrasi sederhana, Anda tidak perlu menulis Python plugin β cukup konfigurasi di config.yaml:
# ~/.hermes/config.yaml
tts:
command: "edge-tts --voice id-ID-ArdiNeural"
stt:
command: "whisper --model base"
shell_hooks:
on_file_change: "eslint --fix $FILE"
Gotchas:
- Plugin API berubah antar versi β pin compatibility dan test thoroughly sebelum upgrade
- Plugin yang crash bisa meng-kill seluruh agent process β gunakan try/except di semua hook handler
- Config-driven extensions lebih stabil daripada Python plugins untuk production
- Memory provider plugins perlu handle concurrent access dari multiple profiles
- Plugin discovery otomatis dari
~/.hermes/plugins/β pastikan__init__.pyada
Bagian II: Advanced Integration (Tier 1)
// Advertisement
5. MCP Advanced Usage
Model Context Protocol (MCP) memungkinkan Hermes terhubung ke external tool servers. Hermes berfungsi sebagai MCP client yang auto-discovers tools dari server dan meregistrasikannya alongside built-in tools. Mendukung tiga transport: stdio (local process), SSE (HTTP/Server-Sent Events), dan Streamable HTTP. Advanced usage mencakup custom MCP server creation, multi-server orchestration, tool filtering, dan debugging.
Multi-Server MCP Configuration
Konfigurasi berikut menunjukkan bagaimana menghubungkan Hermes ke beberapa MCP server secara simultan β masing-masing dengan tool filtering yang berbeda:
# ~/.hermes/mcp_servers.yaml
servers:
# Server 1: GitHub integration via stdio
github:
command: npx
args: ["-y", "@modelcontextprotocol/server-github"]
env:
GITHUB_TOKEN: ${GITHUB_TOKEN}
tools:
allow:
- create_issue
- list_repos
- create_pull_request
block:
- delete_repo # Blokir operasi berbahaya
# Server 2: Database access via SSE
database:
url: "https://mcp-db.example.com/sse"
headers:
Authorization: Bearer ${DB_TOKEN}
tools:
allow:
- query
- insert
block:
- drop_table # Blokir DDL destructive
- truncate
# Server 3: Internal API via Streamable HTTP
internal_api:
url: "https://internal.example.com/mcp"
transport: streamable-http
headers:
X-API-Key: ${INTERNAL_API_KEY}
Membuat Custom MCP Server
Membangun MCP server sendiri memungkinkan Anda mengekspos internal tools dan resources ke Hermes. Berikut contoh MCP server yang mengekspos codebase analysis dan security scanning:
# my_mcp_server.py
from mcp import Server
import os
server = Server("my-custom-tools")
@server.tool()
async def analyze_codebase(path: str) -> dict:
"""Analyze codebase structure and quality metrics"""
files = []
for root, dirs, filenames in os.walk(path):
for f in filenames:
if f.endswith('.py'):
files.append(os.path.join(root, f))
return {
"total_python_files": len(files),
"files": files[:20], # Limit output untuk mencegah overwhelming context
"directories": len(set(os.path.dirname(f) for f in files))
}
@server.tool()
async def run_security_scan(target: str) -> dict:
"""Run security vulnerability scan pada target path"""
# Implementation: integrate dengan bandit, safety, atau custom scanner
return {"vulnerabilities": [], "score": 95}
@server.resource("config://app")
async def get_app_config():
"""Expose application configuration sebagai MCP resource"""
return {"version": "1.0", "env": "production"}
if __name__ == "__main__":
server.run(transport="stdio")
MCP Management Commands
# Tambahkan server ke config
# Edit ~/.hermes/mcp_servers.yaml
# List semua connected MCP servers
hermes mcp list
# List semua tools dari semua servers
hermes mcp tools
# Test koneksi ke specific server
hermes mcp test <server-name>
# Debug MCP communication
hermes --log-level debug mcp list
Troubleshooting MCP
| Masalah | Kemungkinan Penyebab | Solusi |
|---|---|---|
| Server tidak start | Command/args salah di config | Cek mcp_servers.yaml syntax dan path |
| Tools tidak muncul | Allow/block list memblokir | Periksa filter di config, cek hermes mcp tools |
| Permission denied | Env variables tidak ter-set | Cek ${VAR} di config, pastikan .env ter-load |
| Timeout | Network issue untuk remote server | Cek connectivity; gunakan stdio untuk lokal |
| Server crash | Unhandled exception di server code | Cek server logs; tambahkan error handling |
Gotchas:
hermes mcp servehanya mendukung stdio β untuk HTTP MCP server, perlu adapter terpisah- MCP server yang crash tidak auto-restart β gunakan process manager seperti systemd atau supervisor
- Tool filtering (allow/block) hanya di client side β server masih expose semua tools ke semua client
- Streamable HTTP transport lebih baru β beberapa MCP server belum support
- MCP sampling memungkinkan server meminta LLM calls nested β potensi security concern yang perlu di-mitigate
6. Multi-Agent Orchestration
Hermes mendukung multi-agent orchestration melalui delegate_task tool yang spawn isolated child agents. Setiap subagent punya conversation, terminal session, dan toolset sendiri. Hanya final summary yang kembali ke parent β intermediate tool calls tidak masuk context window parent, yang menghemat token secara signifikan.
Pola Multi-Agent
Supervisor Pattern β Parent menganalisis task, decompose menjadi subtasks, delegate ke specialized subagents, dan sintesize results:
Parent Agent (Supervisor)
βββ Subagent A: Research task
βββ Subagent B: Code implementation
βββ Subagent C: Testing & validation
βββ Subagent D: Documentation writing
Parallel Research Pattern β Multiple subagents meneliti topik berbeda secara simultan, results digabung di akhir.
Pipeline Pattern β Output dari satu subagent menjadi input subagent berikutnya, membentuk processing pipeline:
Stage 1: Data Collection (Subagent A)
β output file
Stage 2: Analysis (Subagent B)
β output file
Stage 3: Report Generation (Subagent C)
Batch Delegation dengan Tool Restrictions
Parent bisa membatasi tools yang tersedia untuk subagent β ini krusial untuk security dan fokus:
# Single delegation dengan restricted toolset
delegate_task(
task="Analyze the security vulnerabilities in /src/auth/ directory",
context="Focus on SQL injection, XSS, and authentication bypass patterns",
tools=["terminal", "read_file", "search_files"], # Hanya tools yang diperlukan
output_file="/tmp/security-analysis.md"
)
# Parallel batch delegation β multiple tasks sekaligus
delegate_task(
tasks=[
{"task": "Review PR #42 for performance issues", "context": "Focus on N+1 queries and memory usage"},
{"task": "Review PR #43 for security vulnerabilities", "context": "Focus on auth and input validation"},
{"task": "Review PR #44 for code style", "context": "Focus on naming conventions and structure"}
],
parallel=True
)
Multi-Instance dengan Profiles
Untuk task yang benar-benar independent, jalankan multiple agent instances dengan profile terpisah:
# Parallel instances dengan profile terpisah
hermes --profile coding-assistant chat "Fix the bug in auth.py" &
hermes --profile researcher chat "Research latest security best practices" &
hermes --profile reviewer chat "Review the open PRs" &
Error Recovery Strategy
Multi-agent systems perlu error handling yang robust:
- Subagent failure tidak crash parent β parent menerima error summary dan bisa mengambil keputusan
- Parent bisa retry dengan parameter berbeda atau delegate ke subagent lain
- Timeout per subagent configurable β prevent hanging tasks yang menghabiskan resource
- Parent bisa fallback ke single-agent mode jika delegation repeatedly fails
Gotchas:
- Subagent tidak share state dengan parent β perlu explicit handoff via files di filesystem
- Parallel delegation bisa habiskan token budget cepat β setiap subagent punya full conversation sendiri
- Terminal session isolation berarti subagent tidak bisa akses parent's working directory changes
- Progress reporting di messaging gateway bisa spammy jika banyak subagents berjalan bersamaan
7. Automation & CI/CD Integration
Hermes punya built-in cron scheduler dan webhook platform untuk automation. Cron jobs mendukung natural language dan cron expressions, dengan skill attachment dan multi-platform delivery. CI/CD integration memungkinkan Hermes berjalan dalam GitHub Actions dan GitLab CI sebagai automated code reviewer, tester, dan deployer.
Advanced Cron Configuration
# Membuat cron job via agent conversation
cronjob(
action="create",
name="daily-security-scan",
schedule="0 9 * * 1-5", # Weekdays at 9am
prompt="Run security scan on /src directory, save report to /tmp/security-report.md, and send summary to Slack #security channel",
skills=["code-review", "security-scan"],
delivery="slack:#security"
)
# Edit jadwal dan prompt
cronjob(
action="edit",
name="daily-security-scan",
schedule="0 8 * * *", # Ubah ke 8am setiap hari
prompt="Updated prompt dengan instruksi baru..."
)
# Trigger manual run untuk testing
cronjob(action="trigger", name="daily-security-scan")
# Pause dan resume tanpa menghapus konfigurasi
cronjob(action="pause", name="daily-security-scan")
cronjob(action="resume", name="daily-security-scan")
GitHub Actions Integration
# .github/workflows/hermes-review.yml
name: Hermes Code Review
on:
pull_request:
types: [opened, synchronize]
permissions:
contents: read
pull-requests: write
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history untuk diff analysis
- name: Install Hermes
run: |
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
- name: Run Review
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
hermes chat "
Review the changes in this PR.
Focus on: security, performance, code quality.
Post review comments on the PR.
Save detailed report to review-report.md.
" --workspace-target $GITHUB_WORKSPACE
- name: Upload Report
uses: actions/upload-artifact@v4
with:
name: review-report
path: review-report.md
Long-Running Background Tasks
# Jalankan task di background
hermes --background chat "Research and compile report on AI safety trends 2026"
# Monitor progress
hermes jobs list
hermes jobs status <job-id>
# Notification otomatis saat selesai
Automation Blueprints β copy-paste patterns untuk common workflows:
- Daily digest: Monitor sources β compile β deliver ke Slack/Email
- Code quality pipeline: Scan β analyze β report β suggest fixes
- Content pipeline: Research β draft β review β publish
- Monitoring: Check services β alert on anomalies
Gotchas:
- Cron jobs berjalan di process yang sama dengan interactive session β bisa interfere satu sama lain
- Natural language scheduling kadang salah interpret β lebih aman pakai cron expression eksplisit
- GitHub Actions integration perlu API key management yang hati-hati β gunakan GitHub Secrets
- Long-running tasks bisa timeout jika provider rate-limited
- Webhook-triggered actions perlu input validation untuk prevent prompt injection
Bagian III: Operasional & Enterprise (Tier 3)
8. Advanced Memory Management
Hermes memiliki sistem memory persisten yang menyimpan pengetahuan lintas session dalam format Markdown. Setiap profile punya memories terpisah, memungkinkan isolasi konteks antar use case. Sistem mendukung multiple memory providers dan context compression untuk mengelola token budget secara efektif.
Dual Memory Model
Hermes menggunakan dua jenis memory yang saling melengkapi:
- Procedural Memory (Skills): Pengetahuan tentang cara melakukan sesuatu β di-inject ke system prompt sebagai instruksi
- Episodic Memory (Memories): Pengetahuan dari pengalaman β disimpan sebagai Markdown files di
~/.hermes/memories/dan di-retrieve berdasarkan relevansi
Memory Provider Options
| Provider | Tipe | Kelebihan | Kekurangan |
|---|---|---|---|
| SQLite + FTS5 | Local DB | Default, zero-config, cepat | Tidak ada semantic search |
| Honcho | AI-native | Cross-session user modeling, semantic | Perlu API key, external dependency |
| mem0 | Vector DB | Semantic search, scalable | Setup lebih kompleks |
| holographic | Experimental | Research-grade | Kurang stabil |
Memory Provider Configuration
# ~/.hermes/config.yaml
memory:
provider: honcho # Options: sqlite, honcho, mem0, holographic, byterover, retaindb
sqlite:
path: ~/.hermes/memory.db
fts5: true # Full-text search enabled
honcho:
api_key: ${HONCHO_API_KEY}
user_id: "default"
retention:
max_entries: 10000
auto_cleanup: true
cleanup_threshold: 9000 # Cleanup saat entries melebihi ini
Context Compression Configuration
# ~/.hermes/config.yaml
context:
max_tokens: 200000
auto_compact: true
compression:
strategy: summarize # Options: summarize, drop, sliding_window
model: openai/gpt-4.1-mini # Model murah untuk kompresi
target_tokens: 50000 # Target setelah kompresi
preserve_tool_results: true # Jangan summarize tool outputs β kritis untuk kontinuitas
preserve_recent: 10 # Preserve 10 most recent messages
Memory Maintenance
hermes memory stats # Lihat statistik memory
hermes memory export --output memories-backup.md # Export untuk backup
hermes memory import --input memories-backup.md # Import dari backup
hermes memory cleanup --older-than 30d # Cleanup entries lama
Gotchas:
- Memory files bisa jadi sangat besar seiring waktu β perlu periodic cleanup
- Context compression bisa kehilangan nuansa β
preserve_tool_results: truepenting untuk task teknis - Cross-profile memory sharing tidak tersedia secara built-in β perlu manual export/import
- Memory provider switching tidak migrate data otomatis β perlu manual migration
- FTS5 search kurang efektif untuk semantic search β pertimbangkan Honcho atau mem0
9. Security Hardening
Hermes memiliki 7-layer defense model yang mencakup approval workflows, sandboxing, credential protection, prompt injection defenses, dan access controls. Lima sandbox backend tersedia: local, Docker, SSH, Singularity, dan Modal.
7-Layer Defense Model
Layer 1: Approval Workflows β Agent minta approval untuk destructive operations
Layer 2: Sandboxing β Isolated execution environment (Docker, SSH, dll.)
Layer 3: Credential Protection β .env files, env vars, credential pools
Layer 4: Prompt Injection Defense β Input validation dan sanitization
Layer 5: Access Controls β Tool filtering, restricted toolsets per profile
Layer 6: Audit Logging β Semua tool calls dan operations di-log
Layer 7: Network Isolation β Domain allowlist/blocklist, proxy configuration
Security Configuration
# ~/.hermes/config.yaml
security:
approval:
require_for:
- file_delete
- network_request
- credential_access
- destructive_git_ops
auto_approve:
- file_read
- search
- non-destructive_commands
sandbox:
backend: docker # Options: local, docker, ssh, singularity, modal
docker:
image: "hermes/sandbox:latest"
network: "none" # Network isolation
read_only: true # Read-only filesystem
memory_limit: "512m"
cpu_limit: "1.0"
network:
allowed_domains:
- "api.openai.com"
- "github.com"
- "pypi.org"
blocked_domains:
- "*.malware.com"
proxy: "http://proxy.corp.example.com:8080"
Threat Model
| Attack Vector | Risiko | Mitigation |
|---|---|---|
| Prompt Injection | Agent menjalankanζ什 tersembunyi dalam file/code yang dibaca | Input validation, sandboxed execution, approval workflows |
| Credential Exfiltration | Agent tricked untuk mengirim API keys ke attacker | Network isolation, domain allowlist, credential masking in logs |
| Destructive Operations | Agent dimanipulasi untuk delete/corrupt files | Approval workflows, sandboxed filesystem, backup strategies |
| Resource Exhaustion | Agent diminta loop indefinitely atau consume excessive tokens | Token budgets, rate limiting, timeout configuration |
Audit Logging
# ~/.hermes/config.yaml
audit:
enabled: true
log_file: ~/.hermes/audit.log
log_level: detailed # Options: minimal, standard, detailed
include:
- tool_calls
- file_operations
- network_requests
- credential_access
- prompt_inputs
- model_responses
Gotchas:
- Docker sandbox menambah latency signifikan untuk tool execution β pertimbangkan trade-off security vs speed
- Network isolation bisa block legitimate API calls jika domain list tidak lengkap
- Approval workflows mengurangi otonomi β perlu balance antara safety dan efficiency
- Audit log bisa jadi sangat besar β perlu rotation dan cleanup otomatis
- Prompt injection defense tidak 100% efektif β selalu gunakan defense in depth
10. Performance & Scaling
Performance optimization mencakup token usage management, model routing berdasarkan kompleksitas task, context compression, dan concurrent task execution. Tanpa optimasi, biaya API bisa membengkak dengan cepat di production.
Token Optimization Strategy
# ~/.hermes/config.yaml
model:
default: anthropic/claude-sonnet-4 # Primary β complex tasks
fast: openai/gpt-4.1-mini # Task ringan (5-10x lebih murah)
fallback: openai/gpt-4.1 # Fallback saat primary gagal
optimization:
use_fast_model_for:
- memory_search
- file_listing
- simple_classification
- context_compression
use_default_model_for:
- code_generation
- complex_reasoning
- multi_step_planning
- security_analysis
Rate Limiting
# ~/.hermes/config.yaml
rate_limiting:
enabled: true
requests_per_minute: 60
tokens_per_minute: 100000
backoff_strategy: exponential # Options: linear, exponential
max_retries: 3
Monitoring & Profiling
# System health check
hermes diagnose
# Token usage monitoring
hermes stats tokens
hermes stats cost --period daily
hermes stats cost --period monthly
# Debug logging untuk profiling
hermes --log-level debug chat "test task"
# Detailed per-model breakdown
hermes stats --detailed
Trajectory Compression (untuk Training Pipeline)
Jika Anda menggunakan Hermes untuk menghasilkan training data, TrajectoryCompressor memproses completed agent trajectories: mengidentifikasi high-signal segments (tool calls, errors, decisions), summarize low-signal segments (repetitive exploration), preserve training-critical patterns, dan fit dalam target token budget.
hermes batch compress --input trajectories/ --output compressed/ --target-tokens 8000
// Advertisement
11. Enterprise Patterns
Deployment enterprise untuk Hermes mencakup multi-profile setup untuk tim, centralized configuration management, integration dengan tools enterprise (Slack, Jira, databases), governance policies, dan disaster recovery.
Team Deployment Architecture
Shared Server / VPS
βββ hermes (Gateway Process)
β βββ Platform: Slack #engineering
β βββ Platform: Discord #dev-team
β βββ Platform: CLI (SSH access)
βββ Profile: team-lead
β βββ config.yaml (full access, all tools)
β βββ memories/ (supervisor context)
βββ Profile: developer-1
β βββ config.yaml (restricted tools, sandbox enabled)
β βββ memories/ (individual project context)
βββ Profile: developer-2
βββ config.yaml (restricted tools, sandbox enabled)
βββ memories/ (individual project context)
Slack Integration
# ~/.hermes/config.yaml
gateway:
platforms:
slack:
enabled: true
bot_token: ${SLACK_BOT_TOKEN}
app_token: ${SLACK_APP_TOKEN}
channels:
- "#engineering"
- "#devops"
features:
code_review: true
issue_triage: true
daily_digest: true
Jira Integration via MCP
# ~/.hermes/mcp_servers.yaml
servers:
jira:
command: npx
args: ["-y", "@modelcontextprotocol/server-jira"]
env:
JIRA_URL: "https://company.atlassian.net"
JIRA_EMAIL: "agent@company.com"
JIRA_API_TOKEN: ${JIRA_API_TOKEN}
tools:
allow:
- create_issue
- update_issue
- search_issues
- add_comment
block:
- delete_project # Never allow project deletion
Governance Template
# ~/.hermes/config.yaml.template β Shared across team
security:
approval:
require_for:
- file_delete
- production_deploy
- credential_access
sandbox:
backend: docker
audit:
enabled: true
rate_limiting:
tokens_per_day: 500000 # Budget per user per day
memory:
provider: honcho # Centralized memory untuk team
retention:
max_days: 90 # Auto-cleanup setelah 90 hari
Disaster Recovery
# Backup semua data
hermes backup create --output hermes-backup-$(date +%Y%m%d).tar.gz
# Backup mencakup: config.yaml, .env, SOUL.md, memories/, skills/, plugins/, sessions/, cron jobs
# Restore dari backup
hermes backup restore --input hermes-backup-20260703.tar.gz
# Export/import specific profile
hermes profile export work --output work-backup.tar.gz
hermes profile import --input work-backup.tar.gz --name work-restored
Gotchas:
- Shared server deployment perlu process management yang baik β gunakan systemd atau Docker Compose
- Profile isolation berarti tidak ada shared knowledge antar team members tanpa Honcho
- Enterprise integration (Slack, Jira) memerlukan API key management yang terpusat dan secure
- Backup/restore tidak atomic β bisa ada data loss jika terjadi failure saat proses backup
- Governance policies perlu di-enforce di config level β tidak ada centralized policy server
Kesimpulan
Artikel ini membahas Hermes Agent dari perspektif expert β dari arsitektur internal tiga-tier hingga enterprise deployment. Kunci utama untuk menguasai Hermes di level expert:
- Pahami arsitektur β Semua ekstensi berhubungan dengan tiga-tier architecture; tanpa pemahaman ini, troubleshooting menjadi tebak-tebakan
- Gunakan credential pools β Rotasi API key krusial untuk production reliability dan menghindari rate limiting
- Manfaatkan skill chaining β Bangun workflow kompleks dengan koordinasi antar step dan quality gates
- Bangun MCP server custom β Integrasi tak terbatas dengan ekosistem tool internal dan eksternal
- Delegasi secara parallel β Subagent isolation + batch delegation untuk throughput tinggi
- Automate dengan CI/CD β Hermes sebagai automated code reviewer, tester, dan deployer
- Harden security β Defense in depth, sandboxing, approval workflows, dan audit logging
- Optimize performance β Model routing, context compression, dan rate limiting untuk cost control
Untuk informasi lebih lanjut, kunjungi dokumentasi resmi Hermes Agent.
Best Practices Summary
Berikut adalah ringkasan best practices yang telah dibahas sepanjang artikel ini, diurutkan berdasarkan prioritas dampak:
- Selalu gunakan model routing β Jangan gunakan model mahal untuk task ringan. Konfigurasikan
fastmodel untuk summarization dan classification, dandefaultmodel untuk code generation dan complex reasoning. Penghematan biaya bisa mencapai 60-70% di production. - Implementasi credential pools β Single API key adalah single point of failure. Gunakan minimal 3 key per provider dengan strategi
round_robinatauleast_usedtergantung karakteristik workload. - Bangun custom MCP servers β Jangan terbatas pada MCP servers yang tersedia di komunitas. Membangun MCP server untuk internal tools memberikan integrasi yang lebih dalam dan kontrol yang lebih baik atas akses.
- Gunakan delegation secara strategis β Parallel delegation menghemat waktu tetapi menghabiskan token. Gunakan untuk task yang benar-benar independent, dan pipeline delegation untuk task yang memerlukan koordinasi.
- Automate review dengan CI/CD β Integrasi Hermes ke GitHub Actions sebagai automated code reviewer memberikan konsistensi dan mengurangi beban manual reviewer.
- Monitor token usage β Set budget harian dan per-profile. Gunakan
hermes statssecara rutin untuk memastikan tidak ada kebocoran token yang tidak terduga. - Backup secara berkala β Jalankan
hermes backup createminimal mingguan. Simpan backup di lokasi terpisah dari server utama. - Defense in depth untuk security β Jangan hanya mengandalkan satu layer pertahanan. Kombinasikan approval workflows, sandboxing, network isolation, dan audit logging untuk proteksi menyeluruh.
Total referensi: 30 sumber dari dokumentasi resmi, DeepWiki, MCP specification, dan komunitas.
Topik yang dicover: 11 topik advanced meliputi arsitektur internal, custom provider, skill development, plugin architecture, MCP advanced, multi-agent orchestration, automation, memory management, security hardening, performance optimization, dan enterprise deployment.
Referensi
| # | Sumber | URL |
|---|---|---|
| 1 | Architecture β Hermes Agent Docs | https://hermes-agent.nousresearch.com/docs/developer-guide/architecture/ |
| 2 | Agent Loop Internals β Hermes Agent Docs | https://hermes-agent.nousresearch.com/docs/developer-guide/agent-loop |
| 3 | DeepWiki: Hermes Agent Architecture | https://deepwiki.com/NousResearch/hermes-agent |
| 4 | Skills System β Hermes Agent Docs | https://hermes-agent.nousresearch.com/docs/user-guide/features/skills/ |
| 5 | DeepWiki: Skills System | https://deepwiki.com/NousResearch/hermes-agent/8-skills-system |
| 6 | Plugins β Hermes Agent Docs | https://hermes-agent.nousresearch.com/docs/user-guide/features/plugins/ |
| 7 | DeepWiki: Plugin System | https://deepwiki.com/nousresearch-hermes-agent/hermes-agent/5.3-plugin-system |
| 8 | MCP β Hermes Agent Docs | https://hermes-agent.nousresearch.com/docs/user-guide/features/mcp/ |
| 9 | DeepWiki: MCP Server Integration | https://deepwiki.com/nousresearch-hermes-agent/hermes-agent/5.4-mcp-server-integration |
| 10 | MCP Specification: Sampling | https://modelcontextprotocol.io/specification/2025-06-18/client/sampling |
| 11 | Subagent Delegation β Hermes Agent Docs | https://hermes-agent.nousresearch.com/docs/user-guide/features/delegation/ |
| 12 | Delegation Patterns Guide | https://hermes-agent.nousresearch.com/docs/guides/delegation-patterns |
| 13 | Automation Blueprints | https://hermes-agent.nousresearch.com/docs/guides/automation-blueprints |
| 14 | Scheduled Tasks (Cron) | https://hermes-agent.nousresearch.com/docs/user-guide/features/cron/ |
| 15 | AI Providers β Hermes Agent Docs | https://hermes-agent.nousresearch.com/docs/integrations/providers/ |
| 16 | Credential Pools | https://hermes-agent.nousresearch.com/docs/user-guide/features/credential-pools/ |
| 17 | Provider Routing | https://hermes-agent.nousresearch.com/docs/user-guide/features/provider-routing/ |
| 18 | Profiles β Hermes Agent Docs | https://hermes-agent.nousresearch.com/docs/user-guide/profiles/ |
| 19 | DeepWiki: Memory and Sessions | https://deepwiki.com/NousResearch/hermes-agent/4.3-memory-and-sessions |
| 20 | DeepWiki: Honcho Integration | https://deepwiki.com/NousResearch/hermes-agent/4.4-honcho-integration |
| 21 | Context Compression Tour | https://www.intraview.ai/explore/NousResearch/hermes-agent/tours/context-compression/ |
| 22 | DeepWiki: Trajectory Compressor | https://deepwiki.com/NousResearch/hermes-agent/9.3-data-generation-and-trajectories |
| 23 | Ollama Integration | https://docs.ollama.com/integrations/hermes |
| 24 | GitHub: hermes-agent-skill-authoring | https://github.com/NousResearch/hermes-agent/tree/main/skills/software-development/hermes-agent-skill-authoring |
| 25 | DeepWiki: Plugins and Memory Providers | https://deepwiki.com/NousResearch/hermes-agent/10.7-plugins-and-memory-providers |
| 26 | Use MCP with Hermes Guide | https://hermes-agent.nousresearch.com/docs/guides/use-mcp-with-hermes/ |
| 27 | DeepWiki: Subagent Delegation | https://deepwiki.com/NousResearch/hermes-agent/5.7-subagent-delegation |
| 28 | Hostinger: Hermes Agent Security Guide | https://www.hostinger.com/in/tutorials/hermes-agent-security |
| 29 | ChatBotKit: Reference Architecture | https://chatbotkit.com/examples/hermes-agent-reference-architecture |
| 30 | mudrii/hermes-agent-docs | https://github.com/mudrii/hermes-agent-docs |
Pertanyaan yang Sering Diajukan
Q: Apa itu Hermes Agent untuk Lanjut?
Hermes Agent untuk Lanjut adalah topik yang dibahas secara mendalam dalam artikel ini, mencakup konsep dasar, implementasi, dan best practices untuk pengembang Indonesia.
Q: Bagaimana cara memulai dengan Hermes Agent untuk Lanjut?
Untuk memulai, pelajari konsep dasar yang dijelaskan di bagian awal artikel, lalu ikuti langkah-langkah praktis yang tersedia di bagian tutorial.
Q: Apa manfaat Hermes Agent untuk Lanjut untuk pengembang?
Hermes Agent untuk Lanjut memberikan efisiensi dalam pengembangan, meningkatkan produktivitas, dan membantu membangun aplikasi yang lebih robust dan scalable.
// Advertisement
VyuApp Studio
Bespoke web engineering β Garut, ID