Skip to content

Complete polyglot integration host support and cross-language integration exports #16220

Closed

Description

Spike branch: davidfowl/ts-integration (bb3cd1289)

This issue tracks the follow-up work after the polyglot integration host spike.

The spike proved that Aspire can support integrations authored in TypeScript and other guest languages, and project them into guest AppHosts as first-class generated APIs. In particular, it established an end-to-end path where:

  • the CLI resolves integration references from aspire.config.json
  • guest-language integration dependencies are restored before startup
  • the CLI writes integration host entries into the generated AppHost server config
  • the AppHost server owns integration host lifetime
  • the AppHost server gathers capabilities from external hosts and merges them into ATS/codegen
  • runtime calls are dispatched back to the owning integration over JSON-RPC
  • TypeScript integrations can opt into projection via AspireExport(...) and defineIntegration(...)

The spike also added the supporting design docs and playgrounds for this model:

  • docs/specs/polyglot-integrations.md
  • docs/specs/polyglot-apphost.md
  • playground/TsIntegrationSpike
  • playground/TsKafkaLib

What the spike established

At a design level, the winning model is:

  • integrations are authored as normal language-native packages on top of generated Aspire hosting APIs
  • unannotated integrations remain same-language free-function libraries
  • annotated integrations are exported through a common capability schema
  • the AppHost server owns integration lifetime uniformly across in-proc .NET integrations and out-of-proc hosts
  • generated guest SDKs project exported capabilities into fluent builder methods regardless of consumer language

Architecture direction

The spike should move toward a more uniform end-state than the current split between “in-proc .NET integrations” and “external integration hosts”.

The intended model is:

Image

  • the AppHost server is the control plane for composition and integration dispatch
  • the CLI, VS Code extension, and AppHost are clients around that server boundary
  • DCP is a backend the AppHost server talks to over HTTP, not part of the integration model itself
  • ATS and the generated Aspire hosting surface become the shared integration contract and standard library, rather than Aspire.Hosting.dll being the defining boundary
  • every integration, including C# integrations, should converge on the same capability boundary

Long term, C# should move toward being just another integration host from the architectural point of view, even if the implementation keeps an in-proc path as a compatibility mechanism or optimization. In other words, in-proc assembly loading may remain an implementation detail, but it should not be the model the rest of the system is built around.

This also implies two primary RPC seams:

  1. AppHost ↔ AppHost server
  2. AppHost server ↔ integration hosts

That direction is broader than “polyglot support”. It is a move toward a uniform server-owned integration architecture where language becomes an implementation detail rather than the shape of the system.

What is still missing

This is still a spike, not a finished feature. The biggest gaps are:

  • only typescript/nodejs currently hosts integrations end-to-end
  • TypeScript projection metadata is still hand-authored
  • external integrations cannot yet contribute handle/DTO catalogs beyond existing ATS knowledge
  • aspire sdk dump / aspire sdk generate still assume .csproj input
  • aspire add is still NuGet-centric and has no per-language registry story
  • diagnostics need more polish for partially supported or misconfigured integrations
  • end-to-end automated coverage for multi-host / multi-language projection scenarios is still limited
  • the current implementation still treats .NET integrations and guest-language integration hosts as different architectural shapes rather than different implementations of the same abstraction

Proposed follow-up work

  1. Productize the TypeScript authoring story

    • emit generated type-ref constants so authors do not hand-write projection type refs
    • move toward signature/projection inference so metadata duplication is minimized
  2. Validate the model with a second hosted language

    • add ILanguageSupport.GetIntegrationHostSpec() for another language, likely Python
    • run the same projection/dispatch flow end-to-end
  3. Improve CLI ergonomics for guest-language integration authors

    • allow SDK dump/generate flows for guest-language integrations
    • add a language-extensible package discovery/add story
  4. Extend runtime projection

    • allow external integrations to contribute handles and DTOs
    • add stronger metadata validation and better failure diagnostics
  5. Converge on a single integration-host abstraction

    • treat the AppHost server as the single owner of integration lifetime and dispatch
    • make .NET and guest-language integrations different implementations of the same model
    • preserve in-proc loading only as an optimization or compatibility path, not as the architectural center of gravity
  6. Add dedicated automated coverage

    • multi-host projection
    • cross-language capability projection
    • runtime dispatch and callback flow
    • startup / registration failure cases
    • mixed scenarios involving both C# and guest-language integrations under the same server-owned model

Exit criteria

We should consider this area productized when:

  • at least two guest languages can host integrations end-to-end
  • TypeScript integrations no longer require hand-written projection type refs
  • guest-language integration authors can inspect/generate SDK output with normal CLI flows
  • aspire add has a language-extensible registry model
  • external integrations can contribute more than capability metadata
  • there is solid E2E coverage for external capability projection and dispatch
  • the AppHost server is clearly the uniform control plane for integration lifetime and dispatch
  • .NET and guest-language integrations fit the same architectural abstraction, even if they do not use the same transport implementation internally
  • failure modes produce actionable diagnostics

Related issues

Activity

  1. added
    area-polyglot
    on Apr 15, 2026
  2. strue36 commented on Apr 20, 2026

    @strue36

    Will this support being able to reference a running AppHost from a language integration?

    Consider the case where I have a series of test projects that take a handful of seconds to complete once the AppHost has started, but the AppHost takes minutes to start.

    I want to be able to start the AppHost once and then pass a reference to each consumer, that is then able to do something like

    DistributedApplication app = AppHost.Attach(appHostId);

    I think that right now I can start to get there by wrapping aspire describe (provided I only have a single instance of the AppHost running), but I want to know whether you have plans to introduce wrappers for the CLI before I invest too much time into that.

  3. strue36 commented on Apr 20, 2026

    @strue36

    Thanks David. I did have a read through that earlier and saw this section

    .NET

    For .NET tests that want CLI-based testing (instead of Aspire.Hosting.Testing):

    await using var app = await AspireApp.StartAsync(new StartOptions
    {
        Project = "./MyApp.AppHost/MyApp.AppHost.csproj"
    });
    
    await app.WaitForResourceAsync("redis", state: "Running", healthy: true);
    await app.WaitForResourceAsync("api", state: "Running", healthy: true);
    
    var api = app.GetResource("api");
    var httpEndpoint = api.GetEndpoint("http");
    
    using var httpClient = new HttpClient { BaseAddress = new Uri(httpEndpoint.Url) };
    var response = await httpClient.GetAsync("/api/products");
    response.EnsureSuccessStatusCode();

    The bit that was unclear was if there are plans to be able to attach to an externally started AppHost instead of calling StartAsync. It seems like it should be possible with the CLI approach. I think the process would be easier if the output of aspire start

    Output (JSON):

    {
      "appHostPath": "/path/to/MyApp.AppHost/MyApp.AppHost.csproj",
      "appHostPid": 12345,
      "cliPid": 12340,
      "dashboardUrl": "http://localhost:15000/login?t=abc123",
      "logFile": "/path/to/MyApp.AppHost/.aspire/logs/apphost.log"
    }

    was then usable in the other aspire commands such as describe with something like

    aspire describe [--project <path>] [--appHostPid <pid>]

    and presumably that is what would then be usable in a mechanism that connected to an existing AppHost

  4. davidfowl commented on Apr 20, 2026

    @davidfowl
    CollaboratorAuthor

    Today the cli can attach via path (not pid), so yes the APIs are not in there but we'd expose a way to target an existing apphost without explicitly starting it.

  5. strue36 commented on Apr 20, 2026

    @strue36

    Great. Thanks

  6. davidfowl commented on Oct 10, 2026

    @davidfowl
    CollaboratorAuthor

    The foundational TypeScript integration-host support landed in #16110. Closing this umbrella issue as superseded by #20873, which carries forward the remaining productization work and defines the next runtime scenario: unchanged shipped C# Redis plus unpublished Nuxt reworked for the ATS-native model, composing in one TS AppHost. Existing AppHost and integration compatibility is an explicit requirement. This closure does not mean every original exit criterion has been completed.

  7. locked and limited conversation to collaborators on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-polyglot

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions