# AddPromptAgent

- Module: [Aspire.Hosting.Foundry](/reference/api/go/aspire.hosting.foundry.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`
- Defined on: [`AzureCognitiveServicesProjectResource`](/reference/api/go/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Adds a prompt agent to a Microsoft Foundry project with the specified tools.

## Remarks

Prompt agents are always deployed to Azure Foundry, even during local development
(`aspire run`). Local services communicate with the cloud-provisioned agent
using the project endpoint and agent name injected as environment variables.
Tools are project-level resources created with `Add*Tool` methods and can be
reused across multiple agents in the same project.

## Definition

```go
func (AzureCognitiveServicesProjectResource) AddPromptAgent(
    name string,
    model FoundryDeploymentResource,
    options ...*AddPromptAgentOptions,
) AzurePromptAgentResource
```

## Parameters

- `name` (`string`) -- The name of the prompt agent. This will be the agent name in Foundry.
- `model` ([`FoundryDeploymentResource`](/reference/api/go/aspire.hosting.foundry/foundrydeploymentresource.md)) -- The model deployment to use for this agent.
- `options` (`...*AddPromptAgentOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*AddPromptAgentOptions` argument.

- `Instructions` (`*string`) -- Optional system instructions for the agent.

## Returns

[`AzurePromptAgentResource`](/reference/api/go/aspire.hosting.foundry/azurepromptagentresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`AzureCognitiveServicesProjectResource`](/reference/api/go/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md)
