Skip to content

Commit cfaa6be

Browse files
committed
Fixed UTC-related issue in sources
1 parent af636a0 commit cfaa6be

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/app/endpoints/a2a.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import json
55
import uuid
66
from collections.abc import Mapping, AsyncIterator, MutableMapping
7-
from datetime import datetime, timezone
7+
from datetime import datetime, UTC
88
from typing import Annotated, Any, Optional
99

1010
from a2a.server.agent_execution import AgentExecutor, RequestContext
@@ -381,7 +381,7 @@ async def _process_task_streaming( # pylint: disable=too-many-locals
381381
task_id=task_id,
382382
status=TaskStatus(
383383
state=TaskState.working,
384-
timestamp=datetime.now(timezone.utc).isoformat(),
384+
timestamp=datetime.now(UTC).isoformat(),
385385
),
386386
context_id=context_id,
387387
final=False,
@@ -403,14 +403,14 @@ async def _process_task_streaming( # pylint: disable=too-many-locals
403403
if aggregator.task_state == TaskState.working:
404404
await task_updater.update_status(
405405
TaskState.completed,
406-
timestamp=datetime.now(timezone.utc).isoformat(),
406+
timestamp=datetime.now(UTC).isoformat(),
407407
final=True,
408408
)
409409
else:
410410
await task_updater.update_status(
411411
aggregator.task_state,
412412
message=aggregator.task_status_message,
413-
timestamp=datetime.now(timezone.utc).isoformat(),
413+
timestamp=datetime.now(UTC).isoformat(),
414414
final=True,
415415
)
416416

@@ -459,7 +459,7 @@ async def _convert_stream_to_events( # pylint: disable=too-many-branches,too-ma
459459
context_id=context_id,
460460
task_id=task_id,
461461
),
462-
timestamp=datetime.now(timezone.utc).isoformat(),
462+
timestamp=datetime.now(UTC).isoformat(),
463463
),
464464
context_id=context_id,
465465
final=False,
@@ -477,7 +477,7 @@ async def _convert_stream_to_events( # pylint: disable=too-many-branches,too-ma
477477
context_id=context_id,
478478
task_id=task_id,
479479
),
480-
timestamp=datetime.now(timezone.utc).isoformat(),
480+
timestamp=datetime.now(UTC).isoformat(),
481481
),
482482
context_id=context_id,
483483
final=False,
@@ -495,7 +495,7 @@ async def _convert_stream_to_events( # pylint: disable=too-many-branches,too-ma
495495
context_id=context_id,
496496
task_id=task_id,
497497
),
498-
timestamp=datetime.now(timezone.utc).isoformat(),
498+
timestamp=datetime.now(UTC).isoformat(),
499499
),
500500
context_id=context_id,
501501
final=False,
@@ -891,5 +891,5 @@ async def a2a_health_check() -> dict[str, str]:
891891
"service": "lightspeed-a2a",
892892
"version": __version__,
893893
"a2a_sdk_version": "0.3.4",
894-
"timestamp": datetime.now(timezone.utc).isoformat(),
894+
"timestamp": datetime.now(UTC).isoformat(),
895895
}

src/app/endpoints/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ async def query_endpoint_handler(
237237
quota_limiters=configuration.quota_limiters, user_id=user_id
238238
)
239239

240-
completed_at = datetime.datetime.now(datetime.timezone.utc).strftime(
240+
completed_at = datetime.datetime.now(datetime.UTC).strftime(
241241
"%Y-%m-%dT%H:%M:%SZ"
242242
)
243243
conversation_id = normalize_conversation_id(responses_params.conversation)

0 commit comments

Comments
 (0)