This repository implements an autonomous vending‑machine business simulation. The agent runs daily loops, uses tool‑calling (email, storage queries, waiting for next day, etc.), and logs everything to a SQLite database.
- Back‑room ➜ Vending‑Machine Restocking – After a supplier delivery is processed, the simulation now automatically moves matching items from back‑room storage into empty vending‑machine slots.
- Sales Simulation – When items are stocked, daily sales are calculated, logged in the
salestable, and the balance is updated. - Reporting Script (
report.py) – A lightweight CLI script that prints:- Balance history over time
- Email activity summary (inbound/outbound counts)
- Current back‑room storage inventory
- Daily sales totals
- Tool‑Calling Support for Cerebras – The model client now forwards
toolsschemas to the Cerebras endpoint, parsestool_callscorrectly, and stores them as JSON. - Database Enhancements – Added a
machine_slotstable to persist the vending‑machine slot state each day.
# Activate the virtual environment (already set up)
source venv/bin/activate
# Run a short simulation (e.g., 5 actions)
python run_sim.py --max-messages 5The simulation prints daily reports, executes tools, and updates the SQLite DB at /home/hnai/vending_simulation.db.
python report.pyThe script reads the same SQLite DB and outputs concise tables of balance, emails, storage, and sales.
agent.py– Core autonomous agent logic.main_simulation.py– Orchestrates daily cycles, deliveries, restocking, and reporting.model_client.py– Handles calls to the Cerebras API with function‑calling support.tools.py– Implementssend_email,check_storage_quantities,wait_for_next_day, etc.storage.py– Back‑room inventory and pending deliveries.email_system.py– Email sending/receiving with DB logging.database.py– SQLite schema (includingmachine_slots).report.py– Quick‑look reporting CLI.
# Install dependencies (inside the repo)
pip install -r requirements.txtMake sure the .env file contains a valid CEREBRAS_API_KEY (lower‑case csk-…).
Feel free to extend the simulation (add more items, pricing, or richer supplier interactions) and use the report.py script to monitor performance over time.