code: """Agent utils."""
  
  from llama_index.core.agent.types import TaskStep
  from llama_index.core.base.llms.types import ChatMessage, MessageRole
  from llama_index.core.memory import BaseMemory
  
  
  def add_user_step_to_memory(
      step: TaskStep, memory: BaseMemory, verbose: bool = False
  ) -> None:
      """Add user step to memory."""
      user_message = ChatMessage(content=step.input, role=MessageRole.USER)
      memory.put(user_message)
      if verbose:
          print(f"Added user message to memory: {step.input}")
  
apis: llama_index.core.base.llms.types.ChatMessage
extract_api: [((345, 399), 'llama_index.core.base.llms.types.ChatMessage', 'ChatMessage', ([], {'content': 'step.input', 'role': 'MessageRole.USER'}), '(content=step.input, role=MessageRole.USER)\n', (356, 399), False, 'from llama_index.core.base.llms.types import ChatMessage, MessageRole\n')]