class_docstr: Components orchestration engine.
  
  Builds a graph of components and orchestrates their execution according to the execution graph.
class_docstr_tok: ["Components","orchestration","engine",".","Builds","a","graph","of","components","and","orchestrates","their","execution","according","to","the","execution","graph","."]
docstr: Create a component for the given component. Components are not connected to anything by default:
  use `Pipeline.connect()` to connect components together.
  
  Component names must be unique, but component instances can be reused if needed.
  
  Args:
      name: the name of the component.
      instance: the component instance.
  
  Returns:
      None
  
  Raises:
      ValueError: if a component with the same name already exists
      PipelineValidationError: if the given instance is not a Canals component
docstr_tok: ["Create","a","component","for","the","given","component",".","Components","are","not","connected","to","anything","by","default",":","use","`","Pipeline.connect","(",")","`","to","connect","components","together",".","Component","names","must","be","unique",",","but","component","instances","can","be","reused","if","needed",".","Args",":","name",":","the","name","of","the","component",".","instance",":","the","component","instance",".","Returns",":","None","Raises",":","ValueError",":","if","a","component","with","the","same","name","already","exists","PipelineValidationError",":","if","the","given","instance","is","not","a","Canals","component"]
code: def add_component(self, name: str, instance: Component) -> None:
      """
      Create a component for the given component. Components are not connected to anything by default:
      use `Pipeline.connect()` to connect components together.
  
      Component names must be unique, but component instances can be reused if needed.
  
      Args:
          name: the name of the component.
          instance: the component instance.
  
      Returns:
          None
  
      Raises:
          ValueError: if a component with the same name already exists
          PipelineValidationError: if the given instance is not a Canals component
      """
      # Component names are unique
      if name in self.graph.nodes:
          raise ValueError(
              f"A component named '{name}' already exists in this pipeline: choose another name."
          )
  
      # Components can't be named `_debug`
      if name == "_debug":
          raise ValueError(
              "'_debug' is a reserved name for debug output. Choose another name."
          )
  
      # Component instances must be components
      if not isinstance(instance, Component):
          raise PipelineValidationError(
              f"'{type(instance)}' doesn't seem to be a component. Is this class decorated with @component?"
          )
  
      # Create the component's input and output sockets
      input_sockets = getattr(instance, "__canals_input__", {})
      output_sockets = getattr(instance, "__canals_output__", {})
  
      # Add component to the graph, disconnected
      logger.debug("Adding component '%s' (%s)", name, instance)
      self.graph.add_node(
          name,
          instance=instance,
          input_sockets=input_sockets,
          output_sockets=output_sockets,
          visits=0,
      )
  
imports: from typing import Optional, Any, Dict, List, Union, TypeVar, Type, Set
  import os
  import json
  import datetime
  import logging
  import importlib
  from pathlib import Path
  from copy import deepcopy
  from collections import defaultdict
  import networkx
  from haystack.core.component import component, Component, InputSocket, OutputSocket
  from haystack.core.errors import PipelineError, PipelineConnectError, PipelineMaxLoops, PipelineRuntimeError, PipelineValidationError
  from haystack.core.pipeline.descriptions import find_pipeline_outputs
  from haystack.core.pipeline.draw.draw import _draw, RenderingEngines
  from haystack.core.pipeline.validation import validate_pipeline_input, find_pipeline_inputs
  from haystack.core.component.connection import Connection, parse_connect_string
  from haystack.core.type_utils import _type_name
  from haystack.core.serialization import component_to_dict, component_from_dict
label_desc: Use image node_id 6 for calling the Pipeline obj's underlying member method code with example usage: obj.add_component(name, instance) without return types