How automateyournetwork/netbox_react_agent works
Project Type and Purpose
• This is a self-contained, AI-driven network-management application.
• It exposes a chat-style UI (via Streamlit) that translates natural-language queries into CRUD calls against a NetBox instance.
• It can run in two modes:
• “Main” branch: calls out to the OpenAI API (ChatGPT/GPT-4o)
• “Ollama” branch: invokes a local LLM via Ollama
File Structure
• Top level
• docker-compose.yml: orchestrates containers, sets up environment variables (NetBox URL, token, OpenAI key)
• docker/Dockerfile: builds the Python/Streamlit image
• requirements.txt: Python dependencies (streamlit, langchain, openai, requests, etc.)
• scripts/startup.sh: container entrypoint, environment prep
• netbox_react_agent/
• netbox_react_agent.py: main application logic (Streamlit UI + ReAct orchestration)
• netbox_apis.json: static description of NetBox endpoints for dynamic tool selection
• README.md: high-level architecture, setup, branch differences
README for Additional Insights
• Key Components called out:
• NetBoxController — wrapper around NetBox REST API
• LangChain ReAct Agent — orchestrator for natural-language tools
• Streamlit Interface — web frontend
• External dependencies: NetBox API, OpenAI API or local Ollama LLM
a. Main Components
1) User/Browser (frontend client)
2) Streamlit Web App (Python container)
3) ReAct Agent (LangChain orchestration layer)
4) NetBoxController (tool for CRUD operations)
5) LLM Service
– External OpenAI API (cloud)
– or Ollama local LLM
6) NetBox API (external network-inventory service)
7) Docker/Docker-Compose (deployment layer)
b. Relationships & Data Flow
– The user issues a query in the browser → HTTP to Streamlit server
– Streamlit forwards the query to the ReAct Agent
– ReAct Agent may call:
• NetBoxController to fetch or modify data
• LLM Service to interpret or generate API calls
– NetBoxController issues REST calls to the NetBox API, returns JSON
– The Agent composes a response, hands it back to the Streamlit UI
– Streamlit renders the result in the browser
– Docker-Compose ensures the container is configured with environment variables and port mapping
c. Architectural Patterns & Principles
– Single-page web UI and backend logic combined in one process (Streamlit)
– ReAct pattern via LangChain: dynamic tool selection + LLM reasoning loop
– Clear separation of concerns: UI layer, orchestration layer, tool layer, external services
d. Key Technologies & Libraries
– Containerization: Docker, Docker-Compose
– Web UI: Streamlit
– LLM orchestration: LangChain ReAct Agent
– AI backends: OpenAI API or Ollama local LLM
– Network API client: NetBoxController (requests-based)