File size: 1,182 Bytes
226b286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from datetime import datetime
from agents import function_tool
# from ..common.utility.logger import log_call



@function_tool
# @log_call
def current_datetime(format: str = "natural") -> str:
    """
    Returns the current date and time as a formatted string.
    
    Args:
        format (str): Format style for the datetime. Options:
            - "natural" (default): "Saturday, December 7, 2025 at 3:59 PM"
            - "natural_short": "Dec 7, 2025 at 3:59 PM"
            - "natural_full": "Saturday, December 7, 2025 at 3:59:30 PM CST"
            - Custom strftime format string (e.g., "%Y-%m-%d %H:%M:%S")
    
    Returns:
        str: Current date and time in the specified format
    """
    print(f"[DEBUG] current_datetime called with format='{format}'")
    now = datetime.now()
    
    # Natural format options
    if format == "natural":
        return now.strftime("%A, %B %d, %Y at %I:%M %p")
    elif format == "natural_short":
        return now.strftime("%b %d, %Y at %I:%M %p")
    elif format == "natural_full":
        return now.strftime("%A, %B %d, %Y at %I:%M:%S %p %Z")
    else:
        # Custom format string
        return now.strftime(format)