Networking
Your browser calls your API, your API calls OpenAI, agents call tools — all over the network. You need this to debug timeouts and secure services.
IP = street address, port = apartment number, DNS = phone book, firewall = security guard.
Visual Workflows
Start here — study each diagram, then use + / − to zoom if needed.
Overview
Scroll inside the frame · use + / − to zoom
Scroll inside the frame · use + / − to zoom
Key Takeaways
- 1.Networking is how computers communicate — IP addresses, ports, DNS, and firewalls control every connection in your AI stack.
- 2.TCP is reliable (HTTP, databases).
- 3.DNS maps domain names to IPs.
- 4.HTTPS adds TLS encryption.
- 5.Security groups act as firewalls in the cloud.
Real Example
Scenario
Your agent can't connect to the vector database — connection times out every time.
What you would do
The DB is in a private subnet. Add a security group rule allowing port 5432 from the API subnet only.
Practice Task
Run ping google.com and nslookup google.com. Then run curl -v https://api.openai.com/v1/models (you will get 401 — that is expected; study the status code and headers in the output).
Commands
Commands to Remember
ping hostname # test if a host is reachablenslookup hostname # resolve domain name to IP addresscurl -v https://url # test an HTTP endpoint with full detailsnc -zv host port # check if a specific port is opentraceroute hostname # trace the network path hop by hop
Cheat Sheet
Quick recap
quick ref- •IP + port identifies every service on the network
- •DNS translates domain names to IP addresses
- •TCP = reliable · UDP = fast but may drop packets
- •HTTPS = HTTP encrypted with TLS
- •Common ports: 80 HTTP, 443 HTTPS, 5432 Postgres
- •Security groups / firewalls control allowed traffic
Common Mistakes
- ✕Exposing database ports to the internet
- ✕No timeouts on outbound HTTP calls
- ✕Ignoring latency when choosing cloud regions