# AzureHostedAgentResource Methods

- Package: [Aspire.Hosting.Foundry](/reference/api/csharp/aspire.hosting.foundry.md)
- Type: [AzureHostedAgentResource](/reference/api/csharp/aspire.hosting.foundry/azurehostedagentresource.md)
- Kind: `Methods`
- Members: `3`

A Microsoft Foundry hosted agent resource.

## DeployAsync(PipelineStepContext, AzureCognitiveServicesProjectResource)

- Name: `DeployAsync(PipelineStepContext, AzureCognitiveServicesProjectResource)`
- Returns: `Task<ProjectsAgentVersion>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Foundry/HostedAgent/AzureHostedAgentResource.cs#L133-L148)

Deploys the specified agent to the given Microsoft Foundry project.

```csharp
public class AzureHostedAgentResource
{
    public Task<ProjectsAgentVersion> DeployAsync(
        PipelineStepContext context,
        AzureCognitiveServicesProjectResource project)
    {
        // ...
    }
}
```

## Parameters

- `context` (`PipelineStepContext`)
- `project` ([AzureCognitiveServicesProjectResource](/reference/api/csharp/aspire.hosting.foundry/azurecognitiveservicesprojectresource.md))

## PublishAsync(ManifestPublishingContext)

- Name: `PublishAsync(ManifestPublishingContext)`
- Returns: `Task`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Foundry/HostedAgent/AzureHostedAgentResource.cs#L120-L126)

Publishes the hosted agent during the manifest publishing phase.

```csharp
public class AzureHostedAgentResource
{
    public Task PublishAsync(
        ManifestPublishingContext ctx)
    {
        // ...
    }
}
```

## Parameters

- `ctx` (`ManifestPublishingContext`)

## ToHostedAgentConfigurationAsync(PipelineStepContext)

- Name: `ToHostedAgentConfigurationAsync(PipelineStepContext)`
- Returns: [Task<HostedAgentConfiguration>](/reference/api/csharp/aspire.hosting.foundry/hostedagentconfiguration.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Foundry/HostedAgent/AzureHostedAgentResource.cs#L96-L112)

Convert all dynamic values into concrete values for deployment.

```csharp
public class AzureHostedAgentResource
{
    public Task<HostedAgentConfiguration> ToHostedAgentConfigurationAsync(
        PipelineStepContext context)
    {
        // ...
    }
}
```

## Parameters

- `context` (`PipelineStepContext`)
