alfin06/swegent-issues-filtered huggingface dataset:
Ollama MultimodalWebSurfer crash using Ollama and llama3.2

### What happened?

**Describe the bug**
When running the example of web surfer using ollama with model llama3.2 the `MultimodalWebSurfer `crashes

**To Reproduce**
Run web surfer example provided in README.md with `OllamaChatCompletionClient` and model llama3.2

```python
import asyncio
from autogen_agentchat.agents import UserProxyAgent
from autogen_agentchat.conditions import TextMentionTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.ui import Console
from autogen_ext.models.ollama import OllamaChatCompletionClient
from autogen_ext.agents.web_surfer import MultimodalWebSurfer


async def main() -> None:
    model_client = OllamaChatCompletionClient(model="llama3.2")

    web_surfer = MultimodalWebSurfer(
        "web_surfer", model_client, headless=False, animate_actions=True
    )

    user_proxy = UserProxyAgent("user_proxy")

    termination = TextMentionTermination("exit", sources=["user_proxy"])

    team = RoundRobinGroupChat(
        [web_surfer, user_proxy], termination_condition=termination
    )

    try:
        await Console(
            team.run_stream(
                task="Find information about AutoGen and write a short summary."
            )
        )
    finally:
        await web_surfer.close()
        await model_client.close()


asyncio.run(main())
```

**Expected behavior**
Proceed without errors

**Stack Trace**
```
Enter your response: Web surfing error:

Traceback (most recent call last):
  File "C:\Users\nicoa\Projects\test\.venv\Lib\site-packages\autogen_ext\agents\web_surfer\_multimodal_web_surfer.py", line 442, in on_messages_stream
    content = await self._generate_reply(cancellation_token=cancellation_token)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\nicoa\Projects\test\.venv\Lib\site-packages\autogen_ext\agents\web_surfer\_multimodal_web_surfer.py", line 612, in _generate_reply
    response = await self._model_client.create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\nicoa\Projects\test\.venv\Lib\site-packages\autogen_ext\models\ollama\_ollama_client.py", line 456, in create
    self._client.chat(  # type: ignore
TypeError: AsyncClient.chat() got an unexpected keyword argument 'tool_choice'
```


### Which packages was the bug in?

Python Extensions (autogen-ext)

### AutoGen library version.

Other (please specify)

### Other library version.

0.4.9.2

### Model used

llama3.2

### Model provider

Ollama

### Other model provider

_No response_

### Python version

3.12

### .NET version

.NET 9

### Operating system

Windows

Labels: needs-triage
State: closed
Unable to dump_component for OpenAIChatCompletionClient using a pydantic as response_format

### What happened?

**Describe the bug**
In order to export a gallery into autogen-studio we have a process to generate a gallery using `from autogenstudio.gallery import builder` which relies on dumping different components.

We have recently added structured outputs into some `OpenAIChatCompletionClient` and discovered we are not able to perform this component dump as we hit a pydantic validation ([Reference](https://github.com/microsoft/autogen/blob/8f8ee0478ab1a8a272f801d1ec1e899eef2277e6/python/packages/autogen-ext/src/autogen_ext/models/openai/config/__init__.py#L9-L10))

Error:
```
pydantic_core._pydantic_core.ValidationError: 1 validation error for OpenAIClientConfigurationConfigModel
response_format
  Input should be a valid dictionary [type=dict_type, input_value=<class 'src.models.labour_order.LabourOrderModel'>, input_type=ModelMetaclass]
    For further information visit https://errors.pydantic.dev/2.10/v/dict_type
```

**To Reproduce**
```python
from autogen_ext.models.openai import OpenAIChatCompletionClient
from pydantic import BaseModel

class Response(BaseModel):
    text: str
    status: str

model = OpenAIChatCompletionClient(
    model="gpt-4o-mini",
    response_format=Response,  # type: ignore
)

print(model.dump_component())
```

**Expected behavior**
Component dump would yield a representation of the OpenAIChatCompletionClient that can be used by the 

**Screenshots**
N/A

**Additional context**
We are creating the gallery with:

```python
from autogenstudio.gallery import builder as gallery_builder
builder = gallery_builder.GalleryBuilder(id="...", name="...")
builder.add_model(
            model_instance.dump_component(), label="...", description="..."
        )
```

### Which packages was the bug in?

Python AgentChat (autogen-agentchat>=0.4.0)

### AutoGen library version.

Python dev (main branch)

### Other library version.

_No response_

### Model used

gpt-4o-mini

### Model provider

OpenAI

### Other model provider

_No response_

### Python version

3.12

### .NET version

None

### Operating system

MacOS

Labels: proj-studio
State: closed
Add support for Streamable HTTP mcp tools

### Description

The SSE transport is now deprecated. The new MCP transport is Streamable HTTP, which can be deployed to stateless serverless environments.
It would be nice to have native support for this transport in the ai-sdk.

https://github.com/modelcontextprotocol/typescript-sdk?tab=readme-ov-file#streamable-http

Labels: feature, ai/core, ai/mcp
State: closed
After using lora to fine-tune the GLM-4 model, the chat template format is wrong

### Reminder

- [X] I have read the README and searched the existing issues.

### System Info

llamafactory 0.9.0

### Reproduction

# glm-4-9b-chat Original template
```
"chat_template": "[gMASK]<sop>{% for item in messages %}{% if item['tools'] is defined %}
\n你是一个名为 GLM-4 的人工智能助手。你是基于智谱AI训练的语言模型 GLM-4 模型开发的，你的任务是针对用户的问题和要求提供适当的答复和支持。\n\n# 可用工具{% set tools = item['tools'] %}{% for tool in tools %}{% if tool['type'] == 'function' %}\n\n## {{ tool['function']['name'] }}\n\n{{ tool['function'] | tojson(indent=4) }}\n在调用上述函数时，请使用 Json 格式表示调用的参数。{% elif tool['type'] == 'python' %}\n\n## python\n\n当你向 `python` 发送包含 Python 代码的消息时，该代码将会在一个有状态的 Jupyter notebook 环境中执行。\n`python` 返回代码执行的输出，或在执行 60 秒后返回超时。\n`/mnt/data` 将会持久化存储你的文件。在此会话中，`python` 无法访问互联网。不要使用 `python` 进行任何网络请求或者在线 API 调用，这些在线内容的访问将不会成功。{% elif tool['type'] == 'simple_browser' %}\n\n## simple_browser\n\n你可以使用 `simple_browser` 工具。该工具支持以下函数：\n`search(query: str, recency_days: int)`：使用搜索引擎进行查询并显示结果，可以使用 `recency_days` 参数控制搜索内容的时效性。\n`mclick(ids: list[int])`：获取一系列指定 id 的页面内容。每次调用时，须选择3-10个页面。选择多个角度的页面，同时尽可能选择可信任的信息来源。考虑到部分页面是无法加载的，你也可以多打开一些可能有用的页面而不用担心内容过多。\n`open_url(url: str)`：打开指定的 URL。\n\n使用 `【{引用 id}†{引用文本}】` 来引用内容。\n\n操作步骤：1. 使用 `search` 来获得信息列表; 2. 使用 `mclick` 来获取指定 ID 页面的内容; 3. 根据获得的内容进行回复。在回复中应当引用信息来源。\n 如果用户提供了 URL，也可以用 `open_url` 直接打开页面。\n如果初次搜索结果没有找到合适的信息，也可以再次使用 `search` 进行搜索。{% elif tool['type'] == 'cogview' %}\n\n## cogview\n\n如果用户的请求中包含了对图像的描述，你可以使用 `cogview` 来生成图像并展示给用户。你需要向 `cogview` 发送图像描述，规则：\n- 发送给 `cogview` 的消息必须使用英语。用户的中文描述必须完全翻译为英语。\n- 应当尽可能详细地描述图像生成的需求，需求描述约 100 英文单词。\n- 保持用户原始描述的意图。不要虚构内容或者没见过的人物。\n- 如无特殊说明，所在地为中国，持有中国立场并遵循中国社会主义价值观。{% endif %}{% endfor %}{% endif %}{% if item['content'] %}<|{{ item['role'] }}|>{{ item['metadata'] }}\n{{ item['content'] }}{% endif %}{% endfor %}{% if add_generation_prompt %}
{% endif %}"
```
#  After using llama-factory fine-tuning
```
"chat_template": "{{ '[gMASK]<sop>' }}{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% endif %}{% if system_message is defined %}{{ '
\n' + system_message }}{% endif %}{% for message in loop_messages %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ '
\n' + content + '
' }}{% elif message['role'] == 'assistant' %}{{ '\n' + content }}{% endif %}{% endfor %}"
```

### Expected behavior

After fine-tuning with llamafactory, the chat template of the model file is wrong, which leads to subsequent reasoning errors. I want to submit a contribution to llamafactory. Which part of the code can construct the chat template? How can I modify it?

### Others

thanks!

Labels: solved
State: closed
engine_args.update(model_args.vllm_config) TypeError: 'NoneType' object is not iterable  model_args没有vllm_config字段

### Reminder

- [X] I have read the README and searched the existing issues.

### System Info

llamafactory version: 0.9.1.dev0
Platform: Linux-6.5.0-35-generic-x86_64-with-glibc2.35
Python version: 3.10.15
PyTorch version: 2.4.0+cu121 (GPU)
Transformers version: 4.45.2
Datasets version: 3.1.0
Accelerate version: 1.0.1
PEFT version: 0.12.0
TRL version: 0.9.6
GPU type: NVIDIA A800-SXM4-80GB
vLLM version: dev

### Reproduction

CUDA_VISIBLE_DEVICES=0,1 python cli.py chat ../examples/inference/qwen2-0.5.yaml

yaml文件内容
model_name_or_path: /root/bei/Models/qwen/Qwen2-0___5B-Instruct/
template: qwen
infer_backend: vllm
vllm_enforce_eager: true
vllm_gpu_util: 0.8



报错信息如下：
```
[INFO|2024-11-11 10:50:51] llamafactory.data.template:157 >> Replace eos token: 


Traceback (most recent call last):
  File "/root/miniconda/envs/bei_llamaFactory/bin/llamafactory-cli", line 8, in <module>
    sys.exit(main())
  File "/data/bei/LLaMA-Factory/src/llamafactory/cli.py", line 81, in main
    run_chat()
  File "/data/bei/LLaMA-Factory/src/llamafactory/chat/chat_model.py", line 158, in run_chat
    chat_model = ChatModel()
  File "/data/bei/LLaMA-Factory/src/llamafactory/chat/chat_model.py", line 55, in __init__
    self.engine: "BaseEngine" = VllmEngine(model_args, data_args, finetuning_args, generating_args)
  File "/data/bei/LLaMA-Factory/src/llamafactory/chat/vllm_engine.py", line 88, in __init__
    engine_args.update(model_args.vllm_config)
TypeError: 'NoneType' object is not iterable

```


model_args内容如下
```
ModelArguments(vllm_maxlen=4096, vllm_gpu_util=0.8, vllm_enforce_eager=True, vllm_max_lora_rank=32, vllm_config=None, export_dir=None, export_size=1, export_device='cpu', export_quantization_bit=None, export_quantization_dataset=None, export_quantization_nsamples=128, export_quantization_maxlen=1024, export_legacy_format=False, export_hub_model_id=None, image_resolution=512, video_resolution=128, video_fps=2.0, video_maxlen=64, quantization_method='bitsandbytes', quantization_bit=None, quantization_type='nf4', double_quantization=True, quantization_device_map=None, model_name_or_path='/root/bei/Models/qwen/Qwen2-0___5B-Instruct/', adapter_name_or_path=None, adapter_folder=None, cache_dir=None, use_fast_tokenizer=True, resize_vocab=False, split_special_tokens=False, new_special_tokens=None, model_revision='main', low_cpu_mem_usage=True, rope_scaling=None, flash_attn='auto', shift_attn=False, mixture_of_depths=None, use_unsloth=False, use_unsloth_gc=False, enable_liger_kernel=False, moe_aux_loss_coef=None, disable_gradient_checkpointing=False, upcast_layernorm=False, upcast_lmhead_output=False, train_from_scratch=False, infer_backend='vllm', offload_folder='offload', use_cache=True, infer_dtype='auto', hf_hub_token=None, ms_hub_token=None, om_hub_token=None, print_param_status=False, compute_dtype=None, device_map='auto', model_max_length=None, block_diag_attn=False)
```

### Expected behavior

vllm多卡可以正常推理

### Others

无

Labels: solved
State: closed
Autogen 0.4.9.2 doesn't work with OpenAI 1.66.3

### What happened?

**Describe the bug**
We are having issues with autogen 0.4.9 and openai 1.66.3. It says that there is a module error "from openai.types.beta.vector_store import VectorStore ModuleNotFoundError: No module named 'openai.types.beta.vector_store'". It says to do this "Please install autogen-ext with the "openai" extra: pip install "autogen-ext[openai]" but that doesn't work.

**To Reproduce**
Upgrade to open 1.66.3 and it will cause errors when trying to use the vector stores/ OpenAIAssistantAgent. It seems to be something in the openAI extension. OpenAIAssistantAgent class seems to not be working as it says there is module missing. The is in the error: from autogen_ext.agents.openai import OpenAIAssistantAgent 

**Expected behavior**
Expected to not have this error show up and for it to call OpenAIAssistant


### Which packages was the bug in?

Python Extensions (autogen-ext), Python AgentChat (autogen-agentchat>=0.4.0)

### AutoGen library version.

Python dev (main branch)

### Other library version.

_No response_

### Model used

_No response_

### Model provider

Azure OpenAI

### Other model provider

_No response_

### Python version

3.12

### .NET version

None

### Operating system

MacOS

Labels: needs-triage
State: closed
[Bug] 设置了 DEFAULT_AGENT_CONFIG 后系统助手依然是 gpt-4o-mini

### 📦 Environment

Docker

### 📌 Version

v1.52.16

### 💻 Operating System

Ubuntu

### 🌐 Browser

Chrome

### 🐛 Bug Description

已经设置了 DEFAULT_AGENT_CONFIG，并且 ENABLED_OPENAI=0，但是 默认的系统助手依然使用 gpt-4o-mini

```yaml
version: '3.8'

services:
  lobe-chat:
    image: lobehub/lobe-chat
    container_name: lobe-chat
    restart: always
    ports:
      - '3210:3210'
    env_file:
      - .env
```

```
DEFAULT_AGENT_CONFIG='model=deepseek-r1:32b;provider=ollama'
FEATURE_FLAGS="-knowledge_base"

ENABLED_OPENAI=0

ENABLED_OLLAMA=1
OLLAMA_PROXY_URL=http://192.168.2.206:11434
OLLAMA_MODEL_LIST="+deepseek-r1:32b,+qwen2.5:latest"
OLLAMA_ORIGINS="*"

LLM_VISION_IMAGE_USE_BASE64=1

```

### 📷 Recurrence Steps

- 使用 docker compose 启动 lobe chat
- 使用匿名浏览方式打开 lobechat 查看初始设置

### 🚦 Expected Behavior

希望可以把 agent 使用的模型替换掉

### 📝 Additional Information

_No response_

Labels: released, provider:ollama
State: closed
MCP tool should have a timeout setting.

The code is as follows
```python
mcp_email_server = StdioServerParams(
    command="python", args=["-m", "mcp_servers.mcp_mail_processor"]
)
tools_email_processor = await mcp_server_tools(mcp_email_server)
```

If an error occurs, like this
`C:\Users\jialiu3\AppData\Local\miniforge3\envs\office\python.exe: No module named mcp_servers.mcp_mail_processor`

**Question:**
I don't know why the program freezes when an error is detected, even with try-except. Can anyone help me?
I hope that when such an error is reported, the program can exit normally or execute the following code in sequence.

_Originally posted by @Septa2112 in https://github.com/microsoft/autogen/discussions/6030_

We need to add a `timeout_seconds` setting to this:

https://github.com/microsoft/autogen/blob/855bcd711c9aca03057717b0efe18235a24827d4/python/packages/autogen-ext/src/autogen_ext/tools/mcp/_session.py#L13-L14

and add timeout setting to `McpToolAdapter` and `mcp_server_tools`. 


Labels: good first issue, help wanted, proj-extensions
State: closed
Introduce `OpenAIAgent` backed by the Response API in Extensions.

### Confirmation

- [x] I confirm that I am a maintainer and so can use this template. If I am not, I understand this issue will be closed and I will be asked to use a different template.

### Issue body

Assistant API will be deprecated in 2026, replaced by Response API: https://platform.openai.com/docs/guides/responses-vs-chat-completions.

We should start support the Response API by introducing `OpenAIAgent` that is backed by the Response API, which can be stateful. 

The new agent should conform to the behavior of `AssistantAgent` in AgentChat, while backed directly by the `openai` library.

Thoughts, feedback welcome! 

Labels: help wanted, proj-extensions
State: closed
Support async `selector_func` and `candidate_func` in `SelectorGroupChat`

### Confirmation

- [x] I confirm that I am a maintainer and so can use this template. If I am not, I understand this issue will be closed and I will be asked to use a different template.

### Issue body

Because model clients are async and we want to be able to use that in selector functions. 

Labels: help wanted, proj-agentchat
State: closed
AutoGen Studio 0.4.2: Copy-pasting in Tool Name field kicks user back and breaks editing

### What happened?

**Describe the bug**
When I copy-paste into the "Name" field of a tool within an agent in AutoGen Studio (0.4.2), I am kicked back to the agent editing window. After that, trying to re-edit the tool results in the tool's name being repeatedly appended to the top of the window, rendering the tool and agent uneditable (see screenshot below).

**To Reproduce**
1. Create a new team in the AutoGen UI (Studio 0.4.2)
2. Edit the default agent.
3. Click to edit the default agent's "calculator" tool.
4. Copy/paste using shortcuts (Ctrl+C / Ctrl+V) a new Python tool to replace the "calculator" tool.
5. Then, try to copy-paste the name of the new tool to replace the name of the default tool.
6. You should then be kicked back to the agent editing window. *Note: This step is not consistently reproducible; you may need to attempt copy-pasting (Ctrl+C / Ctrl+V) in the "Name" field multiple times.*
7. Try to re-edit the tool. You should observe the tool's name being repeatedly appended to the top of the window, and the tool/agent becoming uneditable.

**Expected behavior**
Copy-pasting into the tool's "Name" field should update the name without kicking the user back to the agent editing window and without rendering the tool/agent uneditable.

**Screenshots**

![Image](https://github.com/user-attachments/assets/7ea11926-3c9f-4f8f-a34a-772946c81a99)

**Additional context**
The issue is temporarily resolved by saving the agent and reopening the editing window. All changes, including the copy-pasted tool name, are saved. 

### Which packages was the bug in?

AutoGen Studio (autogensudio)

### AutoGen library version.

Python dev (main branch)

### Python version

3.12

### Operating system

Windows

Labels: proj-studio
State: closed
使用llamafactory-cli api启动llama3.1-70b-Instruct模型，在dify中应用，模型失去function call能力

### Reminder

- [X] I have read the README and searched the existing issues.

### System Info

启动环境不存在问题，模型可以正常启动推理

### Reproduction

将模型注册到dify中，llama3.1-70b-Instruct是支持function call的，在dify中选择模型支持function call，在dify中应用的时候模型不会调用工具；在dify中选择模型不支持function call，在dify中应用的时候模型会react的形式调用工具。

### Expected behavior

请问llamafactory-cli api启动的模型是不支持function call吗？还是我参数没写对？llamafactory支持与dify集成吗？

### Others

_No response_

Labels: solved
State: closed
[Bug]: assert len(indices) == len(inputs) with Qwen/Qwen2-VL-2B-Instruct

### Reminder

- [x] I have read the README and searched the existing issues.

### System Info


- `llamafactory` version: 0.9.1.dev0
- Platform: Linux-4.19.24-7.34.cbp.al7.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.14
- PyTorch version: 2.4.0+cu121 (GPU)
- Transformers version: 4.46.1
- Datasets version: 3.0.1
- Accelerate version: 1.0.1
- PEFT version: 0.12.0
- TRL version: 0.9.6
- GPU type: NVIDIA A10
- DeepSpeed version: 0.15.4
- Bitsandbytes version: 0.44.1
- vLLM version: 0.6.3.post1

### Reproduction

Using webui or vllm api will result in an error. The startup command is as follows:
CUDA_VISIBLE_DEVICES=0,1,2,3 API_PORT=8000 llamafactory-cli api
--model_name_or_path /mnt/workspace/models/qwen2_vl_7b
--template qwen2_vl
--infer_backend vllm
--vllm_enforce_eager

or llamafactory-cli webui

curl http://localhost:8000/v1/chat/completions
-H "Content-Type: application/json"
-d '{
"model": "Qwen2-VL-7B-Instruct",
"messages": [
{"role": "system", "content": "你是资深分析师."},
{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "xxx"}},
{"type": "text", "text": "描述用户文化程度水平分布"}
]}
]
}'

![image](https://github.com/user-attachments/assets/bf5382d7-6607-4842-90fc-41e6c9eeede3)


### Expected behavior

_No response_

### Others

_No response_

Labels: solved
State: closed
[Bug] chat聊天框里多了很多我没设置的模型

### 📦 部署环境

Docker

### 📌 软件版本

v1.53.4

### 💻 系统环境

Ubuntu

### 🌐 浏览器

Chrome

### 🐛 问题描述

这是我设置里开启的模型列表 

![Image](https://github.com/user-attachments/assets/260c0d17-db29-4392-95b5-407097bb59d9)

实际展示的时候模型列表多了一些我没开启的模型

![Image](https://github.com/user-attachments/assets/970e59f3-b8c0-482d-8149-321447e8f8a4)

### 📷 复现步骤

如上，环境变量没有设置 OPENAI_MODEL_LIST，渠道是openai，服务对接的是oneapi

### 🚦 期望结果

设置的模型列表和展示列表保持一致

### 📝 补充信息

_No response_

Labels: released
State: closed
[Bug] AZURE配置DeepSeek-R1报错

### 📦 部署环境

Vercel

### 📌 软件版本

v1.53.4

### 💻 系统环境

Windows

### 🌐 浏览器

Chrome

### 🐛 问题描述

Azure配置DeepSeek-R1报错，获取模型也没有DeepSeek-R1，手动添加的，检查报这个错。同样配置在ONE api内测试通过。

![Image](https://github.com/user-attachments/assets/49eb1a07-6a47-43fa-b222-f018b05f65ba)
![Image](https://github.com/user-attachments/assets/4983a6d1-29ef-45e1-9e38-511d3f0a2496)
![Image](https://github.com/user-attachments/assets/0d002d37-899a-499d-846a-040290d513d4)
![Image](https://github.com/user-attachments/assets/996de993-a91e-41f0-bb19-e8d7ae3795d8)
![Image](https://github.com/user-attachments/assets/c7751421-d38a-4a99-8f93-5412d26cf75f)

### 📷 复现步骤

Azure配置DeepSeek-R1报错
{
  "error": {
    "code": "no_model_name",
    "message": "No model specified in request. Please provide a model name in the request body or as a x-ms-model-mesh-model-name header.",
    "details": "No model specified in request. Please provide a model name in the request body or as a x-ms-model-mesh-model-name header."
  },
  "endpoint": "https://ai-irol7659638ai477531246046.services.ai.azure.com/models/chat/completions#",
  "provider": "azure"
}
获取模型也没有DeepSeek-R1，手动添加的，检查报这个错


### 🚦 期望结果

_No response_

### 📝 补充信息

_No response_

Labels: released
State: closed
[Bug]自定义供应商 是否可以输入APIkey使用 我部署的服务不需要APIkey 只需要URL

### 📦 部署环境

Docker

### 📌 软件版本

laster

### 💻 系统环境

Ubuntu

### 🌐 浏览器

Chrome

### 🐛 问题描述

自定义供应商 是否可以输入APIkey使用 我部署的服务不需要APIkey 只需要URL

### 📷 复现步骤

_No response_

### 🚦 期望结果

_No response_

### 📝 补充信息

_No response_

Labels: released
State: closed
Anthropic client should support 'thinking' argument

### What happened?

To take full advantage of the latest Anthropic model, Claude 3.7 Sonnet, the Anthropic client should support the `thinking` parameter as documented [here](https://docs.anthropic.com/en/api/messages#body-thinking).

Maybe this should count as a feature request, but it's so trivial I wasn't sure it qualified.

I think literally all that needs to be done is to add `'thinking'` to [this line](https://github.com/microsoft/autogen/blob/7047fb8b8dd8298013408ab860a69c943d548989/python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py#L490):

```python
        # Optional parameters
        for param in ["top_p", "top_k", "stop_sequences", "metadata"]:
```

And probably add it as a constructor parameter as well.

I have another question, though. Currently, almost nothing seems to be using the `extra_create_args` parameter. What if I want different `AssistantAgent`s to use different arguments (including temperature and others). It seems that if I want this, I need to construct different clients for each set of arguments. But that feels a little odd. Is it by design?

I'd like to go a step further and allow an `AssistantAgent`'s parameters to change over its lifetime. I have agents which, depending on the circumstances, may want more predictable or more creative output. So I would like the ability to change the temperature and top-p dynamically. It would seem logical to me to do this by calling a method on the agent (possibly triggered by a tool, either invoked by the agent itself or a coordinating agent). Again, is there a design reason for not allowing this, or has the use case just not come up often enough?

I'm happy to submit pull requests to add the necessary functionality (both the `thinking` parameter and the other changes discussed above), I just wanted to check that I'm not going down the wrong path.

### Which packages was the bug in?

Python AgentChat (autogen-agentchat>=0.4.0)

### AutoGen library version.

Python dev (main branch)

### Other library version.

_No response_

### Model used

claude-3-7-sonnet-20250219

### Model provider

Anthropic

### Other model provider

_No response_

### Python version

None

### .NET version

None

### Operating system

None

Labels: needs-triage
State: closed