# tejas-pd/net_assist architecture

> Architecture diagram of the GitHub repository tejas-pd/net_assist, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tejas-pd/net_assist
- Repository: https://github.com/tejas-pd/net_assist

## Overview

The product is a natural-language network administration assistant with a parallel local CLI. Its main workflow is user request → local LLM tool selection → assistant validation and MCP invocation → server tool dispatch → policy-checked network operation → result returned for explanation. The excerpts show the core calls and execution boundary; some assistant and server code is omitted, so links beyond those calls are based only on explicit README statements.

Main entry points: [`server/mcp_server.py`](https://github.com/tejas-pd/net_assist/blob/main/server/mcp_server.py) (MCP Server Tools), [`core/runner.py`](https://github.com/tejas-pd/net_assist/blob/main/core/runner.py) (Command Runner), [`assistant.py`](https://github.com/tejas-pd/net_assist/blob/main/assistant.py) (Natural-language Assistant), [`core/policy.py`](https://github.com/tejas-pd/net_assist/blob/main/core/policy.py) (Network Policy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User Interaction"]
  node_assistant["Natural-language Assistant<br/>[assistant.py]"]
  node_ollama["Local Ollama LLM"]
  node_cli["Local CLI<br/>[cli.py]"]
end

subgraph group_mcp["MCP Tooling"]
  node_mcp_server["MCP Server Tools<br/>[mcp_server.py]"]
end

subgraph group_safety["Policy and Network Operations"]
  node_policy["Network Policy<br/>[policy.py]"]
  node_policy_config["Policy Configuration"]
  node_firewall["Firewall Controls<br/>[network_tools.py]"]
  node_bandwidth_limit["Bandwidth Limiting<br/>[network_tools.py]"]
  node_connectivity["Connectivity Check<br/>[network_tools.py]"]
  node_bandwidth_test["Bandwidth Test<br/>[network_tools.py]"]
end

subgraph group_execution["Command Execution"]
  node_runner["Command Runner<br/>[runner.py]"]
  node_audit_log["Audit Log"]
end

node_user(("Administrator"))
node_network_commands["Network Utilities"]

node_user -->|"submits request"| node_assistant
node_assistant -->|"sends request"| node_ollama
node_ollama -->|"selects tool"| node_assistant
node_assistant -->|"invokes tool"| node_mcp_server
node_mcp_server -->|"returns result"| node_assistant
node_assistant -->|"explains result"| node_user
node_user -->|"runs command"| node_cli
node_cli -->|"calls controls"| node_firewall
node_cli -->|"calls limiter"| node_bandwidth_limit
node_mcp_server -->|"dispatches tools"| node_firewall
node_mcp_server -->|"dispatches tool"| node_bandwidth_limit
node_mcp_server -->|"dispatches tool"| node_connectivity
node_mcp_server -->|"dispatches tool"| node_bandwidth_test
node_mcp_server -->|"loads policy"| node_policy
node_mcp_server -->|"configures runner"| node_runner
node_policy -->|"loads rules"| node_policy_config
node_firewall -->|"validates target"| node_policy
node_bandwidth_limit -->|"validates settings"| node_policy
node_connectivity -->|"validates target"| node_policy
node_bandwidth_test -->|"validates target"| node_policy
node_firewall -->|"runs commands"| node_runner
node_bandwidth_limit -->|"runs commands"| node_runner
node_connectivity -->|"runs monitor"| node_runner
node_bandwidth_test -->|"observes target"| node_runner
node_runner -->|"executes commands"| node_network_commands
node_runner -->|"records results"| node_audit_log

click node_assistant "https://github.com/tejas-pd/net_assist/blob/main/assistant.py"
click node_cli "https://github.com/tejas-pd/net_assist/blob/main/cli.py"
click node_mcp_server "https://github.com/tejas-pd/net_assist/blob/main/server/mcp_server.py"
click node_policy "https://github.com/tejas-pd/net_assist/blob/main/core/policy.py"
click node_policy_config "https://github.com/tejas-pd/net_assist/blob/main/policies/network_policy.yaml"
click node_firewall "https://github.com/tejas-pd/net_assist/blob/main/core/network_tools.py"
click node_bandwidth_limit "https://github.com/tejas-pd/net_assist/blob/main/core/network_tools.py"
click node_connectivity "https://github.com/tejas-pd/net_assist/blob/main/core/network_tools.py"
click node_bandwidth_test "https://github.com/tejas-pd/net_assist/blob/main/core/network_tools.py"
click node_runner "https://github.com/tejas-pd/net_assist/blob/main/core/runner.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_assistant,node_ollama,node_cli toneBlue
class node_mcp_server toneAmber
class node_policy,node_policy_config,node_firewall,node_bandwidth_limit,node_connectivity,node_bandwidth_test toneMint
class node_runner,node_audit_log toneRose
class node_user,node_network_commands toneIndigo
```

## Components

### User Interaction

- [Natural-language Assistant](https://github.com/tejas-pd/net_assist/blob/main/assistant.py): `assistant.py`
- **Local Ollama LLM**
- [Local CLI](https://github.com/tejas-pd/net_assist/blob/main/cli.py): `cli.py`

### MCP Tooling

- [MCP Server Tools](https://github.com/tejas-pd/net_assist/blob/main/server/mcp_server.py): `server/mcp_server.py`

### Policy and Network Operations

- [Network Policy](https://github.com/tejas-pd/net_assist/blob/main/core/policy.py): `core/policy.py`
- [Policy Configuration](https://github.com/tejas-pd/net_assist/blob/main/policies/network_policy.yaml): `policies/network_policy.yaml`
- [Firewall Controls](https://github.com/tejas-pd/net_assist/blob/main/core/network_tools.py): `core/network_tools.py`
- [Bandwidth Limiting](https://github.com/tejas-pd/net_assist/blob/main/core/network_tools.py): `core/network_tools.py`
- [Connectivity Check](https://github.com/tejas-pd/net_assist/blob/main/core/network_tools.py): `core/network_tools.py`
- [Bandwidth Test](https://github.com/tejas-pd/net_assist/blob/main/core/network_tools.py): `core/network_tools.py`

### Command Execution

- [Command Runner](https://github.com/tejas-pd/net_assist/blob/main/core/runner.py): `core/runner.py`
- **Audit Log**

### Other components

- **Administrator**
- **Network Utilities**

## Connections

- Administrator → Natural-language Assistant: submits request (evidence: `README.md`)
- Natural-language Assistant → Local Ollama LLM: sends request (evidence: `README.md`)
- Local Ollama LLM → Natural-language Assistant: selects tool (evidence: `README.md`)
- Natural-language Assistant → MCP Server Tools: invokes tool (evidence: `assistant.py`)
- MCP Server Tools → Natural-language Assistant: returns result (evidence: `README.md`)
- Natural-language Assistant → Administrator: explains result (evidence: `README.md`)
- Administrator → Local CLI: runs command (evidence: `cli.py`)
- Local CLI → Firewall Controls: calls controls (evidence: `cli.py`)
- Local CLI → Bandwidth Limiting: calls limiter (evidence: `cli.py`)
- MCP Server Tools → Firewall Controls: dispatches tools (evidence: `server/mcp_server.py`)
- MCP Server Tools → Bandwidth Limiting: dispatches tool (evidence: `server/mcp_server.py`)
- MCP Server Tools → Connectivity Check: dispatches tool (evidence: `server/mcp_server.py`)
- MCP Server Tools → Bandwidth Test: dispatches tool (evidence: `server/mcp_server.py`)
- MCP Server Tools → Network Policy: loads policy (evidence: `server/mcp_server.py`)
- MCP Server Tools → Command Runner: configures runner (evidence: `server/mcp_server.py`)
- Network Policy → Policy Configuration: loads rules (evidence: `core/policy.py`)
- Firewall Controls → Network Policy: validates target (evidence: `core/network_tools.py`)
- Bandwidth Limiting → Network Policy: validates settings (evidence: `core/network_tools.py`)
- Connectivity Check → Network Policy: validates target (evidence: `core/network_tools.py`)
- Bandwidth Test → Network Policy: validates target (evidence: `core/network_tools.py`)
- Firewall Controls → Command Runner: runs commands (evidence: `core/network_tools.py`)
- Bandwidth Limiting → Command Runner: runs commands (evidence: `core/network_tools.py`)
- Connectivity Check → Command Runner: runs monitor (evidence: `core/network_tools.py`)
- Bandwidth Test → Command Runner: observes target (evidence: `core/network_tools.py`)
- Command Runner → Network Utilities: executes commands (evidence: `core/runner.py`)
- Command Runner → Audit Log: records results (evidence: `core/runner.py`)
