microsoft-foundry / microsoft-foundry/foundry-samples
dotnet hosted agents AgentWithHostedMCP sample doesn't work in Foundry
Open
@lindazqli is already working on this.
Since Aug 13, 2026.
bug
- Dominant language
- Bicep
- Stars
- 445
- Forks
- 494
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 38
Description
AgentWithHostedMCP if deployed according MS Learn guide doesn't work when deployed to Foundry.
On invocation the following error is shown in the logs:
HTTP 400 (invalid_request_error: unknown_parameter)
Unknown parameter: 'conversation'.
System.ClientModel.ClientResultException: HTTP 400 (invalid_request_error: unknown_parameter)
Unknown parameter: 'conversation'.
at OpenAI.ClientPipelineExtensions.ProcessMessageAsync(ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
at OpenAI.Responses.ResponsesClient.CreateResponseAsync(BinaryContent content, RequestOptions options)
at OpenAI.Responses.ResponsesClient.<>c__DisplayClass20_0.<<CreateResponseStreamingAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at OpenAI.AsyncSseUpdateCollection`1.GetRawPagesAsync()+MoveNext()
at OpenAI.AsyncSseUpdateCollection`1.GetRawPagesAsync()+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Microsoft.Extensions.AI.OpenAIResponsesChatClient.FromOpenAIStreamingResponseUpdatesAsync(IAsyncEnumerable`1 streamingResponseUpdates, CreateResponseOptions options, String conversationId, String resumeResponseId, CancellationToken cancellationToken)+MoveNext()
at Microsoft.Extensions.AI.OpenAIResponsesChatClient.FromOpenAIStreamingResponseUpdatesAsync(IAsyncEnumerable`1 streamingResponseUpdates, CreateResponseOptions options, String conversationId, String resumeResponseId, CancellationToken cancellationToken)+MoveNext()
at Microsoft.Extensions.AI.OpenAIResponsesChatClient.FromOpenAIStreamingResponseUpdatesAsync(IAsyncEnumerable`1 streamingResponseUpdates, CreateResponseOptions options, String conversationId, String resumeResponseId, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Microsoft.Extensions.AI.FunctionInvokingChatClient.GetStreamingResponseAsync(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)+MoveNext()
at Microsoft.Extensions.AI.FunctionInvokingChatClient.GetStreamingResponseAsync(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)+MoveNext()
at Microsoft.Extensions.AI.FunctionInvokingChatClient.GetStreamingResponseAsync(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Microsoft.Agents.AI.ChatClientAgent.RunCoreStreamingAsync(IEnumerable`1 messages, AgentSession session, AgentRunOptions options, CancellationToken cancellationToken)+MoveNext()
at Microsoft.Agents.AI.ChatClientAgent.RunCoreStreamingAsync(IEnumerable`1 messages, AgentSession session, AgentRunOptions options, CancellationToken cancellationToken)+MoveNext()
at Microsoft.Agents.AI.ChatClientAgent.RunCoreStreamingAsync(IEnumerable`1 messages, AgentSession session, AgentRunOptions options, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Microsoft.Agents.AI.AIAgent.RunStreamingAsync(IEnumerable`1 messages, AgentSession session, AgentRunOptions options, CancellationToken cancellationToken)+MoveNext()
at Microsoft.Agents.AI.AIAgent.RunStreamingAsync(IEnumerable`1 messages, AgentSession session, AgentRunOptions options, CancellationToken cancellationToken)+MoveNext()
at Microsoft.Agents.AI.AIAgent.RunStreamingAsync(IEnumerable`1 messages, AgentSession session, AgentRunOptions options, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Azure.AI.AgentServer.Core.Common.AsyncEnumerableExtensions.ChunkByKey[TSource,TKey](IAsyncEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer, CancellationToken cancellationToken)+MoveNext()
at Azure.AI.AgentServer.Core.Common.AsyncEnumerableExtensions.ChunkByKey[TSource,TKey](IAsyncEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer, CancellationToken cancellationToken)+MoveNext()
at Azure.AI.AgentServer.Core.Common.AsyncEnumerableExtensions.ChunkByKey[TSource,TKey](IAsyncEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Azure.AI.AgentServer.Responses.Invocation.Stream.NestedChunkedUpdatingGeneratorBase`2.Generate()+MoveNext()
at Azure.AI.AgentServer.Responses.Invocation.Stream.NestedChunkedUpdatingGeneratorBase`2.Generate()+MoveNext()
at Azure.AI.AgentServer.Responses.Invocation.Stream.NestedChunkedUpdatingGeneratorBase`2.Generate()+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Azure.AI.AgentServer.Responses.Invocation.Stream.NestedResponseGenerator.GenerateEventsAsync()+MoveNext()
at Azure.AI.AgentServer.Responses.Invocation.Stream.NestedResponseGenerator.GenerateEventsAsync()+MoveNext()
at Azure.AI.AgentServer.Responses.Invocation.Stream.NestedResponseGenerator.GenerateEventsAsync()+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Azure.AI.AgentServer.Responses.Invocation.AgentInvocationBase.InvokeStreamAsync(AgentRunContext context, CancellationToken cancellationToken)+MoveNext()
at Azure.AI.AgentServer.Responses.Invocation.AgentInvocationBase.InvokeStreamAsync(AgentRunContext context, CancellationToken cancellationToken)+MoveNext()
at Azure.AI.AgentServer.Responses.Invocation.AgentInvocationBase.InvokeStreamAsync(AgentRunContext context, CancellationToken cancellationToken)+MoveNext()
at Azure.AI.AgentServer.Responses.Invocation.AgentInvocationBase.InvokeStreamAsync(AgentRunContext context, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Azure.AI.AgentServer.Responses.Invocation.AgentInvoker.<InvokeStreamAsync>g__ReadUpdates|5_1(IAsyncEnumerable`1 source, CancellationToken cancellationToken)+MoveNext()
The sample is using old outdated versions of the libraries. Any plans on updating this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.