Vera Cloud H24

Execution Engine

Serverless Execution Engine

The core of the system includes a Serverless Execution Engine polyglot, capable of starting isolated and secure runtime environments for executing real scripts in Python and JavaScript.

Python Sandbox

Ambiente completo con librerie standard, requests, beautifulsoup4, pandas e supporto matplotlib.

JavaScript Runtime

Node.js-compatible con fetch API, JSON processing e integrazione nativa con servizi cloud.

Total Isolation

Every execution occurs in an isolated sandbox, zero interference between users or simultaneous tasks.

Advanced Web Scraping

This component handles advanced process automation and large-scale Web Scraping operations, bypassing dynamic blocks and managing web page rendering directly server-side.

βœ“ Dynamic Content Handling

Rendering JavaScript lato server per siti SPA/React

βœ“ Anti-Bot Evasion

Rotazione user-agent, gestione cookies e sessioni

βœ“ Structured Data Extraction

Parsing HTML, CSS selectors, XPath e regex

πŸ”” Webhook & External Integration

Every Virtual Server has a unique webhook URL that allows receiving events from external systems (Stripe, Facebook, Zapier, remote crons) and triggering code execution automatically.

πŸ“Œ ID Server (copiabile dalla console)

Ogni server ha un ID univoco visibile e copiabile dalla card "Webhook Endpoint" nella console.

πŸ” URL protetto da Secret Token

L'URL webhook include un secret token auto-generato. Solo chiamate con il token corretto vengono elaborate.

πŸ“‹ Esempio curl (Linux/macOS):

curl -X POST "https://app.neuralaiweb.com/functions/receiveWebhook?server_id=TUO_ID&secret=TUO_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"event":"test"}'

⚑ Server Power Management

Your Virtual Server is a persistent Record: you can power it off to drive costs to zero and back on automatically or on demand, without losing identity, configuration or files.

Automatic Time Scheduling

Enable scheduling to power the server on/off in preset time windows. A cron automation checks the required state every 5 minutes and aligns status + Cloud Run, respecting the configured timezone.

On/off times

E.g. on at 09:00, off at 18:00

Active days

Default Mon–Fri; individual days selectable

Timezone

IANA, e.g. Europe/Rome, Asia/Tokyo

Overnight windows

Handled automatically (e.g. 22:00β†’06:00)

The server state (off/active) is an execution gate: when off, cron executions are skipped, guaranteeing zero cost.

Webhook Control (on-demand power)

Public token-authenticated endpoint to power on, off or toggle the server state from any external system (Home Assistant, n8n, cron, custom dashboards).

πŸ“Œ Parameters

  • β€’ server_id β€” server ID (from the console)
  • β€’ token β€” power_webhook_token (generated and regenerable from the modal)
  • β€’ action β€” on | off | toggle

πŸ“‹ curl example (Windows β€” aggiungi --ssl-no-revoke)

curl --ssl-no-revoke "https://neuralaiweb.base44.app/functions/toggleServerPowerViaWebhook?server_id=TUO_ID&token=TUO_TOKEN&action=on"
# toggle (inverte lo stato attuale)
curl "https://neuralaiweb.base44.app/functions/toggleServerPowerViaWebhook?server_id=TUO_ID&token=TUO_TOKEN&action=toggle"

JSON response with previous and new state. The token is regenerable from the "Power scheduling" modal in the server console (⏰ button after Stop).

πŸ“¦ Python Libraries available on Cloud Run

The Cloud Run container includes these pre-installed libraries, available only when Cloud Run is active. In AI Engine mode they are simulated by Gemini.

LibreriaVersioneUtilizzo tipico
pandas3.xDataFrames, CSV/Excel, analisi e trasformazione dati
numpy2.xCalcoli numerici, array multidimensionali, algebra lineare
matplotliblatestGrafici, visualizzazioni, heatmap, chart renderizzati nel terminale
openpyxllatestLettura/scrittura file Excel (.xlsx), formattazione celle
requestslatestChiamate HTTP sincrone, API REST esterne, download file
beautifulsoup4latestWeb scraping HTML, parsing DOM, CSS selectors
httpxlatestClient HTTP asincrono, streaming, HTTP/2
python-multipartlatestUpload file multipart/form-data
fastapi + uvicornlatestServer HTTP interno del container Cloud Run

Esempio β€” analisi dati con pandas + numpy:

import pandas as pd
import numpy as np

df = pd.DataFrame({
    'vendite': [120, 450, 230, 870, 340],
    'mese': ['Gen', 'Feb', 'Mar', 'Apr', 'Mag']
})
print("Media vendite:", df['vendite'].mean())
print("Deviazione std:", np.std(df['vendite'].values))
print(df.describe())

⚠️ Installare ulteriori librerie non è supportato a runtime. Apri un ticket se ne hai bisogno.

πŸ“ File Context β€” Passare file del server al codice

I file caricati nel File Explorer del server vengono iniettati automaticamente nell'ambiente Cloud Run come dizionario Python SERVER_FILES. Nessuna configurazione richiesta.

πŸ“Œ Struttura di SERVER_FILES

# SERVER_FILES Γ¨ sempre disponibile β€” nessun import necessario
# Struttura: { "nome_file.ext": "contenuto testuale" }

print(SERVER_FILES.keys())
# β†’ dict_keys(['clienti.csv', 'config.json', 'script.py'])

βœ… Esempio 1 β€” Leggi un CSV e analizzalo con pandas

import pandas as pd
import io

csv_text = SERVER_FILES.get("vendite.csv", "")
if not csv_text:
    print("❌ File 'vendite.csv' non trovato nel File Explorer")
else:
    df = pd.read_csv(io.StringIO(csv_text))
    print(f"Righe: {len(df)}, Colonne: {list(df.columns)}")
    print(df.head())
    print("\nStatistiche:")
    print(df.describe())

βœ… Esempio 2 β€” Leggi JSON di configurazione

import json

raw = SERVER_FILES.get("config.json", "{}")
config = json.loads(raw)
print("API endpoint:", config.get("api_url"))
print("Max retries:", config.get("max_retries", 3))

βœ… Esempio 3 β€” Lista contatti per campagna outbound

import pandas as pd, io, httpx, asyncio

API_KEY = "nai_TUACHIAVE"
BASE_URL = "https://app.neuralaiweb.com"

df = pd.read_csv(io.StringIO(SERVER_FILES.get("contatti.csv", "")))

async def run():
    async with httpx.AsyncClient() as client:
        for _, row in df.iterrows():
            numero = str(row['numero']).strip()
            if numero.startswith('3'): numero = f"+39{numero}"
            resp = await client.post(
                f"{BASE_URL}/api/functions/createOutboundCallPublic",
                headers={"X-API-Key": API_KEY},
                json={"to_number": numero, "topic": str(row['argomento']),
                      "voice_type": "female", "language": "Italian (Italiano)",
                      "knowledge_mode": "topic_only"},
                timeout=15.0
            )
            status = "βœ…" if resp.status_code == 200 else "❌"
            print(f"{numero}: {status}")
            await asyncio.sleep(1.5)

asyncio.run(run())  # βœ… Compatibile: automaticamente convertito in new_event_loop().run_until_complete()

πŸ”§ Come caricare un file

  1. Apri Console Server β†’ tab File Explorer
  2. Clicca Carica file
  3. Seleziona il file (CSV, JSON, TXT, PY, JS β€” non Excel)
  4. Il file appare nella lista
  5. Usa SERVER_FILES["nome_file"] nel codice
  6. Esegui β€” Cloud Run riceve i file automaticamente

πŸ“‹ Tipi di file supportati

.csv.json.txt.py.js

⚠️ I nomi file sono case-sensitive.
I file Excel (.xlsx/.xls) non sono supportati. Salvali come CSV prima di caricarli (Excel β†’ Salva con nome β†’ CSV).

πŸ’Ύ Salvataggio file da codice & Upload via URL

Il File Explorer Γ¨ un database (entitΓ  FileSandbox), non il filesystem del container. open("file.txt", "w") scrive solo sul filesystem effimero di Cloud Run e il file non apparirΓ  nel File Explorer. Per salvare un file nel File Explorer, il codice deve stampare a stdout un marker speciale che il backend intercetta e persiste.

βœ… Salvataggio file di testo (CSV, TXT, JSON, PY, JS)

# Stampa il marker, il contenuto e il marker di chiusura
print("===SAVE_FILE:risultato.txt===")
print(contenuto_del_file)
print("===END_FILE===")
# Il file appare nel File Explorer dopo l'esecuzione

🌐 Upload via URL β€” Scarica un file dal web e salvalo nel File Explorer

import requests

# Scarica un file da un URL web
url = "https://example.com/dati.csv"
resp = requests.get(url, timeout=15)
contenuto = resp.text

# Salva il contenuto nel File Explorer del server
print("===SAVE_FILE:dati.csv===")
print(contenuto)
print("===END_FILE===")
# Il file scaricato appare nel File Explorer e diventa
# accessibile come SERVER_FILES["dati.csv"] nelle esecuzioni successive

πŸ”— Salvataggio link URL (senza scaricare il contenuto)

# Salva solo il riferimento URL nel File Explorer (es. video generato da API)
print(f"===SAVE_FILE_URL:video.mp4:{video_url}===")
# Il File Explorer mostra il file come link cliccabile per il download

πŸ–ΌοΈ Salvataggio immagine da URL

# Salva un'immagine da URL nel File Explorer (anteprima visuale)
print(f"===SAVE_IMAGE_URL:grafico.png:{image_url}===")

πŸ’‘ Note tecniche per sviluppatori

  • β€’ SAVE_FILE: il contenuto viene salvato in FileSandbox (database). Estensioni supportate: .py, .js, .txt, .json, .csv
  • β€’ SAVE_FILE_URL: salva un riferimento URL (link cliccabile). Ideale per file binari (video, audio) generati da API esterne
  • β€’ SAVE_IMAGE_URL: salva un'URL immagine con anteprima visuale nel File Explorer
  • β€’ Per scaricare file dal web usa requests.get(url) (Python) o fetch(url) (JS) + marker SAVE_FILE
  • β€’ I file salvati sono disponibili come SERVER_FILES["nome"] nelle esecuzioni successive

Specifiche Tecniche

Tempo Avvio

< 3 secondi

Memoria

2 GB β†’ 4 GB

Base 2 GB, picchi fino a 4 GB

Storage

5 MB/file

max 50 file/server

Linguaggi

Python 3 + JS

⚠️ Codice Async (asyncio)

Le chiamate asyncio.run() vengono automaticamente convertite in asyncio.new_event_loop().run_until_complete() per compatibilitΓ  con l'ambiente Cloud Run (che esegue giΓ  un event loop FastAPI/Uvicorn).