Extend
Extend Use Cases
Identity
from digital_employee_core import DigitalEmployeeIdentity
class ExtendedDigitalEmployeeIdentity(DigitalEmployeeIdentity):
"""Extended Digital Employee Identity with additional attributes."""
employee_id: strConnectors
Tools
import calendar
from datetime import datetime, timedelta
from typing import Any
from gllm_plugin.tools import tool_plugin
from langchain_core.runnables import RunnableConfig
from langchain_core.tools import BaseTool
from pydantic import BaseModel, Field
class InterviewDateInput(BaseModel):
"""Input schema for interview date tool."""
reference_date: str = Field(
default=None,
description="Reference date in ISO format (YYYY-MM-DD, e.g., 2024-12-16). If not provided, uses current date.",
)
class GenerateInterviewDateConfig(BaseModel):
"""Configuration schema for interview date generation."""
days_to_add: int = Field(
default=7,
description="Number of days to add to the reference date before finding the next available weekday",
)
excluded_weekdays: list[int] = Field(
default=[calendar.SATURDAY, calendar.SUNDAY],
description=(
"List of weekday numbers to exclude (0=Monday, 1=Tuesday, "
"..., 6=Sunday). Default excludes Saturday and Sunday."
),
)
@tool_plugin(version="1.0.0")
class ConfigurableGenerateInterviewDateTool(BaseTool):
"""Generate an interview date with configurable days offset and excluded weekdays."""
name: str = "configurable_generate_interview_date"
description: str = (
"Generate interview date: adds configurable days to reference date, "
"returns next available weekday excluding configured weekdays."
)
args_schema: type[BaseModel] = InterviewDateInput
tool_config_schema: type[BaseModel] = GenerateInterviewDateConfig
def _run(
self,
reference_date: str | None = None,
config: RunnableConfig = None,
**_kwargs: Any,
) -> str:
"""Generate interview date with configuration.
Adds a configurable number of days to the reference date and returns
the next available weekday, excluding configured weekdays.
Args:
reference_date (str | None, optional): Reference date in ISO format
(YYYY-MM-DD, e.g., 2024-12-16). If not provided, uses current
date. Defaults to None.
config (RunnableConfig, optional): Runnable configuration containing
tool settings. Defaults to None.
**_kwargs (Any): Additional keyword arguments (ignored).
Returns:
str: Interview date in ISO format (YYYY-MM-DD) or error message if
date format is invalid.
"""
try:
# Get tool config
tool_config = self.get_tool_config(config)
except Exception as e:
return f"Error: Failed to retrieve tool configuration. " f"Details: {e}"
try:
# Parse reference date
base_date = (
datetime.strptime(reference_date, "%Y-%m-%d").date() if reference_date else datetime.now().date()
)
except ValueError as e:
return f"Error: Invalid date format. Please use YYYY-MM-DD " f"(e.g., 2024-12-16). Details: {e}"
# Add configured days to base date
target_date = base_date + timedelta(days=tool_config.days_to_add)
# Find next available weekday (not in excluded list)
max_iterations = 7 # Prevent infinite loop
iterations = 0
while target_date.weekday() in tool_config.excluded_weekdays and iterations < max_iterations:
target_date += timedelta(days=1)
iterations += 1
if iterations >= max_iterations:
return (
f"Error: Could not find available weekday after "
f"{max_iterations} days. All weekdays may be excluded."
)
return f"Interview date: {target_date.isoformat()}"MCPs
Digital Employee
Last updated