Skip to content

Restore hosted agent ATS compatibility - #18980

Merged
Sébastien Ros (sebastienros) merged 4 commits into
mainfrom
sebros/restore-hosted-agent-ats
Aug 4, 2026
Merged

Restore hosted agent ATS compatibility#18980
Sébastien Ros (sebastienros) merged 4 commits into
mainfrom
sebros/restore-hosted-agent-ats

Conversation

@sebastienros

Copy link
Copy Markdown
Contributor

Description

Restores the shipped polyglot asHostedAgent(project, options?) capability so existing AppHosts continue to use the Responses protocol version 2.0.0 defaults. The explicit protocol form is now exposed as the additive asHostedAgentWithProtocol capability instead of replacing the existing signature.

The two ATS adapters use distinct internal CLR names and capability IDs, preserving the existing public C# overloads without introducing overload ambiguity. TypeScript, Python, Go, and Java validation AppHosts exercise both generated methods.

Related reviews:

User-facing usage

C# callers continue to use the existing overloads:

agent.AsHostedAgent(project, HostedAgentProtocol.Invocations, "1.0.0");

Polyglot callers can retain the existing defaulted form or opt into explicit protocol selection:

await agent.asHostedAgent(project, options);
await agent.asHostedAgentWithProtocol(
    project,
    HostedAgentProtocol.Invocations,
    "1.0.0",
    options);

Validation:

  • Built Aspire.Hosting.Foundry with integration analyzers enabled.
  • Passed all 117 Aspire.Hosting.Foundry.Tests.
  • Generated and compiled the Foundry validation AppHosts for TypeScript, Python, Go, and Java.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Keep the original asHostedAgent export with Responses 2.0.0 defaults and expose explicit protocol selection through a distinct capability.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c8bf16f9-3a59-4062-bd20-818fb4e70df9
Copilot AI balanced review requested due to automatic review settings August 3, 2026 23:20
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18980

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18980"

@sebastienros
Sébastien Ros (sebastienros) marked this pull request as draft August 3, 2026 23:20
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Aug 3, 2026
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores ATS compatibility for Foundry hosted agents while retaining explicit protocol selection.

Changes:

  • Restores default Responses 2.0.0 polyglot calls.
  • Adds asHostedAgentWithProtocol.
  • Exercises both APIs across four polyglot AppHosts.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Aspire.Hosting.Foundry/HostedAgent/HostedAgentBuilderExtension.cs Adds distinct compatibility and explicit-protocol ATS adapters.
tests/Aspire.Hosting.Foundry.Tests/HostedAgentExtensionTests.cs Updates adapter tests; restored path needs focused regression coverage.
tests/PolyglotAppHosts/Aspire.Hosting.Foundry/TypeScript/apphost.mts Validates both generated TypeScript methods.
tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Python/apphost.py Validates both generated Python methods.
tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Go/apphost.go Validates both generated Go methods.
tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Java/AppHost.java Validates both generated Java methods.

Comment thread tests/Aspire.Hosting.Foundry.Tests/HostedAgentExtensionTests.cs
Add direct behavior coverage for legacy defaults and option application.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c8bf16f9-3a59-4062-bd20-818fb4e70df9
Copilot AI review requested due to automatic review settings August 3, 2026 23:56
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Suppressed comments (2)

src/Aspire.Hosting.Foundry/HostedAgent/HostedAgentBuilderExtension.cs:134

  • Restoring the defaulted polyglot entry point makes the existing public overload documentation at lines 80–83 inaccurate: it still says polyglot hosts must declare the protocol and version explicitly. Update those remarks and the AspireExportIgnore reason to describe asHostedAgent as the defaulted form and asHostedAgentWithProtocol as the explicit form.
        this IResourceBuilder<T> builder,
        IResourceBuilder<AzureCognitiveServicesProjectResource> project,
        HostedAgentOptions? options = null)

src/Aspire.Hosting.Foundry/HostedAgent/HostedAgentBuilderExtension.cs:160

  • This export adds a new user-facing generated-SDK capability, but the PR checklist says no public API was added. Mark the public-API item as Yes and record the ATS API review for this additive method so the PR metadata matches the change.
    [AspireExport("asHostedAgentWithProtocol")]

Comment thread tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Python/apphost.py
Comment thread tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Java/AppHost.java
Comment thread tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Go/apphost.go
Give the explicit-protocol hosted agent a distinct HTTP target port in every polyglot validation AppHost.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c8bf16f9-3a59-4062-bd20-818fb4e70df9
Copilot AI review requested due to automatic review settings August 4, 2026 00:15
@sebastienros

Copy link
Copy Markdown
Contributor Author

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/Aspire.Hosting.Foundry/HostedAgent/HostedAgentBuilderExtension.cs:134

  • Restoring this defaulted ATS adapter makes the public AsHostedAgent(project, configure) documentation at lines 80–83 stale: it still says polyglot hosts must supply protocol and version explicitly, and the AspireExportIgnore reason repeats that claim. Update those remarks/reason to explain that the callback overload is replaced by the options DTO for polyglot callers, while asHostedAgentWithProtocol is the explicit-protocol alternative.
        this IResourceBuilder<T> builder,
        IResourceBuilder<AzureCognitiveServicesProjectResource> project,
        HostedAgentOptions? options = null)

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@sebastienros
Sébastien Ros (sebastienros) marked this pull request as ready for review August 4, 2026 01:57

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 documentation accuracy issue found. The implementation and regression coverage otherwise look correct; local Aspire.Hosting.Foundry.Tests passed 118/118 and the relevant CI checks are passing.

Document the defaulted and explicit protocol ATS entry points consistently.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c8bf16f9-3a59-4062-bd20-818fb4e70df9
Copilot AI review requested due to automatic review settings August 4, 2026 04:02
@sebastienros
Sébastien Ros (sebastienros) marked this pull request as draft August 4, 2026 04:02
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Tests selector (audit mode)

The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement.

3 / 100 test projects · 3 jobs, from 6 changed files.

Selected test projects (3 / 100)

Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Foundry.Tests

Selected jobs (3)

extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

🔧 src/Aspire.Hosting.Foundry/HostedAgent/HostedAgentBuilderExtension.cs (changed source)
1 directly: Aspire.Hosting.Foundry.Tests
2 via the project graph: Aspire.Hosting.Azure.Kubernetes.Tests (2 hops), Aspire.Hosting.Azure.Tests

🧪 tests/Aspire.Hosting.Foundry.Tests/HostedAgentExtensionTests.cs (changed test)
1 directly: Aspire.Hosting.Foundry.Tests

Job reasons

Job Triggered by
extension-e2e src/Aspire.Hosting.Foundry/HostedAgent/HostedAgentBuilderExtension.cs
• affected project Aspire.Hosting.Foundry
polyglot tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Go/apphost.go, tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Java/AppHost.java, tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Python/apphost.py, tests/PolyglotAppHosts/Aspire.Hosting.Foundry/TypeScript/apphost.mts
typescript-api-compat affected project Aspire.Hosting.Foundry

Selection computed for commit f97860a.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@sebastienros
Sébastien Ros (sebastienros) marked this pull request as ready for review August 4, 2026 17:05
@sebastienros
Sébastien Ros (sebastienros) merged commit 30190f9 into main Aug 4, 2026
676 of 680 checks passed
@sebastienros
Sébastien Ros (sebastienros) deleted the sebros/restore-hosted-agent-ats branch August 4, 2026 17:05
@github-actions github-actions Bot added this to the 13.5 milestone Aug 4, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

⚠️ Documentation was required for this change, but a docs PR could not be drafted automatically.

Documentation was required (signal: pr_body_has_user_facing_section) but the draft PR could not be created. The create_pull_request safe-output tool failed twice with "failed to generate patch: ERR_SYSTEM: Git command failed with status 1", likely due to the shallow-clone environment. The intended change was to add a Foundry hosted agent ATS compatibility restored entry to src/frontend/src/content/docs/whats-new/aspire-13-5.mdx documenting the restored asHostedAgent polyglot export (Responses protocol 2.0.0 defaults) and the new asHostedAgentWithProtocol export for explicit protocol/version selection.

See the workflow run for details: https://github.com/microsoft/aspire/actions/runs/30932312207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants