Skip to content

[Bug] MLE-STAR Agent crashes with FileNotFoundError when running custom tasks #742

@Xia-Rahman

Description

@Xia-Rahman

Name of sample affected

python/agents/machine-learning-engineering (MLE-STAR Agent)

Description of issue

The Machine Learning Engineering agent fails to execute custom tasks due to three distinct hardcoding and pathing issues.

  1. Hardcoded Default Task: In sub_agents/initialization/agent.py, the prepare_task function is hardcoded to look for "california-housing-prices" and a "task_description.txt" file, regardless of the actual task directory present or selected.
  2. Hardcoded File Extension: The code expects .txt descriptions, while the sample data provided in the repo uses .md.
  3. Incorrect Relative Paths: In both sub_agents/initialization/agent.py and sub_agents/ensemble/agent.py, the create_workspace function constructs file paths using os.path.join(data_dir, task_name). This results in an incorrect path (e.g., ./machine_learning_engineering/tasks/diabetes) because the agent execution context is already at the project root. It should look for tasks/diabetes.

These issues prevent any custom task from running without manually editing the source code in multiple files.

Environment

  • OS & Architecture: Linux (Google Colab / Ubuntu 22.04 x86_64)
  • Python version: 3.12
  • Java version: N/A (Python sample)
  • Other: Poetry (latest)

Reproduction steps or code

  1. Clone the adk-samples repository.
  2. Navigate to python/agents/machine-learning-engineering.
  3. Install dependencies: poetry install.
  4. Create a custom task directory tasks/diabetes (or any name) in the project root.
  5. Add train.csv, test.csv, and description.md to that folder.
  6. Run the agent: adk run machine_learning_engineering.
  7. At the prompt [user]:, enter: execute the task.

Error log

Error 1 (Hardcoded task/file extension):

File "/.../sub_agents/initialization/agent.py", line 237, in prepare_task
    task_description = open(
                       ^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './machine_learning_engineering/tasks/california-housing-prices/task_description.txt'

Error 2 (Incorrect relative path after fixing Error 1):

File "/.../sub_agents/initialization/agent.py", line 287, in create_workspace
    files = os.listdir(os.path.join(data_dir, task_name))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './machine_learning_engineering/tasks/diabetes'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpythonPull requests that update python code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions