We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d02743 commit dd0cddbCopy full SHA for dd0cddb
veadk/cloud/cloud_app.py
@@ -422,7 +422,23 @@ async def message_send(
422
423
# we ignore type checking here, because the response
424
# from CloudApp will not be `Task` type
425
- return res.root.result # type: ignore
+ 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
441
+ return result
442
except Exception as e:
443
logger.error(f"Failed to send message to cloud app. Error: {e}")
444
return None
0 commit comments