def add(self, tasks_chain: Union[Task, TaskNode, TaskChain, DecisionFunc, DecisionLLM]) -> 'Graph':
        """
        Adds tasks to the graph.
        
        Args:
            tasks_chain: A Task, TaskNode, TaskChain, DecisionFunc, or DecisionLLM to add to the graph
            
        Returns:
            This graph for method chaining
        """
        # If given a Task, wrap it in a TaskNode
        if isinstance(tasks_chain, Task):
            tasks_chain = TaskNode(task=tasks_chain)
        
        if isinstance(tasks_chain, TaskNode):
            self.nodes.append(tasks_chain)
        elif isinstance(tasks_chain, (DecisionFunc, DecisionLLM)):
            self.nodes.append(tasks_chain)
            
            # Handle decision branches
            if tasks_chain.true_branch:
                if isinstance(tasks_chain.true_branch, TaskNode):
                    if tasks_chain.true_branch not in self.nodes:
                        self.nodes.append(tasks_chain.true_branch)
                    if tasks_chain.id not in self.edges:
                        self.edges[tasks_chain.id] = []
                    self.edges[tasks_chain.id].append(tasks_chain.true_branch.id)
                elif isinstance(tasks_chain.true_branch, TaskChain):
                    # Add all nodes and edges from the true branch chain
                    for node in tasks_chain.true_branch.nodes:
                        if node not in self.nodes:
                            self.nodes.append(node)
                    
                    # Add the connection from decision to first node of true branch
                    if tasks_chain.true_branch.nodes:
                        first_node = tasks_chain.true_branch.nodes[0]
                        if tasks_chain.id not in self.edges:
                            self.edges[tasks_chain.id] = []
                        self.edges[tasks_chain.id].append(first_node.id)
                    
                    # Merge edges from the true branch
                    for src, targets in tasks_chain.true_branch.edges.items():
                        if src not in self.edges:
                            self.edges[src] = []
                        self.edges[src].extend(targets)
            
            # Handle false branch
            if tasks_chain.false_branch:
                if isinstance(tasks_chain.false_branch, TaskNode):
                    if tasks_chain.false_branch not in self.nodes:
                        self.nodes.append(tasks_chain.false_branch)
                    if tasks_chain.id not in self.edges:
                        self.edges[tasks_chain.id] = []
                    self.edges[tasks_chain.id].append(tasks_chain.false_branch.id)
                elif isinstance(tasks_chain.false_branch, TaskChain):
                    # Add all nodes and edges from the false branch chain
                    for node in tasks_chain.false_branch.nodes:
                        if node not in self.nodes:
                            self.nodes.append(node)
                    
                    # Add the connection from decision to first node of false branch
                    if tasks_chain.false_branch.nodes:
                        first_node = tasks_chain.false_branch.nodes[0]
                        if tasks_chain.id not in self.edges:
                            self.edges[tasks_chain.id] = []
                        self.edges[tasks_chain.id].append(first_node.id)
                    
                    # Merge edges from the false branch
                    for src, targets in tasks_chain.false_branch.edges.items():
                        if src not in self.edges:
                            self.edges[src] = []
                        self.edges[src].extend(targets)
                    
        elif isinstance(tasks_chain, TaskChain):
            self.nodes.extend(tasks_chain.nodes)
            self.edges.update(tasks_chain.edges)
            
        return self

        Adds tasks to the graph.
        
        Args:
            tasks_chain: A Task, TaskNode, TaskChain, DecisionFunc, or DecisionLLM to add to the graph
            
        Returns:
            This graph for method chaining
        
src/upsonic/client/graph.py