|
22 | 22 | from typing import Dict |
23 | 23 | from typing import List |
24 | 24 | from typing import Optional |
25 | | -import uuid |
| 25 | + |
| 26 | +from google.adk.platform import uuid as platform_uuid |
26 | 27 |
|
27 | 28 | from a2a.server.events import Event as A2AEvent |
28 | 29 | from a2a.types import DataPart |
@@ -254,7 +255,7 @@ def convert_a2a_task_to_event( |
254 | 255 | invocation_id=( |
255 | 256 | invocation_context.invocation_id |
256 | 257 | if invocation_context |
257 | | - else str(uuid.uuid4()) |
| 258 | + else platform_uuid.new_uuid() |
258 | 259 | ), |
259 | 260 | author=author or "a2a agent", |
260 | 261 | branch=invocation_context.branch if invocation_context else None, |
@@ -299,7 +300,7 @@ def convert_a2a_message_to_event( |
299 | 300 | invocation_id=( |
300 | 301 | invocation_context.invocation_id |
301 | 302 | if invocation_context |
302 | | - else str(uuid.uuid4()) |
| 303 | + else platform_uuid.new_uuid() |
303 | 304 | ), |
304 | 305 | author=author or "a2a agent", |
305 | 306 | branch=invocation_context.branch if invocation_context else None, |
@@ -349,7 +350,7 @@ def convert_a2a_message_to_event( |
349 | 350 | invocation_id=( |
350 | 351 | invocation_context.invocation_id |
351 | 352 | if invocation_context |
352 | | - else str(uuid.uuid4()) |
| 353 | + else platform_uuid.new_uuid() |
353 | 354 | ), |
354 | 355 | author=author or "a2a agent", |
355 | 356 | branch=invocation_context.branch if invocation_context else None, |
@@ -408,7 +409,7 @@ def convert_event_to_a2a_message( |
408 | 409 |
|
409 | 410 | if output_parts: |
410 | 411 | return Message( |
411 | | - message_id=str(uuid.uuid4()), role=role, parts=output_parts |
| 412 | + message_id=platform_uuid.new_uuid(), role=role, parts=output_parts |
412 | 413 | ) |
413 | 414 |
|
414 | 415 | except Exception as e: |
@@ -449,7 +450,7 @@ def _create_error_status_event( |
449 | 450 | status=TaskStatus( |
450 | 451 | state=TaskState.failed, |
451 | 452 | message=Message( |
452 | | - message_id=str(uuid.uuid4()), |
| 453 | + message_id=platform_uuid.new_uuid(), |
453 | 454 | role=Role.agent, |
454 | 455 | parts=[TextPart(text=error_message)], |
455 | 456 | metadata={ |
|
0 commit comments