Skip to main content

An AI agent that diagnoses network connectivity issues using OpenAI's Responses API

Project description

Connectivity Agent

A small demonstration project showing how to build a multi-tool AI Agent using OpenAI’s Responses API. Although intended as an example, it also works amazingly well for network connectivity checking.

Overview

The agent runs in a terminal. It chooses which tools to run for your query, interprets their output, and explain results in plain language.

The included tools are:

  • ping
  • curl
  • ports
  • tracert
  • nslookup
  • ipconfig
  • routing_table

Adding another tool requires only:

  1. A Python function that performs the task
  2. A brief structured description so the agent knows how to call it

Why This Example Might Be Useful

If you're learning the Responses API or experimenting with AI agents that use multiple tools, this example shows a simple pattern without extra framework code. The source is in a single file.

Example Queries

Basic Connectivity >> How is the connection to google?

Comprehensive Analysis >> Describe the connectivity to www.amazon.com. Be exhaustive.

Performance Comparison >> Compare response times between AWS on the East and West coast.

DNS Troubleshooting >> I can't reach example.com. Is it a DNS problem?

Local Network Diagnostics >> Show me my current network configuration and default gateway.

Port Analysis >> What services are currently listening on my machine?

Route Investigation >> Why might packets to cloudflare.com be taking an unusual path?

Multi-Protocol Testing >> Can I reach github.com? Check both ping and HTTP connectivity.

Security Assessment >> Are there any unexpected connections to external IP addresses?

Network Path Optimization >> Which endpoint has better routing from my location: https://www.nasa.gov or https://www.esa.int ?

Requirements

  • Python 3.10 or higher
  • OpenAI API Key

Installation

Installing from PyPI (Coming Soon)

Once published, you can install the package directly:

pip install connectivity-agent

Installing from Source

  1. Clone the repository:
git clone https://github.com/brocla/connectivity_agent.git
cd connectivity_agent
  1. Install the package:
pip install -e .

Or install the required dependencies manually:

pip install openai>=2.8.0

API Key Setup

The Connectivity Agent requires an OpenAI API key to function. You can obtain an API key from OpenAI's platform.

Setting Up Your API Key

You have two options for providing your API key:

Option 1: Environment Variable (Recommended)

Set the OPENAI_API_KEY environment variable:

On Windows:

setx OPENAI_API_KEY "your-api-key-here"

On Linux/Mac:

export OPENAI_API_KEY="your-api-key-here"

To make it permanent on Linux/Mac, add the export command to your ~/.bashrc or ~/.zshrc file.

Option 2: Direct Configuration

The OpenAI Python client will automatically look for the API key in the environment variable. Alternatively, you can modify the code to pass the key directly (not recommended for security reasons).

Usage

After installation and API key setup, run the agent:

If installed via pip:

connectivity-agent

If running from source:

python connectivity_agent.py

The agent will start an interactive REPL where you can ask connectivity-related questions.

Kudos

Thanks to Thomas Ptacek for his article You Should Write an Agent

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

connectivity_agent-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

connectivity_agent-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file connectivity_agent-0.1.0.tar.gz.

File metadata

  • Download URL: connectivity_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for connectivity_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0af9e280214d013bfbdfa19ac08e27f89da6d927a3291d23d438ca984542df81
MD5 987f0e9cf31c5fe9891052e88194f2ad
BLAKE2b-256 d756d3a852f7706743f7b0e3d15cb07e85253f8e894a81a19d94edd137660be2

See more details on using hashes here.

File details

Details for the file connectivity_agent-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for connectivity_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20fa3cb8305e0e77aea179fe36148aae777870755b877ef88df4e0a6708c2bdf
MD5 e04531cc1a0b53df06cd15a833ed63ee
BLAKE2b-256 c29d33ef89a5a5409b9cc79f10cadb2c9b7621f914e29caa38897c0a818e58ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page