Spaces:
Running
Running
File size: 643 Bytes
9d68bd2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from datetime import datetime
from agents import function_tool
from core.logger import log_call
class TimeTools:
"""Provides tools related to current date and time."""
@staticmethod
@function_tool
@log_call
def current_datetime(format: str = "%Y-%m-%d %H:%M:%S") -> str:
"""
Returns the current date and time as a formatted string.
Args:
format (str): Optional datetime format (default: "YYYY-MM-DD HH:MM:SS")
Returns:
str: Current date and time in the specified format
"""
now = datetime.now()
return now.strftime(format)
|