> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/it/comandi-powershell/new-psuaiagent.md).

# New-PSUAiAgent

New-PSUAiAgent crea una nuova definizione di agente IA in PowerShell Universal, comprese le relative istruzioni, il modello, la chiave API e gli strumenti consentiti.

## SINOSSI

Crea una nuova definizione di agente IA.

## SINTASSI

```powershell
New-PSUAiAgent -Name <String> [-Description <String>] [-Instructions <String>] [-Model <String>] [-ApiKey <Variable>] [-Provider <AiProvider>] [-Endpoint <String>] [-Tool <String[]>] [-Role <String[]>] [-AvailableInChat] [<ConnectionOptions>] [<CommonParameters>]
```

`<ConnectionOptions>`: `[-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]`.

## DESCRIZIONE

Crea e salva un agente IA con metadati del modello, istruzioni, una variabile di chiave API e gli strumenti consentiti. Il provider predefinito è `OpenAI`; sono supportati anche `Anthropic` e `Custom`. Un provider `Custom` richiede un URL `-Endpoint` assoluto. Usi `-AvailableInChat` per esporre l'agente nei selettori di chat della console di amministrazione e delle app generate.

## ESEMPI

```powershell
New-PSUAiAgent -Name SupportAgent -Description 'Tier 1 assistant' -Instructions 'Answer from the knowledge base first.' -Model gpt-4o-mini -Tool GetUsers,GetTickets
New-PSUAiAgent -Name SupportAgent -Model gpt-4o-mini -Instructions 'Answer from the knowledge base first.' -Tool GetTickets -AvailableInChat
```

## PARAMETRI

| Parametro                | Descrizione                                                        |
| ------------------------ | ------------------------------------------------------------------ |
| `-Name`                  | Nome dell'agente obbligatorio.                                     |
| `-Description`           | Descrizione dell'agente.                                           |
| `-Instructions`          | Istruzioni di sistema per l'agente.                                |
| `-Model`                 | Identificatore del modello usato per i completamenti.              |
| `-ApiKey`                | Variabile PSU che contiene la chiave API del provider.             |
| `-Provider`              | Provider di IA: `OpenAI` (predefinito), `Anthropic` o `Custom`.    |
| `-Endpoint`              | URL assoluto del provider; obbligatorio quando `-Provider Custom`. |
| `-Tool`                  | Nomi degli strumenti che l'agente può richiamare (alias `-Tools`). |
| `-Role`                  | Ruoli autorizzati ad accedere all'agente (alias `-Roles`).         |
| `-AvailableInChat`       | Rende l'agente selezionabile nei selettori di chat.                |
| `-ComputerName`          | URL o nome host del server di destinazione (alias `-Uri`).         |
| `-AppToken`              | Token dell'app dell'API di gestione.                               |
| `-Credential`            | Credenziali per l'autenticazione Basic dell'API di gestione.       |
| `-UseDefaultCredentials` | Usa le credenziali Windows correnti.                               |
| `-Integrated`            | Usa il client di gestione nel processo.                            |
| `-TrustCertificate`      | Ignora gli errori di convalida del certificato.                    |
| `-Cookies`               | Riutilizza i cookie di autenticazione della sessione.              |

## INPUT

Nessuno.

## OUTPUT

`PowerShellUniversal.Models.Intelligence.AiAgent`.

## AUTORIZZAZIONI

Il token di accesso richiede `intelligence.agents/create` per eseguire questo cmdlet in remoto.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/it/comandi-powershell/new-psuaiagent.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
