1
0

09_A2A_Client.py 598 B

123456789101112131415161718192021
  1. """
  2. 10.3.3 使用 HelloAgents A2A 工具
  3. (2)创建A2A Agent客户端
  4. """
  5. from hello_agents.protocols import A2AClient
  6. import time
  7. # 等待服务器启动
  8. time.sleep(1)
  9. # 创建客户端连接到研究员Agent
  10. client = A2AClient("http://localhost:5000")
  11. # 发送研究请求
  12. response = client.execute_skill("research", "research AI在医疗领域的应用")
  13. print(f"收到响应:{response.get('result')}")
  14. # 输出:
  15. # 收到响应:{'topic': 'AI在医疗领域的应用', 'findings': '关于AI在医疗领域的应用的研究结果...', 'sources': ['来源1', '来源2', '来源3']}