docs: def add_workflow(self, workflow, commit=False):
          """
          Add a new workflow and optionally commit it to the database
          :param workflow: The workflow
          :param commit: Whether to commit the workflow to the database
          :type workflow: Workflow
          :type commit: bool
          :return: None
          """
          if workflow.workflow_id in self.workflows:
              raise KeyError("Workflow with id {} already exists".format(workflow.workflow_id))
  
          self.workflows[workflow.workflow_id] = workflow
          logging.info("Added workflow {} to workflow manager".format(workflow.workflow_id))
  
          # Optionally also save the workflow to database
          if commit:
              self.commit_workflow(workflow.workflow_id)
          else:
              self.uncommitted_workflows.add(workflow.workflow_id)