code: def add(workflow_definition: dict, templates_root: str):
      
      schema_path = join(dirname(__file__), 'schema', 'workflow_definition.json')
      with open(schema_path, 'r') as file:
          schema = json.loads(file.read())
  
      jsonschema.validate(workflow_definition, schema)
  
      _id = workflow_definition['id']
      _version = workflow_definition['version']
      _load_templates(workflow_definition, templates_root)
  
      workflow_id = workflow_definition['id']
      version = workflow_definition['version']
      name = "workflow_definitions:{}:{}".format(workflow_id, version)
  
      if DB.get_keys(name):
          raise KeyError('Workflow definition already exists: {}'.format(name))
  
      # DB.set_hash_values(name, workflow_definition)
      DB.save_dict(name, workflow_definition, hierarchical=False)
docs: Add a workflow definition to the Configuration Database.
  
      Templates are expected to be found in a directory tree with the following
      structure:
  
          - workflow_id:
              |- workflow_version
                  |- stage_id
                      |- stage_version
                          |- <templates>
  
      Args:
          workflow_definition (dict): Workflow definition.
          templates_root (str): Workflow templates root path