Skip to content

Commit dd0cddb

Browse files
committed
fix
1 parent 8d02743 commit dd0cddb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

veadk/cloud/cloud_app.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,23 @@ async def message_send(
422422

423423
# we ignore type checking here, because the response
424424
# from CloudApp will not be `Task` type
425-
return res.root.result # type: ignore
425+
result = res.root.result # type: ignore
426+
from a2a.types import Task
427+
428+
if isinstance(result, Task):
429+
if result.history:
430+
return next(
431+
(
432+
msg
433+
for msg in reversed(result.history)
434+
if msg.role == "agent"
435+
),
436+
None,
437+
)
438+
else:
439+
return None
440+
else:
441+
return result
426442
except Exception as e:
427443
logger.error(f"Failed to send message to cloud app. Error: {e}")
428444
return None

0 commit comments

Comments
 (0)