Fix empty Tools collection when loading PromptAgent from YAML#84
Draft
Copilot wants to merge 2 commits into
Draft
Fix empty Tools collection when loading PromptAgent from YAML#84Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Agent-Logs-Url: https://github.com/microsoft/AgentSchema/sessions/938d50c0-80a7-42a6-bf79-b1d58978a7d9 Co-authored-by: sethjuarez <115409+sethjuarez@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix empty tools collection when loading PromptAgent from YAML
Fix empty Tools collection when loading PromptAgent from YAML
Apr 3, 2026
Member
|
Hmmm - super important to remember that the CSharp code is generated from the emitter - we may need to update the template files for the emitter - @copilot - can you take that line of inquiry please? |
|
Any plans to review/merge this? I currently have a locally cloned version of the c# code with my own fix, which is ... less than ideal. Or are there plans to leverage anything coming out of Foundry roadmap for canonical agent schema perhaps? |
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.
YamlDotNet 16.x deserializes nested YAML mappings as
Dictionary<object, object>, but the generatedLoadXxxcollection methods only matched onDictionary<string, object?>, causing all collection-type properties (tools, bindings, parameters, etc.) to be silently empty after YAML deserialization.Changes
utils.cs.njk— AddedNormalizeDictionaryandNormalizeValueextension methods toUtilsthat recursively convertDictionary<object, object>→Dictionary<string, object?>, including nested values and lists.file.cs.njk— Updated the generatedLoadXxxcollection template to normalize YamlDotNet dicts at method entry, and added anelse if (item is Dictionary<object, object>)branch in the list-item loop.These two template changes are applied automatically to all generated collection loaders:
PromptAgent.LoadTools,Tool.LoadBindings,AgentManifest.LoadResources,ContainerAgent.LoadProtocolVersions,ObjectProperty.LoadProperties,PropertySchema.LoadProperties.PromptAgentToolsYamlTests.cs— Adds regression tests covering dictionary-format and list-format tools YAML deserialization.