Archived Documentation

Welcome to the developer documentation for SigOpt. If you have a question you can’t answer, feel free to contact us!
You are currently viewing archived SigOpt documentation. The newest documentation can be found here.


You can use our Python API Client to call API endpoints.

Our Python API Client is available via pip, with source code on GitHub:

pip install sigopt

Find your SigOpt API token on the API tokens page.

# Pass your API token directly, overriding any environment variables
from sigopt import Connection
conn = Connection(client_token=SIGOPT_API_TOKEN)

Run Some Code

Now, you can run SigOpt's Optimization Loop.

First, setup the experiment:

from sigopt import Connection
from sigopt.examples import franke_function

conn = Connection(client_token=SIGOPT_API_TOKEN)

experiment = conn.experiments().create(
  name='Franke Optimization (Python)',
  # Define which parameters you would like to tune
    dict(name='x', type='double', bounds=dict(min=0.0, max=1.0)),
    dict(name='y', type='double', bounds=dict(min=0.0, max=1.0)),
  metrics=[dict(name='function_value', objective='maximize')],
  # Define an Observation Budget for your experiment
print("Created experiment:" +

Then, run the optimization loop itself:

# Evaluate your model with the suggested parameter assignments
# Franke function -
def evaluate_model(assignments):
  return franke_function(assignments['x'], assignments['y'])

# Run the Optimization Loop until the Observation Budget is exhausted
while experiment.progress.observation_count < experiment.observation_budget:
  suggestion = conn.experiments(
  value = evaluate_model(suggestion.assignments)

  # Update the experiment object
  experiment = conn.experiments(

# Fetch the best configuration and explore your experiment
all_best_assignments = conn.experiments(
# Returns a list of dict-like Observation objects
best_assignments =[0].assignments
print("Best Assignments: " + str(best_assignments))
print("Best x value: " + str(best_assignments['x']))
print("Best y value: " + str(best_assignments['y']))
print("Explore your experiment:" + + "/analysis")

Run More Code: Tune a Random Forest

Learn how to Tune a Random Forest using SigOpt's Python API Client. This simple example uses an open source machine learning library and can be extended to tune the hyperparameters of any machine learning model.

More Examples

To see more examples of how to use Sigopt and Python to tune machine learning models and more, check out our Machine Learning Templates page or clone our GitHub examples repository:

git clone


The SigOpt Python API Client returns Python objects. Here is an example where we fetch an experiment and print its name:

experiment = conn.experiments(experiment_id).fetch()

You can also refer to our complete API Object Reference.


Please refer to our complete API Endpoint Reference. Each page has a tab where you can view how to construct the endpoint call in Python. You can refer to the above section on objects for more information about the return type of the Python API Client calls.


If you are connecting to SigOpt behind a proxy, you may need to configure your client appropriately.

  'http': '',
  'https': 'http://user:[email protected]:1080',

See the documentation for the requests module for more information.


By default requests will timeout in 150 seconds, but it is also configurable.

conn.experiments(id).fetch() # will timeout after 5 seconds