Files
nexus/wiki/concepts/System-Prompt-Layering.md
2026-05-03 05:42:12 +08:00

1.1 KiB
Raw Blame History

title, type, tags, sources, last_updated
title type tags sources last_updated
System-Prompt-Layering concept
expose-hermes-agent-as-an-openai-compatible-api-for-any-frontend
2026-05-02

Definition

System Prompt Layering 是一种前端提示词与 Agent 核心提示词分层叠加的机制,确保前端传入的提示词不会覆盖 Agent 原有的工具集和能力。

Mechanism

当通过 API Server 调用 Hermes Agent 时:

  1. 基础层Agent 核心系统提示词包含完整工具集、Skills、记忆配置
  2. 叠加层:前端传入的 system promptChat Completions 的 system 消息,或 Responses API 的 instructions 字段)
  3. 结果两层提示词叠加Agent 保留全部原生能力

Example

// Chat Completions 请求
{
  "model": "hermes-agent",
  "messages": [
    {"role": "system", "content": "你是一个友好的助手"},  // 叠加层
    {"role": "user", "content": "hello"}
  ]
}

Key Benefit

前端可以定制对话风格(如角色扮演、语气调整),同时不影响 Agent 的核心工具能力。