.NET: docs(aspire-devui): align README usage example with WithAgentService semantics#5907
Open
jluocsa wants to merge 1 commit into
Open
.NET: docs(aspire-devui): align README usage example with WithAgentService semantics#5907jluocsa wants to merge 1 commit into
jluocsa wants to merge 1 commit into
Conversation
…rvice semantics The Usage example in dotnet/src/Aspire.Hosting.AgentFramework.DevUI/README.md contained an AppHost.cs snippet that registered Aspire project resources as "writer-agent" / "editor-agent" and called WithAgentService(writerAgent) with no explicit agents argument. WithAgentService defaults to a single agent named after the Aspire resource, so the aggregator advertised entities "writer-agent/writer-agent" and "editor-agent/editor-agent". The companion Program.cs snippet registered the agent inside the service as just "writer" via AddAIAgent, so DevUI requests against the advertised entity failed with `CLIENT_ERROR: Agent 'writer-agent' not found.`. This change updates the Usage example to pass the explicit `agents:` argument that the reporter (microsoft#5781) confirmed works, matching the example already shown in the XmlDoc for WithAgentService. It also adds a short sentence explaining the relationship between Aspire resource names and AgentEntityInfo Ids, and links readers to the Agent discovery section for the default case. The Agent discovery section's example is updated so it no longer duplicates the Usage example: it now shows (a) the convenient default when resource name matches agent name, and (b) the multi-agent-per-service shape that benefits from explicit metadata. No source code changes; documentation only. Fixes microsoft#5781
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Aspire DevUI hosting README to ensure the end-to-end usage example matches WithAgentService’s default agent-discovery behavior, preventing agent-name mismatches between the AppHost and the agent service.
Changes:
- Updates the Usage example to pass explicit
agents:metadata toWithAgentService, aligning entity IDs withAddAIAgent(...)names. - Adds a short clarification explaining the relationship between Aspire resource names (entity ID prefix) and
AgentEntityInfo.Id(agent identifier). - Reworks the “Agent discovery” section to demonstrate (1) the convenient default when resource name == agent name, and (2) explicit metadata for multi-agent services.
Author
|
@microsoft-github-policy-service agree [company=Microsoft] |
Author
|
@microsoft-github-policy-service agree company=Microsoft |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
dotnet/src/Aspire.Hosting.AgentFramework.DevUI/README.mdshows an end-to-end Usage example that does not work as written. The AppHost.cs snippet registers Aspire project resources as"writer-agent"/"editor-agent"and callsWithAgentService(writerAgent)with no explicitagents:argument. As documented in the "Agent discovery" section, that defaults to declaring a single agent named after the Aspire resource (so the aggregator advertiseswriter-agent/writer-agent). The companion Program.cs snippet, however, registers the agent inside the service as just"writer"viaAddAIAgent("writer", ...). The two halves therefore do not refer to the same agent, and running the sample fails at the first chat message with:This was reported in #5781 (label
reproduced), with the reporter independently arriving at the same fix the existing XmlDoc onWithAgentServicealready recommends.Description
Documentation-only change to
dotnet/src/Aspire.Hosting.AgentFramework.DevUI/README.md.agents: [new("writer", ...)]/agents: [new("editor", ...)]argument toWithAgentService, matching the working code in .NET: [Bug]: Following the Aspire DevUI Readme results inError: CLIENT_ERROR: Agent 'agentservice' not found.#5781 and the XmlDoc example inAgentFrameworkBuilderExtensions.cs. Add one short paragraph that names the relationship between the Aspire resource name (used as the entity-ID prefix) and theAgentEntityInfo.Id(must matchAddAIAgent(...)), with a link to the Agent discovery section for the default behavior.No source-code changes. No public API or behavior changes.
Fixes #5781
Contribution Checklist