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.
Ambiente completo con librerie standard, requests, beautifulsoup4, pandas e supporto matplotlib.
Node.js-compatible con fetch API, JSON processing e integrazione nativa con servizi cloud.
Every execution occurs in an isolated sandbox, zero interference between users or simultaneous tasks.
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
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"}'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.
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.
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).
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.
| Libreria | Versione | Utilizzo tipico |
|---|---|---|
| pandas | 3.x | DataFrames, CSV/Excel, analisi e trasformazione dati |
| numpy | 2.x | Calcoli numerici, array multidimensionali, algebra lineare |
| matplotlib | latest | Grafici, visualizzazioni, heatmap, chart renderizzati nel terminale |
| openpyxl | latest | Lettura/scrittura file Excel (.xlsx), formattazione celle |
| requests | latest | Chiamate HTTP sincrone, API REST esterne, download file |
| beautifulsoup4 | latest | Web scraping HTML, parsing DOM, CSS selectors |
| httpx | latest | Client HTTP asincrono, streaming, HTTP/2 |
| python-multipart | latest | Upload file multipart/form-data |
| fastapi + uvicorn | latest | Server 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.
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
SERVER_FILES["nome_file"] nel codiceπ Tipi di file supportati
β οΈ 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).
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
requests.get(url) (Python) o fetch(url) (JS) + marker SAVE_FILESERVER_FILES["nome"] nelle esecuzioni successiveTempo 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).