microsoft / microsoft/agent-framework

.NET: OpenAI-compatible extra body field thinking is not forwarded when using Microsoft.Agents.AI.OpenAI

Open
#5,708 2 comments 1 reaction 1 assignee View on GitHub

@peibekwe is already working on this.

Since May 12, 2026.

.NET
Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
2d 45m
Merged PRs (30d)
358

Description

## Summary
When using `Microsoft.Agents.AI.OpenAI` with an OpenAI-compatible backend (ARK), provider-specific body field `thinking` is not forwarded to the final outgoing payload.

Expected outgoing request should be:

```bash
curl https://ark.cn-beijing.volces.com/api/v3/responses \
-H "Authorization: Bearer $ARK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seed-2-0-lite-260215",
"input": "常见的十字花科植物有哪些?",
"thinking":{"type": "enabled"},
"stream": true
}'
```

## Minimal repro code
```csharp
using System;
using System.ClientModel;
using System.Text.Json;
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
using OpenAI;

var client = new OpenAIClient(
new ApiKeyCredential(Environment.GetEnvironmentVariable("ARK_API_KEY")!),
new OpenAIClientOptions { Endpoint = new Uri("http://127.0.0.1:24424") }); // local proxy

var chatClient = client.GetChatClient("doubao-seed-2-0-lite-260215");
var thinkingConfig = JsonDocument.Parse("{\"type\":\"enabled\"}").RootElement.Clone();

var chatOptions = new ChatOptions
{
Instructions = "You are a helpful assistant",
AdditionalProperties = new AdditionalPropertiesDictionary { ["thinking"] = thinkingConfig }
};

var agent = chatClient.AsAIAgent(new ChatClientAgentOptions { ChatOptions = chatOptions });

var runOptions = new AgentRunOptions
{
AdditionalProperties = new AdditionalPropertiesDictionary { ["thinking"] = thinkingConfig }
};

var session = await agent.CreateSessionAsync();
await agent.RunAsync("常见的十字花科植物有哪些?", options: runOptions, session: session);
```

## Actual
Intercepted outgoing JSON (via local proxy) contains standard fields (messages/model/temperature/reasoning_effort), but does not include `thinking`.

## Expected
A supported way to pass through provider-specific extra body fields for OpenAI-compatible endpoints (for example an `ExtraBody` map or documented passthrough mechanism).

## Question
Is this behavior by design, or a bug/feature gap?
If by design, what is the recommended way to send provider-specific request fields such as `thinking`?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.