Skip to content

Commit a4a1a8a

Browse files
Remove enforcement of UUID for context id
1 parent f8e8262 commit a4a1a8a

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/a2a/utils/task.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,10 @@ def new_task(request: Message) -> Task:
2929
raise ValueError('TextPart content cannot be empty')
3030

3131
context_id_str = request.context_id
32-
if context_id_str is not None:
33-
try:
34-
uuid.UUID(context_id_str)
35-
context_id = context_id_str
36-
except (ValueError, AttributeError, TypeError) as e:
37-
raise ValueError(
38-
f"Invalid context_id: '{context_id_str}' is not a valid UUID."
39-
) from e
40-
else:
32+
if not context_id_str:
4133
context_id = str(uuid.uuid4())
34+
else:
35+
context_id = context_id_str
4236

4337
return Task(
4438
status=TaskStatus(state=TaskState.submitted),

0 commit comments

Comments
 (0)