   """
   @spec put(pipeline, any, any) :: :ok
   def put(pipeline, key, value) do
-    Agent.update(whereis(pipeline), &Map.put(&1, key, value))
+    Agent.update(via_tuple(pipeline), &Map.put(&1, key, value))
   end
 
   @doc """

  defp identify(%Pipeline{} = pipeline), do: identify(pipeline.repo)
  defp identify(%Repo{} = repo), do: identify("#{repo}")
  defp identify(name) when is_binary(name), do: name

  @doc """
  Returns the `pid` of a pipeline agent, or `:undefined` if no process is
  associated with the given `identifier`.
  """
  @spec whereis(pid | atom | t | Repo.t | String.t) :: pid | :undefined
  def whereis(identifier) when is_pid(identifier), do: identifier
  def whereis(identifier) when is_atom(identifier), do: :undefined
  def whereis(identifier) do
    case Registry.lookup(Gullintanni.Registry, identify(identifier)) do
      [{pid, _value}] -> pid
      _ -> :undefined
    end
  end

  # Creates a new pipeline with the given `config` settings.
  #

  @doc """
  Gets the current state of a `pipeline`.
  """
  @spec get(pipeline) :: t | no_return
  def get(pipeline) do
    Agent.get(via_tuple(pipeline), &(&1))
  end

  @doc """
  Gets a value from the `pipeline` by `key`.
  """
  @spec get(pipeline, atom) :: any | no_return
  def get(pipeline, key) when is_atom(key) do
    Agent.get(via_tuple(pipeline), &Map.get(&1, key))
  end

  @doc """
  Fetches the current state of a `pipeline`.

  Returns `{:ok, pipeline}` if the pipeline exists, otherwise `:error`.
  """
  @spec fetch(pipeline) :: {:ok, t} | :error
  def fetch(pipeline) do
    case Registry.lookup(Gullintanni.Registry, identify(pipeline)) do
      [] -> :error
      _ -> {:ok, get(pipeline)}
    end
  end

