> 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/da/powershell-kommandoer/new-psuaiagent.md).

# New-PSUAiAgent

New-PSUAiAgent opretter en ny definition af en AI-agent i PowerShell Universal, herunder dens instruktioner, model, API-nøgle og tilladte værktøjer.

## Synopsis

Opretter en ny definition af en AI-agent.

## Syntaks

```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]`.

## Beskrivelse

Opretter og gemmer en AI-agent med modelmetadata, instruktioner, en API-nøglevariabel og tilladte værktøjer. Udbyderen er som standard `OpenAI`; `Anthropic` og `Custom` understøttes også. En `Custom`-udbyder kræver en absolut `-Endpoint`-URL. Brug `-AvailableInChat` til at vise agenten i chatvælgere i admin og genererede apps.

## Eksempler

```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
```

## Parametre

| Parameter                | Beskrivelse                                                          |
| ------------------------ | -------------------------------------------------------------------- |
| `-Name`                  | Påkrævet agentnavn.                                                  |
| `-Description`           | Beskrivelse af agenten.                                              |
| `-Instructions`          | Systeminstruktioner til agenten.                                     |
| `-Model`                 | Modelidentifikator, der bruges til fuldførelser.                     |
| `-ApiKey`                | PSU-variabel, der indeholder udbyderens API-nøgle.                   |
| `-Provider`              | AI-udbyder: `OpenAI` (standard), `Anthropic` eller `Custom`.         |
| `-Endpoint`              | Absolut udbyder-URL; påkrævet, når `-Provider Custom`.               |
| `-Tool`                  | Navne på værktøjer, som agenten kan kalde (alias `-Tools`).          |
| `-Role`                  | Roller med tilladelse til at få adgang til agenten (alias `-Roles`). |
| `-AvailableInChat`       | Gør agenten valgbar i chatvælgere.                                   |
| `-ComputerName`          | URL eller værtsnavn for målserveren (alias `-Uri`).                  |
| `-AppToken`              | App-token til Management API.                                        |
| `-Credential`            | Legitimationsoplysninger til Basic-godkendelse mod Management API.   |
| `-UseDefaultCredentials` | Bruger de aktuelle Windows-legitimationsoplysninger.                 |
| `-Integrated`            | Bruger den integrerede administrationsklient i processen.            |
| `-TrustCertificate`      | Ignorerer fejl ved certifikatvalidering.                             |
| `-Cookies`               | Genbruger sessionscookies til godkendelse.                           |

## Input

Ingen.

## Output

`PowerShellUniversal.Models.Intelligence.AiAgent`.

## Tilladelser

Adgangstokenet kræver `intelligence.agents/create` for at køre denne cmdlet eksternt.


---

# 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/da/powershell-kommandoer/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.
