Skip to content

Commit

Permalink
fix datetime utc compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
zhourunlai committed Jan 4, 2025
1 parent c439df4 commit 9137eef
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions swarms/structs/multi_agent_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
import subprocess
import uuid
from datetime import UTC, datetime
from datetime import datetime
from typing import List, Literal, Optional

from loguru import logger
Expand Down Expand Up @@ -241,7 +241,7 @@ def route_task(self, task: str) -> dict:
dict: A dictionary containing the routing result, including the selected agent, reasoning, and response.
"""
try:
start_time = datetime.now(UTC)
start_time = datetime.now()

# Get boss decision using function calling
boss_response = self.function_caller.get_completion(task)
Expand All @@ -259,28 +259,28 @@ def route_task(self, task: str) -> dict:
final_task = boss_response.modified_task or task

# Execute the task with the selected agent if enabled
execution_start = datetime.now(UTC)
execution_start = datetime.now()
agent_response = None
execution_time = 0

if self.execute_task:
# Use the agent's run method directly
agent_response = selected_agent.run(final_task)
execution_time = (
datetime.now(UTC) - execution_start
datetime.now() - execution_start
).total_seconds()
else:
logger.info(
"Task execution skipped (execute_task=False)"
)

total_time = (
datetime.now(UTC) - start_time
datetime.now() - start_time
).total_seconds()

result = {
"id": str(uuid.uuid4()),
"timestamp": datetime.now(UTC).isoformat(),
"timestamp": datetime.now().isoformat(),
"task": {
"original": task,
"modified": (
Expand Down

0 comments on commit 9137eef

Please sign in to comment.