Skip to content

[Agent] TypeError in Plan.replace_task(): takes 2 positional arguments but 3 were given #650

@huhao0926

Description

@huhao0926

Initial Checks

  • I have searched GitHub for a duplicate issue and I'm sure this is something new
  • I have read and followed the docs & demos and still think this is a bug
  • I am confident that the issue is with ms-agent (not my code, or another library in the ecosystem)

What happened + What you expected to happen

When running the data science assistant functionality, a TypeError occurred during the call to Plan.replace_task(). It seems that three positional arguments were passed to this method, while it only accepts two.
Error Log:
2025-07-15 18:02:46.189 - modelscope-agent - ERROR - | message: error: Plan.replace_task() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
File "/Users/hao0926.hu/repair/ms-agent/ds_test.py", line 14, in
responses = ds_assistant.run(question)
File "/Users/hao0926.hu/repair/ms-agent/modelscope_agent/agent.py", line 22, in wrapper
response = func(self, *args, **kwargs)
File "/Users/hao0926.hu/repair/ms-agent/modelscope_agent/agent.py", line 116, in run
result = self._run(*args, **kwargs)
File "/Users/hao0926.hu/repair/ms-agent/modelscope_agent/agents/data_science_assistant.py", line 801, in _run
raise e
File "/Users/hao0926.hu/repair/ms-agent/modelscope_agent/agents/data_science_assistant.py", line 766, in _run
self.plan.replace_task(task, decomposed_tasks)
TypeError: Plan.replace_task() takes 2 positional arguments but 3 were given
/Users/hao0926.hu/repair/ms-agent/modelscope_agent/tools/code_interpreter/code_interpreter_nb.py:64: RuntimeWarning: coroutine 'KernelManager._async_is_alive' was never awaited
if self.nb_client.km is not None and self.nb_client.km.is_alive():
/Users/hao0926.hu/repair/ms-agent/modelscope_agent/tools/code_interpreter/code_interpreter_nb.py:65: RuntimeWarning: coroutine 'KernelManager._async_shutdown_kernel' was never awaited
self.nb_client.km.shutdown_kernel(now=True)
/Users/hao0926.hu/repair/ms-agent/modelscope_agent/tools/code_interpreter/code_interpreter_nb.py:66: RuntimeWarning: coroutine 'KernelManager._async_cleanup_resources' was never awaited
self.nb_client.km.cleanup_resources()

[Agent] TypeError in Plan.replace_task(): takes 2 positional arguments but 3 were given

Versions / Dependencies

release/0.8

Reproduction script

rom modelscope_agent.agents.data_science_assistant import DataScienceAssistant
from modelscope_agent.tools.metagpt_tools.tool_recommend import TypeMatchToolRecommender

llm_config = {
'model': 'Qwen/Qwen3-8B',
'model_server': 'openai',
'api_base': 'https://api.siliconflow.cn/v1',
'api_key': '硅基流动api_key'
}
tool_recommender = TypeMatchToolRecommender(tools=[""])
ds_assistant = DataScienceAssistant(llm=llm_config, tool_recommender=tool_recommender)
question = "This is a medical dataset with over fifty anonymized health characteristics linked to three age-related conditions. Your goal is to predict whether a subject has or has not been diagnosed with one of these conditions. The target column is Class. Perform data analysis, data preprocessing, feature engineering, and modeling to predict the target. Report F1 Score on the eval data. Train data path: ‘/Users/hao0926.hu/pyproject/data_interpreter/di_dataset/ml_benchmark/04_titanic/split_train.csv', eval data path: ‘/Users/hao0926.hu/pyproject/data_interpreter/di_dataset/ml_benchmark/04_titanic/split_eval.csv' . It is only necessary to provide the relevant code, without actually running it to verify whether it can run successfully"
responses = ds_assistant.run(question)
for res in responses:
print(res)

Issue Severity

None

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions