balakreshnan/AgenticAIOpsGHCPApp
GitHub: balakreshnan/AgenticAIOpsGHCPApp
基于 Streamlit 和 Microsoft Foundry 构建的 Agentic AIOps 工作室,提供 Agent 聊天交互、多维度响应评估以及对抗性红队安全扫描能力。
Stars: 0 | Forks: 0
# AgenticAIOpsGHCPApp
使用 Microsoft Foundry、Microsoft Agent framework、Guardrails、Evaluation、Rubric、Red Team 和 agent governance toolkit 的 Agentic AI Ops
## Agentic AIOps Studio (Streamlit)
一个采用 Material 3 风格、商务专业的 Streamlit UI,可让您发现
Microsoft Foundry 项目中的 agent,并与选定的 agent 进行聊天。多 agent
执行由 **Microsoft Agent Framework** 提供支持;agent 发现功能使用
**Azure AI Projects** SDK。
### 功能
- **聊天选项卡** — 选择一个 Foundry agent 并与其进行对话。
- 左侧容器:可滚动的对话历史记录(固定高度 500)。
- 右侧容器:用于展示最新轮次的 **Agent Output**、**Token Usage** 和
**Debug Information** 的 `st.expander`。
- 用于提问的 `st.chat_input`。
- **评估选项卡** — 使用 **Azure AI Evaluation** SDK 在所有
适用的指标上评估 Foundry **rfpagent** agent 的响应
(`evaldata/datarfp.jsonl`),提供一键式 **运行/重新运行** 按钮和详细输出:
- **NLP / 词汇**: F1, BLEU, GLEU, ROUGE-L, METEOR。
- **AI 辅助质量** (LLM judge): groundedness, relevance, coherence,
fluency, similarity, retrieval, response completeness。
- **风险与安全** (Azure AI RAI): violence, sexual, self-harm, hate/unfairness
(在配置了 subscription / resource-group / project 时启用)。
- 汇总指标卡片以及带有 judge reasons 的逐行明细。
- **红队** — 单轮对抗性扫描 (Azure AI Evaluation, PyRIT)。
- **RAMPART** — Microsoft RAMPART 行为安全探针(jailbreak、
prompt-injection 和 benign-regression),使用确定性
evaluators 进行评分;为 agent 提供快速的安全金丝雀测试。
- **Tracing** 选项卡 — 为即将推出的功能搭建的占位符。
- 采用令人愉悦的专业调色板的单屏 Material 3 布局。
### 项目结构
```
app.py # Streamlit entrypoint: theme, header, top tabs
common/ # reusable utilities shared across tabs
config.py # .env loading + validation (DefaultAzureCredential only)
azure_clients.py # cached AIProjectClient + credential
agents.py # list agents + run an agent via Agent Framework
chat.py # conversation session-state helpers
styles.py # Material 3 theme / CSS
ui.py # shared UI components
evaluation.py # Azure AI Evaluation helpers (rfpagent metrics)
tabs/ # one module per tab
evaldata/ # evaluation datasets (datarfp.jsonl, datarfpagent.jsonl)
.env.example # configuration template
```
### 前置条件
- Python 3.10+
- 通过 Azure CLI (`az login`) 登录的 Azure 账户,且有权访问您的
Microsoft Foundry 项目。**身份验证完全由
`DefaultAzureCredential` 处理** — 不使用任何密钥或服务主体密钥。
### 设置
```
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
pip install -r requirements.txt
# RAMPART (safety-probe tab) 发布了一个冲突的 PyRIT pin — 安装它,
# 单独安装,不带其依赖项,以便 app 的 PyRIT 保持完好:
pip install --no-deps -r requirements-rampart.txt
cp .env.example .env # then edit .env with your Foundry endpoint
az login
```
在 `.env` 中设置:
- `AZURE_AI_PROJECT_ENDPOINT` — 您的 Foundry 项目 endpoint,例如
`https://.services.ai.azure.com/api/projects/`
- `AZURE_AI_MODEL_DEPLOYMENT` — 默认的模型部署(例如 `gpt-5.4-mini`)
对于**评估**选项卡(可选 — 将派生合理的默认值):
- `AZURE_EVAL_JUDGE_MODEL` — 用作 AI 辅助指标的
LLM judge 的聊天部署(默认为 `AZURE_AI_MODEL_DEPLOYMENT`)。Reasoning 模型
(o-series / gpt-5) 会被自动检测。
- `AZURE_OPENAI_ENDPOINT` / `AZURE_OPENAI_API_VERSION` — judge 模型 endpoint
(默认为从 `AZURE_AI_PROJECT_ENDPOINT` 派生的账户 endpoint)。
- `AZURE_SUBSCRIPTION_ID`, `AZURE_RESOURCE_GROUP_NAME`, `AZURE_AI_PROJECT_NAME` —
仅在启用风险与安全 evaluators 时需要。
### 运行
```
streamlit run app.py
```
该应用需要有效且已配置的 Azure 连接。如果缺少 `AZURE_AI_PROJECT_ENDPOINT`
或登录失败,聊天选项卡将显示一个友好的错误提示,说明如何
修复它。
标签:AI智能体, Kubernetes, Python, Streamlit, 人工智能运维, 大模型评估, 安全护栏, 无后门, 访问控制, 逆向工具