In this chapter, we leave the isolated Cloud laboratories behind and move to local infrastructure. We learn how to design and implement an isolated infrastructure using a private virtual machine in the Proxmox environment, how to configure a stable database, and how to secure access keys directly in the operating system.
“We tested the Function Calling contract in a protected environment and understood how the brain in the Cloud communicates with our functions. Now it is time to take down the sandbox and build the physical framework for autonomy directly on the local server: we open Proxmox and configure our first virtual machine.”
Welcome to the implementation phase of our project. We leave the browser simulations behind and build a dedicated virtual server, ready to run continuously on your private hardware.
🔹Architecture Strategy (Local Server Design)
To implement this project professionally, we need an environment that is completely separate from your everyday computer. The cleanest approach is to use a Virtual Machine (or an isolated container) in the Proxmox environment, which will behave like an independent server on your network.
Inside this virtual server, we will host both components of our local Agent:
- Database Server (MariaDB): Our local inventory database, which will store the inventory tables (the external world the Agent will probe).
- Execution Environment (Python 3): Where our autonomous script will run, retrieving decisions from the Cloud and executing functions on the local database.
🔹Preparing the Virtual Server (Operating System)
Whether you choose to create a traditional Virtual Machine (VM) or a system container in Proxmox, we will use a clean Ubuntu Server distribution as our foundation.
Once your virtual server has started, open the terminal (Console) and run the following commands to update the system packages and install the basic tools our Agent needs:
# 1. Update the system packages
sudo apt update && sudo apt upgrade -y
# 2. Install the database server and Python environment
sudo apt install mariadb-server python3 python3-pip python3-venv -y
# 3. Make sure the database starts automatically with the system
sudo systemctl enable --now mariadb🔹Preparing the External World (Inventory SQL Structure)
For your AI Agent to have data to inspect and modify, we need to create the table structure on the local MariaDB server. In your virtual machine’s console, access the database by running the following command:
sudo mysql -u rootOnce you are in the database terminal, run the SQL code below to create the warehouse database, the hardware inventory table, and insert the first test records into the inventory:
CREATE DATABASE agent_warehouse;
USE agent_warehouse;
CREATE TABLE hardware_inventory (
id INT AUTO_INCREMENT PRIMARY KEY,
component_name VARCHAR(100) NOT NULL,
specs VARCHAR(255),
stock_count INT NOT NULL,
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
INSERT INTO hardware_inventory (component_name, specs, stock_count) VALUES
('RAM DDR3L', '8GB Kingston 1600MHz Low Voltage', 6),
('Intel NUC Mainboard', 'Replacement board for NUC 2012 i3', 2),
('SSD SATA', '500GB Crucial MX500', 12);
# Create a separate user that the Python script will use to connect to the database
CREATE USER 'agent_user'@'localhost' IDENTIFIED BY 'ParolaTaSecretaDB';
GRANT SELECT, INSERT, UPDATE, DELETE ON agent_warehouse.* TO 'agent_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;Replace ParolaTaSecretaDB with a strong, unique password for this user. This password is a secret and must not be published or included in any code you distribute.
After executing the EXIT; command, your local database is configured and waiting for its intelligent observer.
🔹Securing Credentials (Local Environment Variables)
An absolute rule in engineering is that we never write passwords or API keys in plain text directly inside Python code. If you show your script to someone, your security is compromised. In the production environment on our virtual machine, we address this by saving the credentials directly in the Linux user’s configuration file.
Open the terminal configuration file using the text editor:
nano ~/.bashrcGo directly to the end of the file and add the following two lines (replace the values with your actual credentials, including the API key generated in Step 1 in Google AI Studio):
export API_KEY="AIzaSy..."
export DB_PASSWORD="ParolaTaSecretaDB"Save and close the file (press CTRL+X, then Y and Enter). To make the system read the new keys immediately, run: source ~/.bashrc. Your credentials are now stored in the user’s configuration file and loaded into the shell environment.
Localhost (or the internal IP address 127.0.0.1). Network latency is extremely low, and communication takes place with minimal delay. Furthermore, the database server is not exposed to your home network (LAN), and no ports are open on your router. It remains isolated inside the virtual machine and cannot be accessed directly from the external network.🛠️ What’s Next in Episode 6? Our virtual machine is ready in Proxmox, the database has been populated with sample inventory data, and the access key is securely stored in the system. However, at this point, the server is like an empty factory: we have the infrastructure, but we are missing the worker.
In the next episode, we move into pure programming. We will write the actual agent.py script directly inside the virtual machine. You will learn how to connect Python code to the local database and how to implement the Function Calling mechanism through the Gemini API. We will examine in detail the exchange of messages between the local application and the AI model, using direct HTTP REST calls to understand every stage of the process transparently. Get ready—we are bringing the local script to life!
Your local infrastructure has been successfully deployed and secured. The virtual server is running and laying the foundations for your first autonomous network.
Stay Free! Stay Hidden! Stay Autonomous!
⚙️ Appendix: AI Engineering Mini-Course (Technical Clarifications)
- Virtual Machine / Virtual Server: A software emulation of a physical computer that runs a fully independent operating system, using a portion of the host server’s hardware resources (CPU, RAM, storage).
- Localhost (127.0.0.1): A standard IP address used by an operating system to send data packets to itself, allowing local applications to communicate without going through the external network.
- Bashrc (~/.bashrc): A hidden configuration file in Linux systems that stores user settings and environment variables for Bash sessions.
- MariaDB User Privileges: The SQL security mechanism that allows a user’s permissions to be restricted. In our configuration, the Agent’s user is granted access only to the
agent_warehousedatabase, reducing the impact of a potential compromise.
