--- title: "System-Prompt-Layering" type: concept tags: [] sources: [expose-hermes-agent-as-an-openai-compatible-api-for-any-frontend] last_updated: 2026-05-02 --- ## Definition System Prompt Layering 是一种前端提示词与 Agent 核心提示词分层叠加的机制,确保前端传入的提示词不会覆盖 Agent 原有的工具集和能力。 ## Mechanism 当通过 API Server 调用 Hermes Agent 时: 1. **基础层**:Agent 核心系统提示词(包含完整工具集、Skills、记忆配置) 2. **叠加层**:前端传入的 system prompt(Chat Completions 的 `system` 消息,或 Responses API 的 `instructions` 字段) 3. **结果**:两层提示词叠加,Agent 保留全部原生能力 ## Example ```json // Chat Completions 请求 { "model": "hermes-agent", "messages": [ {"role": "system", "content": "你是一个友好的助手"}, // 叠加层 {"role": "user", "content": "hello"} ] } ``` ## Key Benefit 前端可以定制对话风格(如角色扮演、语气调整),同时不影响 Agent 的核心工具能力。 ## Related - [[OpenAI-Compatible-API]] - [[Conversation-State-Persistence]]