# AzureCognitiveServicesProjectResource.AddPromptAgent

- Module: [Aspire.Hosting.Foundry](/reference/api/go/aspire.hosting.foundry.md)
- Defined on: [AzureCognitiveServicesProjectResource](/reference/api/go/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`

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
type AzureCognitiveServicesProjectResource interface {
    // ... omitted for brevity
    AddPromptAgent(
        name string,
        model FoundryDeploymentResource,
        options ...*AddPromptAgentOptions,
    ) AzurePromptAgentResource
}
```

## Signature

```go
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()`.

## Defined on

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