跳转至

配置参考

每个 agent 和 skill 有自己的 config/ 目录。配置随 skill 走 — 安装或移动 skill 时,配置一起迁移。

功能声明

ID 声明 状态
C-NE-12 nornir/hosts.yaml 定义采集的设备清单 ✅ v0.10.0
C-NE-13 blacklisted_commands.yaml 支持正则,无效 pattern 跳过并记录警告 ✅ v0.10.0
C-NE-14 cron_schedules.yaml 可自定义 trace_learner 定时 ✅ v0.10.0

配置架构

.olav/config/                              ← 平台级(仅 4 个文件)
├── api.json                               # LLM 密钥、模型配置
├── api.json.example                       # 模板
├── services.yaml                          # 已注册 API 服务
└── approval_rules.yaml                    # HITL 审批规则

.olav/workspace/
├── ops/config/                            ← Ops 编排器(共享)
│   ├── blacklisted_commands.yaml          # 命令黑名单(所有 agent)
│   └── netops_settings.yaml              # 通用 NetOps 设置
├── ops/probe/config/                      ← Probe agent(SSH)
│   ├── nornir/
│   │   ├── hosts.yaml                    # 设备清单
│   │   ├── groups.yaml                   # 组凭证
│   │   ├── defaults.yaml                 # 全局默认
│   │   └── config.yaml                   # Nornir 运行器设置
│   └── default_commands.yaml             # 按平台采集命令
├── ops/lab/config/                        ← Lab agent(ContainerLab)
│   └── config.json                       # CLAB API URL + 凭证
├── ops/diff/config/                       ← Diff agent
│   └── diff_strategies.yaml              # 比较策略
├── infra/references/                      ← Infra agent(自动生成)
│   ├── netbox_dcim_api.md                # NetBox DCIM 端点
│   └── ...                               # olav registry register 生成
├── devops/references/                     ← DevOps agent
│   ├── BASELINE_SCHEMA.md                # 平台健康基线
│   └── OLAV_PLATFORM_HEALTH.md           # 健康检查参考
└── audit/profiles/                        ← Audit agent
    ├── bgp_health.md                     # BGP 健康检查 Profile
    └── health_full_drift.md              # 全量漂移审计 Profile

原则: 平台配置在 .olav/config/。Skill 配置在各自目录。无跨 skill 配置依赖。


Probe Agent — SSH 与设备采集

nornir/hosts.yaml

R1:
  hostname: 192.168.100.101
  platform: juniper_junos
  groups:
    - core_routers

platform 值遵循 NTC-Templates 命名

nornir/groups.yaml

core_routers:
  username: admin
  password: "${NORNIR_PASSWORD}"
  connection_options:
    netmiko:
      extras:
        timeout: 30

环境变量

敏感值使用 ${VAR_NAME},运行时展开。

default_commands.yaml

- show version
- show running-config
- show interfaces
- show ip interface brief

Lab Agent — ContainerLab

config.json

{
  "base_url": "http://192.168.100.12:8080",
  "username": "olav",
  "password": "olav123",
  "mgmt_subnet": "172.20.50.0/24"
}

Ops 编排器 — 共享配置

blacklisted_commands.yaml

正则 pattern,跨所有 agent 拦截危险命令。

- "reload"
- "write erase"
- "conf(igure)? t(erminal)?"

Infra Agent — API 参考

参考文档由 olav registry register 自动生成

olav registry register http://netbox:8000

DevOps Agent — 脚本参考

references/ 中的文件作为 agent 静态上下文。添加自定义参考教 agent 你的环境:

cp my-guide.md .olav/workspace/devops/references/

Audit Agent — Profile

Designer 创建,Auditor 执行:

olav --agent audit-designer "创建 BGP 健康检查 Profile"
olav --agent audit-auditor "执行 bgp_health 审计"

定时调度

olav "每天凌晨 4 点执行快照"
olav "查看所有定时任务"

cron_schedules.yaml

schedules:
  snapshot:
    cron: "0 2 * * *"
    agent: config
    instruction: "take snapshot"

平台配置 (.olav/config/)

文件 用途
api.json LLM 密钥、模型选择
services.yaml 已注册 API 服务
approval_rules.yaml HITL 审批规则

不要提交 api.json

包含 LLM API 密钥。已在 .gitignore 中。


Skill 结构 — Agent 如何注册

Workspace 目录

每个 agent 位于 .olav/workspace/<name>/,标准结构:

.olav/workspace/ops/
├── AGENT.md                       # Agent 声明
├── SKILL.md                       # 工具、意图、静态上下文
├── MANIFEST.yaml                  # 路由关键词、版本、依赖
├── prompts/system.md              # 系统提示词
├── tools/                         # Python @tool 文件
├── config/                        # Agent 专属配置
├── references/                    # 静态上下文文件
└── analysis/ probe/ diff/ lab/    # 子 agent

AGENT.md

声明 agent 及其子 agent:

---
name: ops
description: "网络运维  故障排查、模拟、漂移检测"
subagents:
  - path: ./analysis/SKILL.md
  - path: ./probe/SKILL.md
---

SKILL.md

声明工具和上下文:

---
name: ops-analysis
tools:
  - run_python_simulation
static_context:
  - path: ./references/ROUTING_EXPERT_GUIDE.md
metadata:
  network_isolation: "true"
---

PLATFORM.md

平台 agent 注册表(.olav/workspace/PLATFORM.md):

---
active: quick
agents:
  - config
  - core
  - ops
---

olav skill install 自动添加到此列表。olav list 读取此文件。


安装 Skill (olav-netops)

# 本地目录
olav skill install /path/to/olav-netops/

# Git URL
olav skill install https://github.com/james-olavai/olav-netops

安装后: 1. Workspace 文件复制到 .olav/workspace/ops/ 2. Agent 注册到 PLATFORM.md

安装后设置

# 1. 复制配置模板
cp .olav/workspace/ops/lab/config/config.json.example \
   .olav/workspace/ops/lab/config/config.json
# 编辑 CLAB 凭证

cp .olav/workspace/ops/probe/config/nornir/hosts.yaml.example \
   .olav/workspace/ops/probe/config/nornir/hosts.yaml
# 编辑设备清单

# 2. 初始化
olav --agent ops "/netops_init"

注册 API 服务

olav registry register http://netbox:8000

执行后: 1. 写入 services.yaml 2. 解析 OpenAPI schema 3. 生成 reference markdown 到 infra/references/

services.yaml 格式

services:
  netbox:
    endpoint: http://netbox:8000
    auth:
      type: bearer
      token_env: NETBOX_TOKEN    # 环境变量名(非实际 token)
    readonly_only: true          # 默认只读