Description
Microsoft.Agents.AI.Foundry.Hosting fails requests from HarnessAgent (and any ChatClientAgent using per-service-call local chat history persistence) with agent_stored_output_not_disabled when FoundryResponsesOptions.AllowStoredOutputEnabled is left at its default false.
Root cause
HarnessAgent defaults to InMemoryChatHistoryProvider, which keeps history in AgentSession.StateBag.
- After each service call,
PerServiceCallChatHistoryPersistingChatClient writes the internal sentinel LocalHistoryConversationId ("_agent_local_chat_history") into ChatClientAgentSession.ConversationId. The sentinel means "history is persisted locally", not "the service stored this conversation".
AgentFrameworkResponseHandler.CheckNotAllowedStoreUsage treats every non-null ConversationId as service storage, so the local sentinel triggers the stored-output rejection.
Impact
Hosted Harness agents only work if developers opt in to AllowStoredOutputEnabled = true, even though the host still sends store=false and no conversation is stored by the service. The public foundry-samples Harness samples currently carry that opt-in as a workaround.
Expected behavior
- The local history sentinel is allowed when
AllowStoredOutputEnabled is false.
- A real service-stored conversation ID is still rejected.
- The host continues to request
store=false by default.
Related
Description
Microsoft.Agents.AI.Foundry.Hostingfails requests fromHarnessAgent(and anyChatClientAgentusing per-service-call local chat history persistence) withagent_stored_output_not_disabledwhenFoundryResponsesOptions.AllowStoredOutputEnabledis left at its defaultfalse.Root cause
HarnessAgentdefaults toInMemoryChatHistoryProvider, which keeps history inAgentSession.StateBag.PerServiceCallChatHistoryPersistingChatClientwrites the internal sentinelLocalHistoryConversationId("_agent_local_chat_history") intoChatClientAgentSession.ConversationId. The sentinel means "history is persisted locally", not "the service stored this conversation".AgentFrameworkResponseHandler.CheckNotAllowedStoreUsagetreats every non-nullConversationIdas service storage, so the local sentinel triggers the stored-output rejection.Impact
Hosted Harness agents only work if developers opt in to
AllowStoredOutputEnabled = true, even though the host still sendsstore=falseand no conversation is stored by the service. The public foundry-samples Harness samples currently carry that opt-in as a workaround.Expected behavior
AllowStoredOutputEnabledisfalse.store=falseby default.Related
CompactionProvider; that component is not covered by this issue.