For the complete documentation index, see llms.txt. This page is also available as Markdown.

Invoke-PSUAiAgent

Invokes a PowerShell Universal AI agent.

SYNOPSIS

Invokes a PowerShell Universal AI agent.

SYNTAX

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

DESCRIPTION

Starts a prompt job for an AI agent and returns the created job. The AiAgent parameter accepts either the name of an AI agent or an AI agent object from Get-PSUAiAgent. Additional values supplied through Parameters are serialized and passed to the agent job as supplemental parameters. PowerShell Universal still enforces execute permission and any roles assigned directly to the target AI agent.

EXAMPLES

Example 1

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

Starts a prompt job for the SupportAgent AI agent.

Example 2

Invokes the piped AI agent object and passes additional job parameters that the agent can use when building its response.

Example 3

Starts a prompt job for the SupportAgent AI agent and waits for it to complete, returning the agent's response instead of the job object.

Example 4

Waits up to 60 seconds for the agent job to complete. Throws a timeout exception if the job does not finish within the allotted time.

PARAMETERS

-AiAgent

Specifies the AI agent to invoke. You can pass the AI agent name directly or pipe an AI agent object returned by Get-PSUAiAgent.

-Prompt

Specifies the prompt to send to the AI agent.

-Parameters

Specifies additional user-defined parameters to pass to the AI agent job. Each key becomes a job parameter and each value is serialized as PowerShell CliXml before execution.

-ComputerName

The HTTP address of the PSU Management API server.

-AppToken

An app token to access the PSU Management API.

-Credential

Specifies the credential used when authenticating to the PSU Management API.

-UseDefaultCredentials

Uses the current Windows identity when authenticating to the PSU Management API.

-Integrated

Executes the command internally rather than using the Management API. This only works when running inside PowerShell Universal.

-TrustCertificate

Disables TLS certificate validation for Management API requests.

-Cookies

Uses the current PSU cookie container for authentication.

-Wait

Waits for the AI agent job to complete and returns its output rather than the job object. When specified, the command will block until the job finishes or the timeout is reached.

-WaitTimeout

Specifies the maximum number of seconds to wait for the job to complete when using -Wait. If the timeout is reached, the command throws a timeout exception.

INPUTS

System.Object

You can pipe an AI agent object from Get-PSUAiAgent or pass an agent name string.

OUTPUTS

PowerShellUniversal.Job

Returns the prompt job created for the AI agent invocation.

NOTES

Additional connection parameters are inherited from GrpcCommand.

Last updated

Was this helpful?