microsoft/semantic-kernel · error · ValueError
The prompt execution settings must not have a response forma
Error message
The prompt execution settings must not have a response format set.
What it means
StandardMagenticManager parses the model's progress/facts/plan ledgers via structured output, so it sets response_format on the prompt execution settings itself during construction. If the settings object you pass already carries a non-null response_format, the manager's own structured-output contract would be overwritten or made ambiguous, so the constructor rejects it. This is a configuration guard, not a runtime failure.
Source
Thrown at python/semantic_kernel/agents/orchestration/magentic.py:257
- task_ledger_facts_prompt: The prompt to use for the task ledger facts.
- task_ledger_plan_prompt: The prompt to use for the task ledger plan.
- task_ledger_full_prompt: The prompt to use for the full task ledger.
- task_ledger_facts_update_prompt: The prompt to use for the task ledger facts update.
- task_ledger_plan_update_prompt: The prompt to use for the task ledger plan update.
- progress_ledger_prompt: The prompt to use for the progress ledger.
- final_answer_prompt: The prompt to use for the final answer.
"""
# Bast effort to make sure the service supports structured output. Even if the service supports
# structured output, the model may not support it, in which case there is no good way to check.
if prompt_execution_settings is None:
prompt_execution_settings = chat_completion_service.instantiate_prompt_execution_settings()
if not hasattr(prompt_execution_settings, "response_format"):
raise ValueError("The service must support structured output.")
else:
if not hasattr(prompt_execution_settings, "response_format"):
raise ValueError("The service must support structured output.")
if getattr(prompt_execution_settings, "response_format", None) is not None:
raise ValueError("The prompt execution settings must not have a response format set.")
super().__init__(
chat_completion_service=chat_completion_service,
prompt_execution_settings=prompt_execution_settings,
**kwargs,
)
@override
async def plan(self, magentic_context: MagenticContext) -> ChatMessageContent:
"""Plan the task.
Args:
magentic_context (MagenticContext): The context for the Magentic manager.
Returns:
ChatMessageContent: The task ledger.
"""
# 1. Gather the factsView on GitHub (pinned to c028a0c7dc)
Solutions
- Pass prompt_execution_settings=None and let the manager instantiate fresh settings from the service.
- Before passing settings, clear the field: settings.response_format = None.
- Use a chat completion service/connector that exposes the response_format attribute so the manager can manage structured output itself.
Example fix
// before settings = AzureChatPromptExecutionSettings(response_format=JsonSchemaResponseFormat(my_schema)) manager = StandardMagenticManager(service, prompt_execution_settings=settings) # raises // after settings = AzureChatPromptExecutionSettings() manager = StandardMagenticManager(service, prompt_execution_settings=settings)
Defensive patterns
Strategy: validation
Validate before calling
# Before constructing StandardMagenticManager
settings = chat_completion_service.instantiate_prompt_execution_settings()
if not hasattr(settings, "response_format"):
raise ValueError("Service must support structured output (response_format attr).")
if getattr(settings, "response_format", None) is not None:
settings.response_format = None # let the manager own structured output
manager = StandardMagenticManager(chat_completion_service, prompt_execution_settings=settings) Type guard
def is_clean_for_magentic(settings) -> bool:
return hasattr(settings, "response_format") and getattr(settings, "response_format", None) is None Try / catch
try:
manager = StandardMagenticManager(service, prompt_execution_settings=settings)
except ValueError as e:
if "response format" in str(e):
settings.response_format = None
manager = StandardMagenticManager(service, prompt_execution_settings=settings)
else:
raise Prevention
- Pass prompt_execution_settings=None unless you need custom non-response-format settings.
- Never reuse a settings object that carried response_format from another structured-output call.
- Prefer a connector/service known to support structured output.
When it happens
Trigger: Constructing `StandardMagenticManager(chat_completion_service, prompt_execution_settings=settings)` where `getattr(settings, 'response_format', None) is not None`. Also triggered when settings lack the `response_format` attribute entirely (different message, same method).
Common situations: Reusing a PromptExecutionSettings instance that was configured for a separate structured-output call (json_schema/auto). Copying settings from another function that set response_format. Using a connector whose settings default response_format to a non-null value.
Related errors
- All members must have a description.
- The service must support structured output.
- The members list cannot be empty.
- Configuration not found, please setup the notebooks first us
- AZURE_OPENAI_ENDPOINT is not set.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/8ea3cf82946ded8f.
Report an issue: GitHub.