Skip to content

Commit 5abb519

Browse files
committed
back out a2a changes
1 parent cc58fa5 commit 5abb519

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/google/adk/a2a/converters/event_converter.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
from typing import Dict
2323
from typing import List
2424
from typing import Optional
25-
26-
from google.adk.platform import uuid as platform_uuid
25+
import uuid
2726

2827
from a2a.server.events import Event as A2AEvent
2928
from a2a.types import DataPart
@@ -255,7 +254,7 @@ def convert_a2a_task_to_event(
255254
invocation_id=(
256255
invocation_context.invocation_id
257256
if invocation_context
258-
else platform_uuid.new_uuid()
257+
else str(uuid.uuid4())
259258
),
260259
author=author or "a2a agent",
261260
branch=invocation_context.branch if invocation_context else None,
@@ -300,7 +299,7 @@ def convert_a2a_message_to_event(
300299
invocation_id=(
301300
invocation_context.invocation_id
302301
if invocation_context
303-
else platform_uuid.new_uuid()
302+
else str(uuid.uuid4())
304303
),
305304
author=author or "a2a agent",
306305
branch=invocation_context.branch if invocation_context else None,
@@ -350,7 +349,7 @@ def convert_a2a_message_to_event(
350349
invocation_id=(
351350
invocation_context.invocation_id
352351
if invocation_context
353-
else platform_uuid.new_uuid()
352+
else str(uuid.uuid4())
354353
),
355354
author=author or "a2a agent",
356355
branch=invocation_context.branch if invocation_context else None,
@@ -409,7 +408,7 @@ def convert_event_to_a2a_message(
409408

410409
if output_parts:
411410
return Message(
412-
message_id=platform_uuid.new_uuid(), role=role, parts=output_parts
411+
message_id=str(uuid.uuid4()), role=role, parts=output_parts
413412
)
414413

415414
except Exception as e:
@@ -450,7 +449,7 @@ def _create_error_status_event(
450449
status=TaskStatus(
451450
state=TaskState.failed,
452451
message=Message(
453-
message_id=platform_uuid.new_uuid(),
452+
message_id=str(uuid.uuid4()),
454453
role=Role.agent,
455454
parts=[TextPart(text=error_message)],
456455
metadata={

tests/unittests/a2a/converters/test_event_converter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ def test_convert_a2a_task_to_event_no_message(self):
742742
assert result.branch == "test-branch"
743743
assert result.invocation_id == "test-invocation-id"
744744

745-
@patch("google.adk.a2a.converters.event_converter.platform_uuid.new_uuid")
745+
@patch("google.adk.a2a.converters.event_converter.uuid.uuid4")
746746
def test_convert_a2a_task_to_event_default_author(self, mock_uuid):
747747
"""Test converting A2A task with default author and no invocation context."""
748748
from google.adk.a2a.converters.event_converter import convert_a2a_task_to_event
@@ -974,7 +974,7 @@ def test_convert_a2a_message_to_event_missing_tool_id(self):
974974
# Parts will be empty since conversion returned None
975975
assert len(result.content.parts) == 0
976976

977-
@patch("google.adk.a2a.converters.event_converter.platform_uuid.new_uuid")
977+
@patch("google.adk.a2a.converters.event_converter.uuid.uuid4")
978978
def test_convert_a2a_message_to_event_default_author(self, mock_uuid):
979979
"""Test conversion with default author and no invocation context."""
980980
from google.adk.a2a.converters.event_converter import convert_a2a_message_to_event

0 commit comments

Comments
 (0)