AgentFabric —(可翻译为)“AgentFabric——”(注:由于“AgentFabric”是一个专有名词或特定项目名称,没有具体的上下文,因此直接保留原样。如果它是某个具体项目或技术的名称,应根据具体情况进行翻译或解释。) *将代理、服务和策略整合到一个堆栈中*
AgentFabric是一个模块化、云原生的构建框架 代理应用程序 与……交谈 域名服务 (订单、支付、库存、通知)在运行中 Kubernetes(中文常译为“K8s”,但直接音译为“库伯内特斯”或保持原英文名也常见) (Kubernetes 作者,未注明日期),并受以下条款约束: 政策 通过 OPA/Rego 翻译为中文是“强制性保险/车辆注册”。其中,“OPA”通常指的是某种形式的强制性保险(如在某些国家或地区,特定车辆必须投保的强制保险),而“Rego”则指的是车辆的注册或登记。 (Open Policy Agent,未注明日期)。它结合了 可观测性 和;与 OpenTelemetry(可译为“开放遥测技术”或根据具体语境简化为“开放遥测”) (OpenTelemetry 作者,未注明日期),一个可选的 服务网格 例如 Istio(伊斯蒂奥,但通常直接音译为“伊斯蒂奥”或保持原英文名,根据语境选择) (Istio 作者,未注明日期),以及一个 队列 + ETL(提取、转换、加载) 使用车道 NATS(英国国家空中交通服务公司) (Synadia Communications,未注明日期)。它可以通过(某种方式)向代理暴露工具/资源 模型上下文协议(MCP) (OpenAI,未注明日期)。
为什么大多数代理应用不仅仅需要一个模型,它们还需要 路由规划、护栏、审批、审计和服务合同AgentFabric 提供织物。
______________________________________________________________________
亮点
- 代理层编排器+推理引擎(大型语言模型/小型语言模型)、内存,以及使用OPA(Open Policy Agent,开放策略代理,无具体日期)进行策略检查。
- 服务层用于订单、支付、库存、通知的REST微服务。
- 平台层Kubernetes(Kubernetes 作者,未注明日期),服务网格例如 Istio(Istio 作者,未注明日期),NATS 队列(Synadia 通讯,未注明日期),存储,以及使用 OpenTelemetry 实现可观测性(OpenTelemetry 作者,未注明日期)。
- 治理外部化决策(PDP)、如个人身份信息(PII)编辑、审计追踪等义务(Open Policy Agent,未注明日期;OpenTelemetry 作者,未注明日期)。
- MCP(Minimum Change Principle,最小变化原则)可选模型上下文协议服务器,用于向智能体暴露工具/资源(OpenAI,未注明日期)。
______________________________________________________________________
快速入门(Docker Compose)
# From the repo root
docker compose up -d --build
# Or bring up OPA first:
docker compose up -d opa健康检查
- OPA (PowerShell):
curl.exe "http://localhost:8181/health?plugins&bundles" - OPA(CMD):
curl http://localhost:8181/health?plugins^&bundles
______________________________________________________________________
架构(系统概览)
flowchart LR
subgraph A["Agent Layer — Plan · Act · Learn"]
U["User / Client"]
ORCH["Orchestrator Agent"]
LLM["Reasoning Engine (LLM / SLM)"]
MEM["Memory"]
POL["Policy Client"]
end
subgraph S["Services"]
ODR["Orders API"]
PAY["Payments API"]
INV["Inventory API"]
NOTI["Notifications API"]
ETL["Data Service ETL"]
end
subgraph P["Platform"]
MESH["Service Mesh Istio"]
Q["Queue NATS"]
OBS["Observability OTel"]
K8S["Kubernetes"]
STO["Storage"]
OPA["OPA PDP"]
end
%% Agent edges
U --> ORCH
ORCH --> LLM
ORCH --> MEM
ORCH --> POL
POL --> OPA
%% Service mesh fanout
ORCH --> MESH
MESH --> ODR
MESH --> PAY
MESH --> INV
MESH --> NOTI
%% Queue / ETL
ORCH --> Q
Q --> ETL
%% Storage
ODR --> STO
PAY --> STO
INV --> STO
ETL --> STO
%% Telemetry
ODR -.-> OBS
PAY -.-> OBS
INV -.-> OBS
NOTI -.-> OBS
ETL -.-> OBS
ORCH -.-> OBS
MESH -.-> OBS
%% Infra ties
MESH --- K8S
ODR --- K8S
PAY --- K8S
INV --- K8S
NOTI --- K8S
ETL --- K8S
ORCH --- K8S
OPA --- K8S
%% Styling
classDef agent fill:#e8f1ff,stroke:#1b66ff,color:#0b2e6e
classDef think fill:#fff2cc,stroke:#e6a100,color:#4a3b00
classDef policy fill:#fde2e2,stroke:#e63b3b,color:#5a0c0c
classDef svc fill:#eaffea,stroke:#16a34a,color:#064b23
classDef mesh fill:#e6fcff,stroke:#06b6d4,color:#034752
classDef queue fill:#f1e8ff,stroke:#7c3aed,color:#2d0d5a
classDef store fill:#fff0e6,stroke:#fb923c,color:#5a2c00
classDef obs fill:#f5f3ff,stroke:#6366f1,color:#1f1b6b
classDef k8s fill:#eef2ff,stroke:#3b82f6,color:#0b255c
class U,ORCH agent
class LLM,MEM think
class POL policy
class ODR,PAY,INV,NOTI,ETL svc
class MESH mesh
class Q queue
class OBS obs
class K8S k8s
class STO store______________________________________________________________________
治理与政策(OPA/注册)
flowchart LR
subgraph Request
RQ["Action Request: tool + args + actor + context"]
end
RQ --> PDPC["Policy Client"]
PDPC --> OPA["OPA PDP"]
OPA -->|allow or deny with obligations| PDPC
PDPC -->|enforce obligations eg redact| EXEC["Executor or Router"]
EXEC --> SVC["Domain Service"]
SVC --> AUD["Audit and OTel spans"]
classDef policy fill:#fde2e2,stroke:#e63b3b,color:#5a0c0c
classDef svc fill:#eaffea,stroke:#16a34a,color:#064b23
classDef obs fill:#f5f3ff,stroke:#6366f1,color:#1f1b6b
class PDPC,OPA policy
class SVC,AUD obs示例策略(policy/policy.rego)
package agent
default allow = false
# Simple allow for smoke tests
allow {
input.tool == "ping"
}
# Example: payments guard
deny[msg] {
input.tool == "charge_payment"
input.args.amount > 1000
msg := "amount exceeds limit; approval required"
}
requires_approval {
input.tool == "charge_payment"
input.args.amount > 1000
}协调器查询: POST /v1/data/agent/allow 并且可以读取辅助数据(例如。, requires_approval(开放策略代理,无日期)。
______________________________________________________________________
编排序列
sequenceDiagram
autonumber
participant U as User
participant A as Orchestrator
participant P as OPA PDP
participant R as Reasoning LLM or SLM
participant S as Service API
participant Q as NATS Queue
participant O as Observability
U->>A: POST /act (goal, tool, args)
A->>P: policy input (tool, args, actor, context)
alt allowed
P-->>A: allow true, obligations
A->>R: plan or transform
A->>S: call service with obligations
S-->>A: result
else approval required
P-->>A: allow false, requires approval
A-->>U: 202 Accepted (pending)
end
A->>Q: publish ETL job optional
A-->>U: response
A-)+O: OTel spans and logs______________________________________________________________________
部署拓扑(K8s)
flowchart TB
subgraph "Kubernetes Cluster"
subgraph "Namespace: agentfabric"
subgraph Control
OPA["OPA Deployment"]
OTL["OTel Collector"]
end
subgraph Apps
ORCH["Orchestrator Deployment"]
ODR["Orders"]
PAY["Payments"]
INV["Inventory"]
NOTI["Notifications"]
ETL["Data Service"]
end
Q["NATS"]
PVC["PersistentVolumeClaim data"]
end
end
ORCH --> OPA
ORCH --> OTL
ODR --> OTL
PAY --> OTL
INV --> OTL
NOTI --> OTL
ETL --> OTL
ETL --> PVC______________________________________________________________________
配置
- OPA 端点:
OPA_URL=http://opa:8181/v1/data/agent/allow - OTel(OpenTelemetry):
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318 - 服务URL:
ORDERS_URL,PAYMENTS_URL,INVENTORY_URL,NOTIFY_URL - 队列:
NATS_URL=nats://nats:4222
编写OPA片段
opa:
image: openpolicyagent/opa:0.67.0
command: ["run","--server","--addr=:8181","/policy"]
volumes:
- ./policy:/policy:ro
ports:
- "8181:8181"______________________________________________________________________
参考文献(APA格式)
- Istio 作者。(无具体日期)。 *Istio 文档*https://istio.io/latest/docs/ 翻译为中文是:“https://istio.io/最新版本/文档/”。不过,通常在实际使用中,我们不会直接翻译网址,而是直接使用原网址进行访问。这里的翻译只是为了说明网址的结构和含义
- OpenAI.(未注明日期)。 *模型上下文协议(MCP)*https://github.com/modelcontextprotocol(译文:https://github.com/modelcontextprotocol,注:此网址本身为英文,翻译时保持原样)
- 开放策略代理。(无具体日期)。 *OPA(可能指某种组织、协议或特定领域的缩写,具体需根据上下文确定)的文档资料*https://www.openpolicyagent.org/docs/latest/ 翻译为中文是:“https://www.openpolicyagent.org(官方网站)/最新文档/”
- OpenTelemetry 作者。(未注明日期)。 *OpenTelemetry 文档*https://opentelemetry.io/docs/ 翻译为中文是:“https://opentelemetry.io/ 官方文档/”。不过,通常在这种网址链接的翻译中,我们不会完全翻译整个网址,而是保留原样,因为网址是全球通用的,不需要翻译。所以,更常见的表达方式是直接使用原网址,或者在需要说明时简单指出这是“OpenTelemetry 的官方文档网址”
- Synadia Communications股份有限公司(未注明日期)。 *NATS 文档*https://docs.nats.io/ 的中文翻译是:“NATS 文档官网”
- Kubernetes 作者团队。(未注明日期)。 *Kubernetes 文档*https://kubernetes.io/docs/ 的中文翻译为:“https://kubernetes.io/中文文档/” 或者更简洁地表示为“Kubernetes 中文文档(网址)”。不过,实际上直接翻译网址并不常见,通常我们会说“访问 Kubernetes 的中文文档页面,网址为 https://kubernetes.io/docs/”。在这里,“docs”代表“文档(documentation)”,所以完整的表述可以是“访问 Kubernetes 的文档页面,网址为 https://kubernetes.io/docs/”
______________________________________________________________________
作者
弗里曼·奥古斯塔斯·杰克逊 — 维护者及原始作者。\ 欢迎在 https://github.com/4th/AgenticFabric 提出问题和贡献代码
许可证
Apache-2.0(许可证协议名称,通常不直接翻译,保持原样)
