mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
## Summary Fixes #13349 When loading agents from YAML files using `AgentRegistry.create_from_file()` or `create_from_yaml()`, the `model.options` field (containing settings like `response_format`, `temperature`, etc.) were being added as regular `KernelArguments` dict items instead of being placed in the `execution_settings` property. This caused AI service calls to ignore these critical settings. ## Root Cause In `_normalize_spec_fields()` method in `python/semantic_kernel/agents/agent.py`, model options were being passed to `KernelArguments` constructor as `**kwargs`: ```python # OLD (buggy) CODE arguments = KernelArguments(**model_options) ``` This made them regular dict items, but execution settings need to be in the `execution_settings` property to be passed to AI services. ## Changes Modified `_normalize_spec_fields()` in `python/semantic_kernel/agents/agent.py`: - Added import for `PromptExecutionSettings` - Convert model.options to `PromptExecutionSettings` object before creating `KernelArguments` - Model options now correctly placed in `execution_settings` property - Input defaults continue to be added as regular dict items (correct behavior) ## Testing - ✅ Created custom test verifying model.options are now in execution_settings - ✅ All 30 existing unit tests in `tests/unit/agents/test_agent.py` pass - ✅ No breaking changes introduced - ✅ Verified execution_settings passed programmatically still work correctly ## Example YAML file: ```yaml type: chat_completion_agent name: TestAgent description: Test agent instructions: You are a test agent model: options: response_format: structured_output temperature: 0.7 ``` **Before this fix:** - `response_format` was in dict items (wrong location) - AI service calls ignored it **After this fix:** - `response_format` is in `execution_settings.extension_data` - AI service calls receive it properly