dragonfly logo

dragonfly

dragonfly/dragonfly

An open source Python library for scalable Bayesian optimisation.

GraphCanon updated 2w · GitHub synced 2w

894 stars238 forksLast push 3y Python MIT

Decision brief

Dragonfly is an open-source Python library that specializes in scalable Bayesian optimization

Good fit when

  • When dealing with large-scale problems where traditional optimization methods may not be efficient enough.
  • For tasks requiring robust handling of noisy data, as Dragonfly's approach to Bayesian optimization includes stochastic algorithms designed for such scenarios.

Avoid when

  • If the problem at hand can be effectively managed by simpler or more lightweight optimization tools; Dragonfly’s strength lies in scalability and complex scenario management.
  • In environments where Python or extensive dependencies are not desirable, as installing and running Dragonfly requires specific setup including gfortran for certain operations.
Pricing:
freemium - Available under the MIT License, free to use but does require attention to licensing when redistributing derivative works.
Requirements:
Installation requires Python and gfortran.; Additional dependencies can be installed via the `pip` package manager.

Observed Jul 17, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Dormant (1141d since push)
As of 2w
Provenance
Not a fork · Organization account
As of 2w
Security (OSV)
No criticals
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

pip install dragonfly
PyPI

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

Provides APIs and command-line utilities to perform Bayesian optimisation suitable for large-scale problems.

Capability facts

Languages
python

Source: github.language · Aug 4, 2026

Categories

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

Python runtimePython

Source: README excerpt (regex_v1, Aug 4, 2026)

$ sudo apt-get install python-dev python3-dev gfortran # On Ubuntu/Debian
Source link

Tags

README

Installation

See here for detailed instructions on installing Dragonfly and its dependencies.

Quick Installation: If you have done this kind of thing before, you should be able to install Dragonfly via pip.

$ sudo apt-get install python-dev python3-dev gfortran # On Ubuntu/Debian
$ pip install numpy
$ pip install dragonfly-opt -v

Testing the Installation: You can import Dragonfly in python to test if it was installed properly. If you have installed via source, make sure that you move to a different directory to avoid naming conflicts.

$ python
>>> from dragonfly import minimise_function
>>> # The first argument below is the function, the second is the domain, and the third is the budget.
>>> min_val, min_pt, history = minimise_function(lambda x: x ** 4 - x**2 + 0.1 * x, [[-10, 10]], 10);  
...
>>> min_val, min_pt
(-0.32122746026750953, array([-0.7129672]))

Due to stochasticity in the algorithms, the above values for min_val, min_pt may be different. If you run it for longer (e.g. min_val, min_pt, history = minimise_function(lambda x: x ** 4 - x**2 + 0.1 * x, [[-10, 10]], 100)), you should get more consistent values for the minimum.

If the installation fails or if there are warning messages, see detailed instructions here.

 


Quick Start

Dragonfly can be used directly in the command line by calling dragonfly-script.py or be imported in python code via the maximise_function function in the main library or in ask-tell mode. To help get started, we have provided some examples in the examples directory. See our readthedocs getting started pages (command line, Python, Ask-Tell) for examples and use cases.

Command line: Below is an example usage in the command line.

$ cd examples
$ dragonfly-script.py --config synthetic/branin/config.json --options options_files/options_example.txt

In Python code: The main APIs for Dragonfly are defined in dragonfly/apis. For their definitions and arguments, see dragonfly/apis/opt.py and dragonfly/apis/moo.py. You can import the main API in python code via,

from dragonfly import minimise_function, maximise_function
func = lambda x: x ** 4 - x**2 + 0.1 * x
domain = [[-10, 10]]
max_capital = 100
min_val, min_pt, history = minimise_function(func, domain, max_capital)
print(min_val, min_pt)
max_val, max_pt, history = maximise_function(lambda x: -func(x), domain, max_capital)
print(max_val, max_pt)

Here, func is the function to be maximised, domain is the domain over which func is to be optimised, and max_capital is the capital available for optimisation. The domain can be specified via a JSON file or in code. See here, here, here, here, here, here, here, here, here, here, and here for more detailed examples.

In Ask-Tell Mode: Ask-tell mode provides you more control over your experiments where you can supply past results to our API in order to obtain a recommendation. See

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.