Deprecated: Creation of dynamic property Timber\Site::$pingback is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Site.php on line 180

Deprecated: Creation of dynamic property Timber\User::$name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/User.php on line 118

Deprecated: Creation of dynamic property Timber\Post::$has_disclaimer is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_edit_lock is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_edit_last is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_thumbnail_id is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_meta_box_present is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_send_notification is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_modify_title_and_content is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_notification_custom_heading is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_notification_custom_content is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$tipologia is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_tipologia is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$attributi is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_attributi is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$in_evidenza_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_in_evidenza_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$inviato_in_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_inviato_in_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$fonte is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_fonte is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$fonte_url is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_fonte_url is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_category is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_blz_affiliation_attributes is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_content_type is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_attributes is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_speciali is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_focuskw is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_metadesc is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_linkdex is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_content_score is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_focuskeywords is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_keywordsynonyms is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_estimated-reading-time-minutes is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$response_body is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_indexnow_last_ping is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_oembed_cc3c9d92d41c318df470c1eb1e9d6d0d is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_oembed_time_cc3c9d92d41c318df470c1eb1e9d6d0d is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_date_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$ping_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_password is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$to_ping is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$pinged is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_content_filtered is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$guid is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$menu_order is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_mime_type is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_count is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$filter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71
Codex CLI: cos'è l'agente AI di OpenAI che scrive e interpreta codice dal terminale

Codex CLI: cos'è l'agente AI di OpenAI che scrive e interpreta codice dal terminale

Codex CLI è il nuovo agente AI open source di OpenAI pensato per gli sviluppatori che lavorano da terminale. Utilizza modelli avanzati come o3 e o4-mini per leggere, scrivere ed eseguire codice in locale, in modo sicuro e multimodale. Ecco come funziona in dettaglio.

OpenAI, azienda guidata da Sam Altman fucina dei modelli GPT (Generative Pre-trained Transformer) e del chatbot ChatGPT, ha annunciato il rilascio di Codex CLI, un potente agente di programmazione eseguibile direttamente da terminale e disponibile come progetto open source. Pensato per gli sviluppatori che fanno ampio uso della finestra del terminale, Codex CLI integra i modelli linguistici di nuova generazione (tra cui o3 e o4-mini) con la capacità concreta di leggere, scrivere ed eseguire codice in locale, in modo sicuro, sandboxato e multimodale.

Con Codex CLI, lo sviluppo di codice programmazione governato da chatbot diventa una realtà flessibile e soprattutto controllabile.

Cos’è Codex CLI e come funziona

Come anticipato nell’introduzione, Codex CLI è un agente AI leggero che funziona da riga di comando. Esso consente di:

  • Analizzare e comprendere progetti esistenti.
  • Generare codice a partire da descrizioni testuali o immagini.
  • Correggere bug, eseguire il refactoring del codice (riscrittura del codice per renderlo più chiaro, efficiente o manutenibile, senza cambiarne il comportamento), generare test.
  • Eseguire comandi e script in un ambiente protetto.

Il tutto avviene senza mai dover abbandonare il terminale e senza compromettere la riservatezza del codice sorgente, che rimane sempre sul sistema locale dell’utente. Senza quindi mai essere trasferito sui server di OpenAI o condiviso con altri soggetti.

Architettura e modelli AI

Il “motore cognitivo” alla base di Codex CLI è alimentato dai nuovi modelli OpenAI o3 e o4-mini, progettati per offrire abilità di reasoning guidate dall’AI rapide, efficienti e contestuali.

Codex CLI di default utilizza o4-mini per spingere sulle prestazioni, ma può essere configurato per adoperare o3 o qualsiasi altro modello disponibile tramite l’API OpenAI.

In futuro, Codex CLI supporterà anche il più recente modello GPT-4.1, ampliando ulteriormente le sue capacità di comprensione e generazione di codice.

Principali funzionalità

Codex CLI si distingue per una serie di funzionalità avanzate che rendono lo sviluppo assistito da AI flessibile, sicuro ed efficiente. L’installazione immediata tramite il comando npm install -g @openai/codex consente di iniziare a utilizzare lo strumento in pochi secondi, senza configurazioni complesse, integrandosi perfettamente con qualsiasi ambiente di sviluppo basato su terminale.

Uno degli aspetti più innovativi è il supporto per l’input multimodale: oltre al classico input testuale, infatti, Codex CLI può analizzare e interpretare immagini, screenshot e diagrammi, offrendo suggerimenti e trasformazioni anche a partire da contenuti visuali. Una manna dal cielo in tutti quei contesti in cui è necessario comprendere rapidamente la logica di un’interfaccia o documentare graficamente il comportamento del software.

Il cuore operativo di Codex CLI è rappresentato da un workflow di approvazione modulare, pensato per adattarsi a diversi livelli di automazione e controllo da parte dello sviluppatore.

Il flusso predefinito, chiamato Suggest, propone modifiche al codice o ai file e attende la conferma esplicita dell’utente prima di applicarle. La modalità Auto Edit permette invece al sistema di modificare direttamente i file, mantenendo però un controllo umano per l’esecuzione dei comandi, ideale per attività di refactoring frequenti o modifiche di routine.

Per i contesti più automatizzati, la modalità Full Auto consente al sistema di operare in completa autonomia, ma solo all’interno di una sandbox locale e senza accesso alla rete, garantendo così la massima sicurezza.

La sicurezza di Codex CLI

In chiusura del precedente paragrafo abbiamo parlato di sandbox. Ecco, Codex CLI opera sempre in un contesto isolato, con accesso limitato esclusivamente al repository corrente.

Si tratta di uno schema intelligente che protegge l’ambiente di sviluppo da modifiche accidentali o da operazioni su directory sensibili, riducendo il rischio di errori o violazioni dei dati. Inoltre, lo strumento è version control friendly: se rileva che il codice si trova in una directory non tracciata da un sistema di versionamento come Git, genera automaticamente un avviso.

L’esortazione a lavorare sempre in ambienti sottoposti a versioning non solo rafforza le buone pratiche di sviluppo, ma previene anche la perdita accidentale di modifiche o il tracciamento non intenzionale di codice.

Su macOS 12+, Codex CLI crea una sandbox avvalendosi di Seatbelt, con il blocco totale delle funzionalità di rete. Lato Linux, l’agente AI opera all’interno di una sandbox Docker con repository montato in modalità read-write e rete bloccata tramite iptables/ipset. In ambiente Windows, il supporto è ancora sperimentale ed è implementato ricorrendo a WSL 2.

Installazione e utilizzo

Come accennato in precedenza, l’installazione di Codex CLI è davvero immediata. Basta il comando seguente per attivare l’agente AI sui propri sistemi:

npm install -g @openai/codex

Codex CLI è un pacchetto Node.js, quindi è necessario avere Node.js installato (versione consigliata: ≥18.x). Node.js predispone automaticamente npm (Node Package Manager), che serve a eseguire il comando npm install.

Per effettuare con successo l’autenticazione e usare il software, è necessario impartire il comando che segue. In questo modo si imposta la propria API key OpenAI come variabile d’ambiente:

export OPENAI_API_KEY="la-tua-chiave-api"

Per iniziare a lavorare subito con Codex CLL, si può quindi digitare qualcosa di simile:

codex "spiega il contenuto di questo repository"

È possibile passare da una modalità di funzionamento all’altra usando ad esempio questi comandi:

codex --auto-edit
codex --full-auto

Codex CLI può essere integrato in pipeline CI/CD, GitHub Actions o script automatizzati.

Credit immagine in apertura: iStock.com – Kindamorphic

Ti consigliamo anche

Link copiato negli appunti