Files
nexus/wiki/concepts/Webhook-Proxy-Pattern.md

35 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Webhook-Proxy-Pattern"
type: concept
tags: [webhook, security, agent-architecture, n8n]
sources: [n8n-workflow-orchestration]
last_updated: 2026-04-17
---
## Aliases
- Webhook Proxy Pattern
- Webhook 代理模式
## Definition
一种 AI Agent 外部 API 调用架构Agent 不直接持有凭证,而是通过调用 n8n Webhook URL 触发工作流n8n 在服务端持有 API 凭证并执行实际 API 调用。Agent 只知道 Webhook 端点,不知道任何密钥。
## Why It Matters
- **安全性**API 密钥从不进入 Agent 环境,一次误提交也不会泄露
- **可观测性**n8n 记录每次调用的输入输出
- **可治理**工作流可被锁定Agent 无法静默修改 API 行为
- **可测试**:工作流可在 n8n UI 中独立调试
## How It Works
1. Agent 通过 n8n API 创建工作流(含 Webhook 触发器)
2. 管理员在 n8n UI 中添加凭证并锁定工作流
3. Agent 只需调用 `POST http://n8n:5678/webhook/workflow-name` 附带 JSON payload
4. n8n 执行实际 API 调用并返回结果
## Connections
- [[Credential-Isolation]] — 该模式的核心安全属性
- [[Lockable-Workflow]] — 该模式的安全保障机制
- [[Webhook]] — 技术基础
- [[n8n]] — 执行代理
- [[OpenClaw]] — 调用方 Agent