> 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/invoke-psuaiagent.md).

# Invoke-PSUAiAgent

## SYNOPSIS

Richiama un agente IA di PowerShell Universal.

## SYNTAX

```
Invoke-PSUAiAgent [-AiAgent] <Object> [-Prompt] <String> [-Parameters <Hashtable>] [-ComputerName <String>]
 [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate]
 [-Cookies] [-Wait] [-WaitTimeout <Int32>] [<CommonParameters>]
```

## DESCRIPTION

Avvia un job di prompt per un agente IA e restituisce il job creato. Il parametro `AiAgent` accetta il nome di un agente IA oppure un oggetto agente IA restituito da `Get-PSUAiAgent`. I valori aggiuntivi forniti tramite `Parameters` vengono serializzati e passati al job dell'agente come parametri supplementari. PowerShell Universal applica comunque l'autorizzazione di esecuzione e tutti i ruoli assegnati direttamente all'agente IA di destinazione.

## EXAMPLES

### Esempio 1

```powershell
PS C:\> Invoke-PSUAiAgent -AiAgent SupportAgent -Prompt "Summarize the deployment status."
```

Avvia un job di prompt per l'agente IA `SupportAgent`.

### Esempio 2

```powershell
PS C:\> Get-PSUAiAgent -Name SupportAgent | Invoke-PSUAiAgent -Prompt "Draft a response for the ticket." -Parameters @{ TicketId = 42; Customer = 'Contoso' }
```

Richiama l'oggetto agente IA inviato tramite pipeline e passa parametri di job aggiuntivi che l'agente può utilizzare durante la creazione della risposta.

### Esempio 3

```powershell
PS C:\> Invoke-PSUAiAgent -AiAgent SupportAgent -Prompt "Summarize the deployment status." -Wait
```

Avvia un job di prompt per l'agente IA `SupportAgent` e ne attende il completamento, restituendo la risposta dell'agente anziché l'oggetto job.

### Esempio 4

```powershell
PS C:\> Invoke-PSUAiAgent -AiAgent SupportAgent -Prompt "Summarize the deployment status." -Wait -WaitTimeout 60
```

Attende fino a 60 secondi il completamento del job dell'agente. Genera un'eccezione di timeout se il job non termina entro il tempo previsto.

## PARAMETERS

### -AiAgent

Specifica l'agente IA da richiamare. È possibile passare direttamente il nome dell'agente IA oppure inviare tramite pipeline un oggetto agente IA restituito da `Get-PSUAiAgent`.

```yaml
Type: Object
Parameter Sets: (All)
Aliases: Name

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -Prompt

Specifica il prompt da inviare all'agente IA.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Parameters

Specifica parametri aggiuntivi definiti dall'utente da passare al job dell'agente IA. Ogni chiave diventa un parametro del job e ogni valore viene serializzato come PowerShell CliXml prima dell'esecuzione.

```yaml
Type: Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ComputerName

L'indirizzo HTTP del server dell'API di gestione PSU.

```yaml
Type: String
Parameter Sets: (All)
Aliases: Uri

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -AppToken

Un token dell'app per accedere all'API di gestione PSU.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Credential

Specifica la credenziale utilizzata per l'autenticazione all'API di gestione PSU.

```yaml
Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -UseDefaultCredentials

Utilizza l'identità Windows corrente per l'autenticazione all'API di gestione PSU.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Integrated

Esegue il comando internamente anziché utilizzare l'API di gestione. Questo funziona solo durante l'esecuzione all'interno di PowerShell Universal.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TrustCertificate

Disattiva la convalida del certificato TLS per le richieste all'API di gestione.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Cookies

Utilizza il contenitore di cookie PSU corrente per l'autenticazione.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Wait

Attende il completamento del job dell'agente IA e ne restituisce l'output anziché l'oggetto job. Se specificato, il comando rimane bloccato fino al termine del job o al raggiungimento del timeout.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -WaitTimeout

Specifica il numero massimo di secondi di attesa per il completamento del job quando si utilizza `-Wait`. Se il timeout viene raggiunto, il comando genera un'eccezione di timeout.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```

## INPUTS

### System.Object

È possibile inviare tramite pipeline un oggetto agente IA da `Get-PSUAiAgent` oppure passare una stringa con il nome dell'agente.

## OUTPUTS

### PowerShellUniversal.Job

Restituisce il job di prompt creato per la chiamata dell'agente IA.

## NOTES

I parametri di connessione aggiuntivi sono ereditati da `GrpcCommand`.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
