-
Notifications
You must be signed in to change notification settings - Fork 82
[docs] Document asHostedAgentWithProtocol for polyglot hosted agents #1475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/13.5
Are you sure you want to change the base?
Changes from all commits
26a2450
834ff1f
a05775c
5316c7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -464,6 +464,36 @@ In publish mode, Aspire creates an `AzureHostedAgentResource` and publishes the | |
|
|
||
| For C# AppHosts, the parameterless `AsHostedAgent()` overload reuses an existing Foundry project from the app model or creates one automatically. TypeScript AppHosts pass the project resource explicitly. | ||
|
|
||
| ### Select a hosted agent protocol | ||
|
|
||
| `AsHostedAgent` defaults to the Responses protocol version `2.0.0`. If your hosted agent implements a different protocol or protocol version, use `AsHostedAgentWithProtocol` or pass a protocol and version explicitly. For example, some Microsoft Agent Framework (MAF) agents use the Invocations protocol: | ||
|
|
||
| <Tabs syncKey='aspire-lang'> | ||
| <TabItem id='csharp' label='C#'> | ||
|
|
||
| ```csharp | ||
| builder.AddPythonApp("agent-python", "../agent", "main:app") | ||
| .WithReference(project) | ||
| .WithReference(chat) | ||
| .AsHostedAgent(project, HostedAgentProtocol.Invocations, "1.0.0"); | ||
| ``` | ||
|
|
||
| </TabItem> | ||
| <TabItem id='typescript' label='TypeScript'> | ||
|
|
||
| ```typescript | ||
| await builder | ||
| .addPythonApp('agent-python', '../agent', 'main:app') | ||
| .withReference(project) | ||
| .withReference(chat) | ||
| .asHostedAgentWithProtocol(project, HostedAgentProtocol.Invocations, '1.0.0'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ Contradicted (Phase A) — polyglot API not in the generated surface This TypeScript sample calls
As written, this snippet won''t resolve for a polyglot AppHost. Please verify against the generated |
||
| ``` | ||
|
|
||
| </TabItem> | ||
| </Tabs> | ||
|
|
||
| The defaulted `asHostedAgent` entry point and the explicit `asHostedAgentWithProtocol` entry point are both exported to polyglot AppHosts, so existing AppHosts that call `asHostedAgent(project, options?)` continue to work unchanged with the Responses `2.0.0` default. Reach for `asHostedAgentWithProtocol` only when you need a protocol or version other than the default. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ Contradicted (Phase A) — "both exported to polyglot AppHosts" The But |
||
|
|
||
| ### Add and publish a prompt agent | ||
|
|
||
| For prompt-only scenarios, use `AddPromptAgent` on a Foundry project: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 verified-with-nuance —
AsHostedAgentWithProtocol(PascalCase) is not a callable public C# API onmicrosoft/aspire@release/13.5. The C# entry point for explicit protocol selection is theAsHostedAgent(project, protocol, protocolVersion)overload (src/Aspire.Hosting.Foundry/HostedAgent/HostedAgentBuilderExtension.cs:194-203) — which is exactly what the C# tab below uses.AsHostedAgentWithProtocolexists only as the internalAsHostedAgentWithProtocolForExport(:163), surfaced to polyglot hosts under the camelCase export nameasHostedAgentWithProtocol([AspireExport("asHostedAgentWithProtocol")],:162), as the TypeScript tab correctly shows.Since this sentence sits directly above a C# example that never uses
AsHostedAgentWithProtocol, consider making the C#-vs-polyglot naming explicit — e.g. "in C#, pass a protocol and version to theAsHostedAgent(project, protocol, protocolVersion)overload; polyglot AppHosts use theasHostedAgentWithProtocolcapability." (Non-blocking.)