Default Timeout for Experiments in AI Scientist v2: Complete Configuration Guide
AI Scientist v2 enforces a default experiment timeout of 3600 seconds (1 hour), defined in bfts_config.yaml and applied through the ExecConfig dataclass and code interpreter.
When running automated scientific experiments with SakanaAI/AI-Scientist-v2, understanding execution limits is critical for resource management. The default timeout for experiments in AI Scientist v2 is set to 3600 seconds to prevent runaway processes while allowing substantial compute time for complex ML workflows. This limit is configured through a layered system involving YAML configuration files and Python dataclasses.
Where the Default Timeout Is Configured
The 3600-second limit originates in the project's YAML configuration and propagates through the Python dataclass layer before reaching the execution engine.
bfts_config.yaml Settings
In the repository root, bfts_config.yaml explicitly sets the execution timeout under the exec section (line 19):
exec:
timeout: 3600
This single value serves as the source of truth for all experiment runs unless overridden by user configuration.
ExecConfig Dataclass Definition
This YAML value maps to the ExecConfig dataclass in ai_scientist/treesearch/utils/config.py (line 78), which stores the timeout as an integer field alongside other execution parameters:
@dataclass
class ExecConfig:
timeout: int
agent_file_name: str
format_tb_ipython: bool
When the system loads the configuration file, it instantiates this dataclass, making the timeout value available throughout the tree search pipeline.
How the Interpreter Enforces the Timeout
During actual code execution, the interpreter applies this limit when running generated experiment code. In ai_scientist/treesearch/interpreter.py (line 85), the __init__ method accepts the timeout with a default value of 3600:
def __init__(self, ..., timeout: int = 3600, ...):
self.timeout = timeout
Unless explicitly overridden during interpreter instantiation, every experiment inherits this one-hour limit. The interpreter monitors execution time and terminates processes that exceed this threshold, ensuring that stuck or inefficient experiments abort automatically rather than consuming unlimited compute resources.
Customizing the Experiment Timeout
You can adjust this behavior through configuration file edits or direct parameter passing when instantiating components programmatically.
To change the timeout for all experiments, modify the value in bfts_config.yaml:
exec:
timeout: 7200 # 2 hours
For dynamic configuration loading, override the value before creating the ExecConfig instance:
from pathlib import Path
import yaml
from ai_scientist.treesearch.utils.config import ExecConfig
cfg_path = Path("bfts_config.yaml")
with cfg_path.open() as f:
raw_cfg = yaml.safe_load(f)
# Override timeout for short experiments
raw_cfg["exec"]["timeout"] = 900 # 15 minutes
exec_cfg = ExecConfig(**raw_cfg["exec"])
print(f"Applied timeout: {exec_cfg.timeout} seconds")
Running Experiments with CLI Defaults
When launching experiments via the command line interface, the system automatically loads the default 3600-second limit from the specified configuration file.
python launch_scientist_bfts.py --config bfts_config.yaml
The script parses the YAML, instantiates ExecConfig, and passes the timeout value to the interpreter. Each generated code cell executed during the tree search process is subject to this limit independently.
Summary
- The default timeout for experiments in AI Scientist v2 is 3600 seconds (1 hour).
- This value is defined in
bfts_config.yaml(line 19) under theexec.timeoutkey. - The
ExecConfigdataclass inai_scientist/treesearch/utils/config.py(line 78) stores this value as an integer field. - The interpreter in
ai_scientist/treesearch/interpreter.py(line 85) applies this limit when executing generated code cells. - Users can override the default by modifying the YAML file or programmatically adjusting the configuration before instantiation.
Frequently Asked Questions
What happens when an experiment exceeds the 3600-second timeout?
When execution time surpasses the configured limit, the interpreter aborts the running code cell and returns a timeout error. This prevents infinite loops or excessively long computations from blocking the automated research pipeline, allowing the system to proceed with alternative experiment branches.
Can I set different timeouts for specific experiment phases?
Currently, the timeout is configured globally per execution context through ExecConfig. For phase-specific limits, you must instantiate separate interpreter instances with different timeout parameters for each phase, or implement custom timing logic within your experiment code that respects the global hard limit.
Is the timeout measured per code cell or per full experiment run?
According to the implementation in ai_scientist/treesearch/interpreter.py, the timeout applies to individual code execution calls—typically individual cells or script blocks generated during the tree search. The overall experiment may consist of multiple sequential executions, each subject to the 3600-second limit independently.
Does the default timeout accommodate long-running ML training?
For moderate-sized model training or standard evaluation loops, one hour typically provides sufficient execution time. However, for large-scale training requiring multiple hours or distributed compute, you must override the default in bfts_config.yaml or pass a custom value via the configuration loader to prevent premature termination of legitimate long-running processes.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →