# xiaoxiaohexin/netops-ai-agent architecture

> Architecture diagram of the GitHub repository xiaoxiaohexin/netops-ai-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xiaoxiaohexin/netops-ai-agent
- Repository: https://github.com/xiaoxiaohexin/netops-ai-agent

## Overview

NetOps AI Agent is a CLI-driven network automation and self-healing product. Its documented primary flow turns an operator’s natural-language intent into a generated topology, offline checks it, requests approval, deploys it, probes connectivity, and attempts diagnosis and repair before a circuit-breaker decision. The repository also contains a Day-2 incident workflow for baseline and telemetry analysis, SOP-supported remediation, and sandbox preflight. Workflow wiring is represented at the documented stage level; unsampled implementation details are not inferred.

Main entry points: [`langgraph_netagent/langgraph_netagent/workflow/nodes.py`](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/nodes.py) (Topology generation), [`langgraph_netagent/langgraph_netagent/tools/runner.py`](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/tools/runner.py) (Deployment), [`langgraph_netagent/langgraph_netagent/cli.py`](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/cli.py) (NetAgent CLI), [`langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py`](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py) (Incident diagnosis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and orchestration"]
  node_cli["NetAgent CLI<br/>[cli.py]"]
  node_design_graph["Design workflow<br/>[graph.py]"]
  node_day2_graph["Day-2 workflow"]
end

subgraph group_design["Intent and topology"]
  node_intent["Intent parsing<br/>[nodes.py]"]
  node_topology["Topology generation<br/>[nodes.py]"]
  node_llm["LLM providers"]
end

subgraph group_network["Network execution"]
  node_offline["Offline validation"]
  node_approval["Human approval<br/>[nodes.py]"]
  node_deployment["Deployment<br/>[runner.py]"]
  node_verification["Probe verification<br/>[probes.py]"]
  node_healing["Diagnosis and healing<br/>[nodes.py]"]
  node_breaker["Circuit breaker<br/>[edges.py]"]
end

subgraph group_operations["Day-2 operations"]
  node_baseline_telemetry["Baseline and telemetry"]
  node_diagnostics["Incident diagnosis"]
  node_sop["SOP retrieval<br/>[sop_retriever.py]"]
  node_remediation["Remediation planning"]
  node_sandbox["Sandbox preflight<br/>[sandbox.py]"]
end

subgraph group_contracts["Models and providers"]
  node_contracts["Domain contracts"]
end

node_operator(("Network operator"))
node_llm_service(("LLM service"))
node_approver(("Approver"))
node_containerlab(("Containerlab network"))

node_operator -->|"provides intent"| node_cli
node_cli -->|"starts workflow"| node_design_graph
node_design_graph -->|"dispatches"| node_intent
node_intent -->|"requests parsing"| node_llm
node_llm -.->|"queries"| node_llm_service
node_intent -->|"routes intent"| node_topology
node_topology -->|"requests generation"| node_llm
node_topology -->|"produces topology"| node_contracts
node_topology -->|"submits topology"| node_offline
node_offline -->|"passes validation"| node_approval
node_approver -->|"decides"| node_approval
node_approval -->|"authorizes deployment"| node_deployment
node_deployment -->|"deploys lab"| node_containerlab
node_deployment -->|"starts probes"| node_verification
node_verification -->|"reports failures"| node_healing
node_healing -->|"retries deployment"| node_deployment
node_healing -->|"reports outcome"| node_breaker
node_cli -->|"starts operations"| node_day2_graph
node_day2_graph -->|"dispatches"| node_baseline_telemetry
node_baseline_telemetry -->|"supplies incident context"| node_diagnostics
node_diagnostics -->|"retrieves guidance"| node_sop
node_diagnostics -->|"informs plan"| node_remediation
node_remediation -->|"preflights plan"| node_sandbox
node_remediation -->|"uses operational models"| node_contracts

click node_cli "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/cli.py"
click node_design_graph "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/graph.py"
click node_intent "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/nodes.py"
click node_topology "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/nodes.py"
click node_llm "https://github.com/xiaoxiaohexin/netops-ai-agent/tree/main/langgraph_netagent/langgraph_netagent/llm/providers"
click node_contracts "https://github.com/xiaoxiaohexin/netops-ai-agent/tree/main/langgraph_netagent/langgraph_netagent/models"
click node_offline "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/validation/offline_validator.py"
click node_approval "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/nodes.py"
click node_deployment "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/tools/runner.py"
click node_verification "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/tools/probes.py"
click node_healing "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/nodes.py"
click node_breaker "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/edges.py"
click node_day2_graph "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/operational_graph.py"
click node_baseline_telemetry "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py"
click node_diagnostics "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py"
click node_sop "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/tools/sop_retriever.py"
click node_remediation "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py"
click node_sandbox "https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/tools/sandbox.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_design_graph,node_day2_graph toneBlue
class node_intent,node_topology,node_llm toneAmber
class node_offline,node_approval,node_deployment,node_verification,node_healing,node_breaker toneMint
class node_baseline_telemetry,node_diagnostics,node_sop,node_remediation,node_sandbox toneRose
class node_contracts,node_operator,node_llm_service,node_approver,node_containerlab toneIndigo
```

## Components

### CLI and orchestration

- [NetAgent CLI](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/cli.py): `langgraph_netagent/langgraph_netagent/cli.py`
- [Design workflow](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/graph.py): `langgraph_netagent/langgraph_netagent/workflow/graph.py`
- [Day-2 workflow](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/operational_graph.py): `langgraph_netagent/langgraph_netagent/workflow/operational_graph.py`

### Intent and topology

- [Intent parsing](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/nodes.py): `langgraph_netagent/langgraph_netagent/workflow/nodes.py`
- [Topology generation](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/nodes.py): `langgraph_netagent/langgraph_netagent/workflow/nodes.py`
- [LLM providers](https://github.com/xiaoxiaohexin/netops-ai-agent/tree/main/langgraph_netagent/langgraph_netagent/llm/providers): `langgraph_netagent/langgraph_netagent/llm/providers`

### Network execution

- [Offline validation](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/validation/offline_validator.py): `langgraph_netagent/langgraph_netagent/validation/offline_validator.py`
- [Human approval](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/nodes.py): `langgraph_netagent/langgraph_netagent/workflow/nodes.py`
- [Deployment](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/tools/runner.py): `langgraph_netagent/langgraph_netagent/tools/runner.py`
- [Probe verification](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/tools/probes.py): `langgraph_netagent/langgraph_netagent/tools/probes.py`
- [Diagnosis and healing](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/nodes.py): `langgraph_netagent/langgraph_netagent/workflow/nodes.py`
- [Circuit breaker](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/edges.py): `langgraph_netagent/langgraph_netagent/workflow/edges.py`

### Day-2 operations

- [Baseline and telemetry](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py): `langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py`
- [Incident diagnosis](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py): `langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py`
- [SOP retrieval](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/tools/sop_retriever.py): `langgraph_netagent/langgraph_netagent/tools/sop_retriever.py`
- [Remediation planning](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py): `langgraph_netagent/langgraph_netagent/workflow/operational_nodes.py`
- [Sandbox preflight](https://github.com/xiaoxiaohexin/netops-ai-agent/blob/main/langgraph_netagent/langgraph_netagent/tools/sandbox.py): `langgraph_netagent/langgraph_netagent/tools/sandbox.py`

### Models and providers

- [Domain contracts](https://github.com/xiaoxiaohexin/netops-ai-agent/tree/main/langgraph_netagent/langgraph_netagent/models): `langgraph_netagent/langgraph_netagent/models`

### Other components

- **Network operator**
- **LLM service**
- **Approver**
- **Containerlab network**

## Connections

- Network operator → NetAgent CLI: provides intent
- NetAgent CLI → Design workflow: starts workflow
- Design workflow → Intent parsing: dispatches
- Intent parsing → LLM providers: requests parsing
- LLM providers → LLM service: queries
- Intent parsing → Topology generation: routes intent
- Topology generation → LLM providers: requests generation
- Topology generation → Domain contracts: produces topology
- Topology generation → Offline validation: submits topology
- Offline validation → Human approval: passes validation
- Approver → Human approval: decides
- Human approval → Deployment: authorizes deployment
- Deployment → Containerlab network: deploys lab
- Deployment → Probe verification: starts probes
- Probe verification → Diagnosis and healing: reports failures
- Diagnosis and healing → Deployment: retries deployment
- Diagnosis and healing → Circuit breaker: reports outcome
- NetAgent CLI → Day-2 workflow: starts operations
- Day-2 workflow → Baseline and telemetry: dispatches
- Baseline and telemetry → Incident diagnosis: supplies incident context
- Incident diagnosis → SOP retrieval: retrieves guidance
- Incident diagnosis → Remediation planning: informs plan
- Remediation planning → Sandbox preflight: preflights plan
- Remediation planning → Domain contracts: uses operational models
