def METHOD_NAME(cls, super_agi_prompt: str, current_task: str, last_task: str,
                                 last_task_result: str, pending_tasks: List[str], completed_tasks: list, token_limit: int):
    """Replace the task based variables in the super agi prompt.
    Args:
        super_agi_prompt (str): The super agi prompt.
        current_task (str): The current task.
        last_task (str): The last task.
        last_task_result (str): The last task result.
        pending_tasks (List[str]): The list of pending tasks.
        completed_tasks (list): The list of completed tasks.
        token_limit (int): The token limit.
    """
    if "{current_task}" in super_agi_prompt:
        super_agi_prompt = super_agi_prompt.replace("{current_task}", current_task)
    if "{last_task}" in super_agi_prompt:
        super_agi_prompt = super_agi_prompt.replace("{last_task}", last_task)
    if "{last_task_result}" in super_agi_prompt:
        super_agi_prompt = super_agi_prompt.replace("{last_task_result}", last_task_result)
    if "{pending_tasks}" in super_agi_prompt:
        super_agi_prompt = super_agi_prompt.replace("{pending_tasks}", str(pending_tasks))
    completed_tasks.reverse()
    if "{completed_tasks}" in super_agi_prompt:
        completed_tasks_arr = []
        for task in completed_tasks:
            completed_tasks_arr.append(task['task'])
        super_agi_prompt = super_agi_prompt.replace("{completed_tasks}", str(completed_tasks_arr))
    base_token_limit = TokenCounter.count_message_tokens([{"role": "user", "content": super_agi_prompt}])
    pending_tokens = token_limit - base_token_limit
    final_output = ""
    if "{task_history}" in super_agi_prompt:
        for task in reversed(completed_tasks[-10:]):
            final_output = f"Task: {task['task']}\nResult: {task['response']}\n" + final_output
            token_count = TokenCounter.count_message_tokens([{"role": "user", "content": final_output}])
            # giving buffer of 100 tokens
            if token_count > min(600, pending_tokens):
                break
        super_agi_prompt = super_agi_prompt.replace("{task_history}", "\n" + final_output + "\n")
    return super_agi_prompt