Skip to content

jonhammer/gpt-neteng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT-NetEng

GitHub GitHub issues GitHub stars

Table of Contents

Description

GPT-NetEng is an AI-powered Network Engineer that can troubleshoot and configure live network devices on its own, with or without human guidance along the way.

Features

  • Real-time AI-driven troubleshooting and configuration of actual network devices
  • Intelligent analysis and decision-making based on output data (show commands, etc.) from devices
  • Support for various network devices and technologies

Requirements

  • Python 3.9+
  • Anthropic API key
  • SSH access to network devices

Lab Environment

I highly recommend using ContainerLab for setting up local lab environments.

In my testing I used cEOS.

Example

Topology/Device information

First tell GPT-NetEng what devices it's working with. You can provide an image or a description. In this example I provided the following:

There are 4 devices:
- lab1
- lab2
- lab3
- lab4

Use LLDP to figure out how they are connected

Problem description

Then I gave it the following task:

This is a new lab environment of EOS devices.

It is a lab so use whatever numbering schemas (IP, ASNs, etc) you desire.

Since this is a lab you may make changes to all devices at once at each step if you want.

Configure all the connected links on our devices as point to point layer 3 links (e.g., /30s between each device).

Configure BGP on all devices and advertise the loopback interfaces into BGP.

You can configure these steps in whatever order you think is most efficient.

When you finish configuration, verify connectivity by running a ping from lab1 to lab3 loopback ip. If you can ping, you are done. If you can't ping, troubleshoot and fix the issue.

It took a total of 151 seconds for it to configure and verify everything without any human intervention.

You can see how it worked through the task here.

How it Works

  1. gpt-neteng analyzes the topology and the task description.
  2. It decides on an approach, and iteratively provides the commands it wants to run.
  3. At each step, the plan is presented to the user for confirmation (or optionally, without confirmation).
  4. gpt-neteng executes the necessary commands on the specified network devices using Netmiko.
  5. The output of the commands is captured and analyzed for further action.
  6. gpt-neteng iteratively refines the plan based on the command outputs and user feedback.
  7. Once the task is completed successfully, a summary of the actions taken is provided.

Installation

  1. Clone the repository:

    git clone https://github.com/jonhammer/gpt-neteng.git
    
  2. Change to the project directory:

    cd gpt-neteng
    
  3. Create a virtual environment:

    python3 -m venv venv
    source venv/bin/activate
    
  4. Install the package:

    pip install .
    
  5. Create a .env file in the project root and add your Anthropic API key:

    ANTHROPIC_API_KEY=your_api_key_here
    

Usage

CLI

To run the gpt-neteng CLI, use the following command:

gpt-neteng [options]

If no arguments are provided, the CLI will prompt you interactively for the required information.

Options

  • --topology: Path to the topology file (txt or image)
  • --task: Path to the task description file
  • --username: Username for device connection
  • --password: Password for device connection
  • --device-type: Device type (default: arista_eos)
  • --loglevel: Logging level (default: WARNING)
  • --logfile: Path to the log file (leave blank to log to console)
  • --auto-run: Run commands without confirmation
Example
gpt-neteng --topology example-lab.jpg --task example-task.txt --username admin --password admin

Docker

Not currently recommended, web app coming soon.

To run gpt-neteng using Docker Compose:

  1. Build the Docker image:

    docker compose build
    
  2. Start the container:

    docker compose run app
    

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

The AI Network Engineer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published