rasa-pro 3.14.0.dev4__py3-none-any.whl → 3.14.0.dev5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rasa-pro might be problematic. Click here for more details.

Files changed (463) hide show
  1. rasa/api.py +0 -5
  2. rasa/builder/README.md +120 -0
  3. rasa/builder/auth.py +176 -0
  4. rasa/builder/config.py +115 -0
  5. rasa/builder/copilot/constants.py +25 -0
  6. rasa/builder/copilot/copilot.py +372 -0
  7. rasa/builder/copilot/copilot_response_handler.py +487 -0
  8. rasa/builder/copilot/copilot_templated_message_provider.py +58 -0
  9. rasa/builder/copilot/exceptions.py +20 -0
  10. rasa/builder/copilot/models.py +431 -0
  11. rasa/builder/copilot/prompts/copilot_system_prompt.jinja2 +726 -0
  12. rasa/builder/copilot/telemetry.py +195 -0
  13. rasa/builder/copilot/templated_messages/copilot_internal_messages_templates.yml +16 -0
  14. rasa/builder/copilot/templated_messages/copilot_templated_responses.yml +26 -0
  15. rasa/builder/document_retrieval/constants.py +15 -0
  16. rasa/builder/document_retrieval/inkeep-rag-response-schema.json +64 -0
  17. rasa/builder/document_retrieval/inkeep_document_retrieval.py +238 -0
  18. rasa/builder/document_retrieval/models.py +62 -0
  19. rasa/builder/download.py +140 -0
  20. rasa/builder/exceptions.py +55 -0
  21. rasa/builder/guardrails/__init__.py +1 -0
  22. rasa/builder/guardrails/constants.py +3 -0
  23. rasa/builder/guardrails/exceptions.py +4 -0
  24. rasa/builder/guardrails/lakera.py +206 -0
  25. rasa/builder/guardrails/models.py +199 -0
  26. rasa/builder/guardrails/utils.py +305 -0
  27. rasa/builder/job_manager.py +87 -0
  28. rasa/builder/jobs.py +234 -0
  29. rasa/builder/llm_service.py +246 -0
  30. rasa/builder/logging_utils.py +209 -0
  31. rasa/builder/main.py +174 -0
  32. rasa/builder/models.py +197 -0
  33. rasa/builder/project_generator.py +450 -0
  34. rasa/builder/project_info.py +72 -0
  35. rasa/builder/scrape_rasa_docs.py +97 -0
  36. rasa/builder/service.py +1142 -0
  37. rasa/builder/shared/tracker_context.py +212 -0
  38. rasa/builder/skill_to_bot_prompt.jinja2 +164 -0
  39. rasa/builder/training_service.py +132 -0
  40. rasa/builder/validation_service.py +93 -0
  41. rasa/cli/arguments/default_arguments.py +0 -12
  42. rasa/cli/arguments/run.py +0 -2
  43. rasa/cli/dialogue_understanding_test.py +0 -4
  44. rasa/cli/e2e_test.py +0 -4
  45. rasa/cli/inspect.py +0 -3
  46. rasa/cli/llm_fine_tuning.py +0 -5
  47. rasa/cli/project_templates/basic/actions/action_api.py +15 -0
  48. rasa/cli/project_templates/basic/actions/action_human_handoff.py +44 -0
  49. rasa/cli/project_templates/basic/config.yml +23 -0
  50. rasa/cli/project_templates/basic/credentials.yml +34 -0
  51. rasa/cli/project_templates/basic/data/general/feedback.yml +20 -0
  52. rasa/cli/project_templates/basic/data/general/goodbye.yml +6 -0
  53. rasa/cli/project_templates/basic/data/general/hello.yml +7 -0
  54. rasa/cli/project_templates/basic/data/general/help.yml +6 -0
  55. rasa/cli/project_templates/basic/data/general/human_handoff.yml +16 -0
  56. rasa/cli/project_templates/basic/data/general/welcome.yml +9 -0
  57. rasa/cli/project_templates/basic/data/system/pattern_completed.yml +7 -0
  58. rasa/cli/project_templates/basic/data/system/pattern_correction.yml +7 -0
  59. rasa/cli/project_templates/basic/data/system/pattern_search.yml +8 -0
  60. rasa/cli/project_templates/basic/data/system/pattern_session_start.yml +8 -0
  61. rasa/cli/project_templates/basic/docs/rasa_assistant_qa.txt +65 -0
  62. rasa/cli/project_templates/basic/docs/template.txt +7 -0
  63. rasa/cli/project_templates/basic/domain/general/assistant_details.yml +12 -0
  64. rasa/cli/project_templates/basic/domain/general/bot_identity.yml +5 -0
  65. rasa/cli/project_templates/basic/domain/general/cannot_handle.yml +5 -0
  66. rasa/cli/project_templates/basic/domain/general/feedback.yml +28 -0
  67. rasa/cli/project_templates/basic/domain/general/goodbye.yml +7 -0
  68. rasa/cli/project_templates/basic/domain/general/help.yml +5 -0
  69. rasa/cli/project_templates/basic/domain/general/human_handoff_domain.yml +35 -0
  70. rasa/cli/project_templates/basic/domain/general/utils.yml +13 -0
  71. rasa/cli/project_templates/basic/domain/general/welcome.yml +7 -0
  72. rasa/cli/project_templates/basic/endpoints.yml +73 -0
  73. rasa/cli/project_templates/basic/prompts/rephraser_demo_personality_prompt.jinja2 +19 -0
  74. rasa/cli/project_templates/finance/actions/__init__.py +46 -0
  75. rasa/cli/project_templates/finance/actions/accounts/action_ask_account.py +47 -0
  76. rasa/cli/project_templates/finance/actions/accounts/action_check_balance.py +40 -0
  77. rasa/cli/project_templates/finance/actions/action_session_start.py +74 -0
  78. rasa/cli/project_templates/finance/actions/cards/action_ask_card.py +48 -0
  79. rasa/cli/project_templates/finance/actions/cards/action_check_card_existence.py +36 -0
  80. rasa/cli/project_templates/finance/actions/cards/action_update_card_status.py +54 -0
  81. rasa/cli/project_templates/finance/actions/database.py +277 -0
  82. rasa/cli/project_templates/finance/actions/transfers/__init__.py +0 -0
  83. rasa/cli/project_templates/finance/actions/transfers/action_add_payee.py +52 -0
  84. rasa/cli/project_templates/finance/actions/transfers/action_ask_account_from.py +51 -0
  85. rasa/cli/project_templates/finance/actions/transfers/action_check_payee_existence.py +40 -0
  86. rasa/cli/project_templates/finance/actions/transfers/action_check_sufficient_funds.py +40 -0
  87. rasa/cli/project_templates/finance/actions/transfers/action_list_payees.py +46 -0
  88. rasa/cli/project_templates/finance/actions/transfers/action_process_immediate_payment.py +18 -0
  89. rasa/cli/project_templates/finance/actions/transfers/action_remove_payee.py +49 -0
  90. rasa/cli/project_templates/finance/actions/transfers/action_schedule_payment.py +19 -0
  91. rasa/cli/project_templates/finance/actions/transfers/action_validate_payment_date.py +36 -0
  92. rasa/cli/project_templates/finance/config.yml +21 -0
  93. rasa/cli/project_templates/finance/credentials.yml +32 -0
  94. rasa/cli/project_templates/finance/csvs/accounts.csv +8 -0
  95. rasa/cli/project_templates/finance/csvs/advisors.csv +7 -0
  96. rasa/cli/project_templates/finance/csvs/appointments.csv +211 -0
  97. rasa/cli/project_templates/finance/csvs/branches.csv +10 -0
  98. rasa/cli/project_templates/finance/csvs/cards.csv +11 -0
  99. rasa/cli/project_templates/finance/csvs/payees.csv +11 -0
  100. rasa/cli/project_templates/finance/csvs/transactions.csv +71 -0
  101. rasa/cli/project_templates/finance/csvs/users.csv +4 -0
  102. rasa/cli/project_templates/finance/data/accounts/check_balance.yml +10 -0
  103. rasa/cli/project_templates/finance/data/cards/block_card.yml +66 -0
  104. rasa/cli/project_templates/finance/data/cards/select_card.yml +12 -0
  105. rasa/cli/project_templates/finance/data/general/bot_identity.yml +6 -0
  106. rasa/cli/project_templates/finance/data/general/feedback.yml +20 -0
  107. rasa/cli/project_templates/finance/data/general/goodbye.yml +6 -0
  108. rasa/cli/project_templates/finance/data/general/hello.yml +7 -0
  109. rasa/cli/project_templates/finance/data/general/help.yml +9 -0
  110. rasa/cli/project_templates/finance/data/general/human_handoff.yml +16 -0
  111. rasa/cli/project_templates/finance/data/general/welcome.yml +9 -0
  112. rasa/cli/project_templates/finance/data/system/patterns/pattern_chitchat.yml +5 -0
  113. rasa/cli/project_templates/finance/data/system/patterns/pattern_completed.yml +7 -0
  114. rasa/cli/project_templates/finance/data/system/patterns/pattern_correction.yml +7 -0
  115. rasa/cli/project_templates/finance/data/system/patterns/pattern_search.yml +8 -0
  116. rasa/cli/project_templates/finance/data/system/patterns/pattern_session_start.yml +8 -0
  117. rasa/cli/project_templates/finance/data/system/source/accounts.json +51 -0
  118. rasa/cli/project_templates/finance/data/system/source/advisors.json +44 -0
  119. rasa/cli/project_templates/finance/data/system/source/appointments.json +1474 -0
  120. rasa/cli/project_templates/finance/data/system/source/branches.json +47 -0
  121. rasa/cli/project_templates/finance/data/system/source/cards.json +72 -0
  122. rasa/cli/project_templates/finance/data/system/source/payees.json +74 -0
  123. rasa/cli/project_templates/finance/data/system/source/transactions.json +492 -0
  124. rasa/cli/project_templates/finance/data/system/source/users.json +29 -0
  125. rasa/cli/project_templates/finance/data/transfers/add_payee.yml +29 -0
  126. rasa/cli/project_templates/finance/data/transfers/list_payees.yml +5 -0
  127. rasa/cli/project_templates/finance/data/transfers/remove_payee.yml +21 -0
  128. rasa/cli/project_templates/finance/data/transfers/transfer_money.yml +67 -0
  129. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/consequences_of_blocking_card.txt +8 -0
  130. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/reasons_to_block_card.txt +8 -0
  131. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/recovering_from_card_fraud.txt +8 -0
  132. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/tips_for_card_security.txt +8 -0
  133. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/what_to_do_if_card_is_lost.txt +8 -0
  134. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/account_balance_security.txt +7 -0
  135. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/common_balance_inquiries.txt +8 -0
  136. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/methods_to_check_balance.txt +8 -0
  137. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/understanding_balance_updates.txt +8 -0
  138. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/what_to_do_if_balance_is_incorrect.txt +8 -0
  139. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/benefits_of_authorised_payees.txt +8 -0
  140. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/common_issues_with_payees.txt +8 -0
  141. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/general_payee_information.txt +8 -0
  142. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/payee_management_tips.txt +8 -0
  143. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/understanding_payee_types.txt +8 -0
  144. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/common_transfer_errors.txt +8 -0
  145. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/fees_for_transfers.txt +8 -0
  146. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/general_transfer_information.txt +8 -0
  147. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/security_tips_for_transfers.txt +8 -0
  148. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/transfer_processing_times.txt +8 -0
  149. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part1.txt +50 -0
  150. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part10.txt +50 -0
  151. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part11.txt +48 -0
  152. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part12.txt +50 -0
  153. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part13.txt +50 -0
  154. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part14.txt +47 -0
  155. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part15.txt +50 -0
  156. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part16.txt +50 -0
  157. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part17.txt +47 -0
  158. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part18.txt +50 -0
  159. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part19.txt +50 -0
  160. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part2.txt +50 -0
  161. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part20.txt +47 -0
  162. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part21.txt +50 -0
  163. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part22.txt +50 -0
  164. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part23.txt +47 -0
  165. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part24.txt +50 -0
  166. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part25.txt +50 -0
  167. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part26.txt +47 -0
  168. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part27.txt +50 -0
  169. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part28.txt +50 -0
  170. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part29.txt +47 -0
  171. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part3.txt +47 -0
  172. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part30.txt +50 -0
  173. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part31.txt +50 -0
  174. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part32.txt +47 -0
  175. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part33.txt +50 -0
  176. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part34.txt +50 -0
  177. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part35.txt +47 -0
  178. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part36.txt +50 -0
  179. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part37.txt +50 -0
  180. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part38.txt +47 -0
  181. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part39.txt +50 -0
  182. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part4.txt +50 -0
  183. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part40.txt +50 -0
  184. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part41.txt +47 -0
  185. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part42.txt +50 -0
  186. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part43.txt +50 -0
  187. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part44.txt +47 -0
  188. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part45.txt +50 -0
  189. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part46.txt +50 -0
  190. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part47.txt +47 -0
  191. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part48.txt +50 -0
  192. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part49.txt +50 -0
  193. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part5.txt +50 -0
  194. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part50.txt +47 -0
  195. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part51.txt +50 -0
  196. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part52.txt +50 -0
  197. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part53.txt +47 -0
  198. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part54.txt +50 -0
  199. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part55.txt +50 -0
  200. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part56.txt +47 -0
  201. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part57.txt +50 -0
  202. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part58.txt +50 -0
  203. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part59.txt +47 -0
  204. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part6.txt +47 -0
  205. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part60.txt +50 -0
  206. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part61.txt +50 -0
  207. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part7.txt +50 -0
  208. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part8.txt +50 -0
  209. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part9.txt +47 -0
  210. rasa/cli/project_templates/finance/domain/accounts/check_balance.yml +11 -0
  211. rasa/cli/project_templates/finance/domain/cards/block_card.yml +101 -0
  212. rasa/cli/project_templates/finance/domain/cards/select_card.yml +12 -0
  213. rasa/cli/project_templates/finance/domain/general/assistant_details.yml +12 -0
  214. rasa/cli/project_templates/finance/domain/general/bot_identity.yml +5 -0
  215. rasa/cli/project_templates/finance/domain/general/cannot_handle.yml +5 -0
  216. rasa/cli/project_templates/finance/domain/general/defaults.yml +24 -0
  217. rasa/cli/project_templates/finance/domain/general/feedback.yml +28 -0
  218. rasa/cli/project_templates/finance/domain/general/goodbye.yml +7 -0
  219. rasa/cli/project_templates/finance/domain/general/help.yml +5 -0
  220. rasa/cli/project_templates/finance/domain/general/human_handoff.yml +30 -0
  221. rasa/cli/project_templates/finance/domain/general/utils.yml +13 -0
  222. rasa/cli/project_templates/finance/domain/general/welcome.yml +8 -0
  223. rasa/cli/project_templates/finance/domain/transfers/add_payee.yml +47 -0
  224. rasa/cli/project_templates/finance/domain/transfers/list_payees.yml +4 -0
  225. rasa/cli/project_templates/finance/domain/transfers/remove_payee.yml +16 -0
  226. rasa/cli/project_templates/finance/domain/transfers/transfer_money.yml +79 -0
  227. rasa/cli/project_templates/finance/endpoints.yml +63 -0
  228. rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +19 -0
  229. rasa/cli/project_templates/telco/actions/__init__.py +0 -0
  230. rasa/cli/project_templates/telco/actions/actions_billing.py +204 -0
  231. rasa/cli/project_templates/telco/actions/actions_get_data_from_db.py +48 -0
  232. rasa/cli/project_templates/telco/actions/actions_run_diagnostics.py +28 -0
  233. rasa/cli/project_templates/telco/actions/actions_session_start.py +18 -0
  234. rasa/cli/project_templates/telco/config.yml +25 -0
  235. rasa/cli/project_templates/telco/credentials.yml +33 -0
  236. rasa/cli/project_templates/telco/csvs/billing.csv +10 -0
  237. rasa/cli/project_templates/telco/csvs/customers.csv +5 -0
  238. rasa/cli/project_templates/telco/data/flows/flow_global.yml +5 -0
  239. rasa/cli/project_templates/telco/data/flows/flow_reboot_router.yml +8 -0
  240. rasa/cli/project_templates/telco/data/flows/flow_reset_router.yml +7 -0
  241. rasa/cli/project_templates/telco/data/flows/flow_solve_internet_issue.yml +73 -0
  242. rasa/cli/project_templates/telco/data/flows/flow_undertand_bill.yml +45 -0
  243. rasa/cli/project_templates/telco/data/patterns/pattern_completed.yml +7 -0
  244. rasa/cli/project_templates/telco/data/patterns/pattern_human_handoff.yml +6 -0
  245. rasa/cli/project_templates/telco/data/patterns/pattern_search.yml +7 -0
  246. rasa/cli/project_templates/telco/data/patterns/pattern_session_start.yml +9 -0
  247. rasa/cli/project_templates/telco/docs/reset_vs_rboot_router.txt +1 -0
  248. rasa/cli/project_templates/telco/docs/restart_router.txt +6 -0
  249. rasa/cli/project_templates/telco/docs/run_speed_test.txt +6 -0
  250. rasa/cli/project_templates/telco/domain/domain_global.yml +29 -0
  251. rasa/cli/project_templates/telco/domain/domain_patterns.yml +17 -0
  252. rasa/cli/project_templates/telco/domain/domain_reboot_router.yml +20 -0
  253. rasa/cli/project_templates/telco/domain/domain_reset_router.yml +11 -0
  254. rasa/cli/project_templates/telco/domain/domain_run_speed_test.yml +24 -0
  255. rasa/cli/project_templates/telco/domain/domain_solve_internet_issue.yml +74 -0
  256. rasa/cli/project_templates/telco/domain/domain_undertand_bill.yml +102 -0
  257. rasa/cli/project_templates/telco/endpoints.yml +60 -0
  258. rasa/{dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 → cli/project_templates/telco/prompts/command-generator.jinja2} +3 -7
  259. rasa/cli/project_templates/telco/tests/e2e_results_failed.yml +62 -0
  260. rasa/cli/project_templates/telco/tests/e2e_results_passed.yml +130 -0
  261. rasa/cli/project_templates/telco/tests/e2e_test_cases/billing_test_cases.yml +68 -0
  262. rasa/cli/project_templates/telco/tests/e2e_test_cases/global_test_cases.yml +13 -0
  263. rasa/cli/project_templates/telco/tests/e2e_test_cases/internet_slow_test_case.yml +47 -0
  264. rasa/cli/project_templates/telco/tests/e2e_test_cases/out_of_scope_test_case.yml +21 -0
  265. rasa/cli/project_templates/telco/tests/e2e_test_cases/patterns_test_cases.yml +15 -0
  266. rasa/cli/project_templates/tutorial/config.yml +2 -1
  267. rasa/cli/run.py +0 -4
  268. rasa/cli/scaffold.py +46 -2
  269. rasa/cli/shell.py +0 -3
  270. rasa/constants.py +0 -6
  271. rasa/core/actions/action.py +10 -56
  272. rasa/core/agent.py +0 -16
  273. rasa/core/available_endpoints.py +0 -30
  274. rasa/core/channels/channel.py +4 -3
  275. rasa/core/channels/constants.py +3 -0
  276. rasa/core/channels/development_inspector.py +4 -4
  277. rasa/core/channels/hangouts.py +2 -2
  278. rasa/core/channels/inspector/dist/assets/{arc-63212852.js → arc-18042c22.js} +1 -1
  279. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-eecf6b13.js → blockDiagram-38ab4fdb-fdd6bcfa.js} +1 -1
  280. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-8f798a9a.js → c4Diagram-3d4e48cf-f5ae6786.js} +1 -1
  281. rasa/core/channels/inspector/dist/assets/channel-b9b536fc.js +1 -0
  282. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-df71a04c.js → classDiagram-70f12bd4-81efba3e.js} +1 -1
  283. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-9b275968.js → classDiagram-v2-f2320105-3b6b6a92.js} +1 -1
  284. rasa/core/channels/inspector/dist/assets/clone-78d2ddcf.js +1 -0
  285. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-1c669cad.js → createText-2e5e7dd3-31422447.js} +1 -1
  286. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-b1553799.js → edges-e0da2a9e-518a90db.js} +1 -1
  287. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-112388d6.js → erDiagram-9861fffd-a6d3c25a.js} +1 -1
  288. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-fdebec47.js → flowDb-956e92f1-e048c2be.js} +1 -1
  289. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-6280ede1.js → flowDiagram-66a62f08-c7474c91.js} +1 -1
  290. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-8b09c060.js +1 -0
  291. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-e1dc03e5.js → flowchart-elk-definition-4a651766-cb4d8723.js} +1 -1
  292. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-83f68c51.js → ganttDiagram-c361ad54-346636a2.js} +1 -1
  293. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-22f8666f.js → gitGraphDiagram-72cf32ee-7c508874.js} +1 -1
  294. rasa/core/channels/inspector/dist/assets/{graph-ca9e6217.js → graph-14702d8a.js} +1 -1
  295. rasa/core/channels/inspector/dist/assets/{index-3862675e-c5ceb692.js → index-3862675e-f18b534b.js} +1 -1
  296. rasa/core/channels/inspector/dist/assets/index-4d4bdf3a.js +1335 -0
  297. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-faa9999b.js → infoDiagram-f8f76790-64154b83.js} +1 -1
  298. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-c4dda8d9.js → journeyDiagram-49397b02-833a5f95.js} +1 -1
  299. rasa/core/channels/inspector/dist/assets/{layout-d4307784.js → layout-5a3b2123.js} +1 -1
  300. rasa/core/channels/inspector/dist/assets/{line-0567aaa7.js → line-2272a8c7.js} +1 -1
  301. rasa/core/channels/inspector/dist/assets/{linear-c11b95cf.js → linear-35bcf273.js} +1 -1
  302. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-0c7d3ca9.js → mindmap-definition-fc14e90a-92dcb0e9.js} +1 -1
  303. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-34b433fa.js → pieDiagram-8a3498a8-94dbc900.js} +1 -1
  304. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-4cab816e.js → quadrantDiagram-120e2f19-8b7a9c33.js} +1 -1
  305. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-8c22fa9e.js → requirementDiagram-deff3bca-6f7eab81.js} +1 -1
  306. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-70ce9e8e.js → sankeyDiagram-04a897e0-f43e581d.js} +1 -1
  307. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-fbcd7fc9.js → sequenceDiagram-704730f1-0bcbefc3.js} +1 -1
  308. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-45f05ea6.js → stateDiagram-587899a1-b8a74083.js} +1 -1
  309. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-beab1ea6.js → stateDiagram-v2-d93cdb3a-2070218f.js} +1 -1
  310. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-2f29dbd5.js → styles-6aaf32cf-f1d54e34.js} +1 -1
  311. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-951eac83.js → styles-9a916d00-980de489.js} +1 -1
  312. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-897fbfdd.js → styles-c10674c1-3c03abde.js} +1 -1
  313. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-d667fac1.js → svgDrawCommon-08f97a94-46ba068f.js} +1 -1
  314. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-e3205144.js → timeline-definition-85554ec2-901f5e3d.js} +1 -1
  315. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-4abeb0e2.js → xychartDiagram-e933f94c-acbc628a.js} +1 -1
  316. rasa/core/channels/inspector/dist/index.html +2 -2
  317. rasa/core/channels/inspector/index.html +1 -1
  318. rasa/core/channels/inspector/src/App.tsx +10 -11
  319. rasa/core/channels/inspector/src/components/DialogueInformation.tsx +12 -3
  320. rasa/core/channels/inspector/src/components/DialogueStack.tsx +4 -6
  321. rasa/core/channels/inspector/src/helpers/formatters.ts +3 -24
  322. rasa/core/channels/inspector/src/theme/base/styles.ts +1 -19
  323. rasa/core/channels/inspector/src/types.ts +0 -4
  324. rasa/core/channels/socketio.py +212 -51
  325. rasa/core/channels/studio_chat.py +49 -29
  326. rasa/core/channels/voice_stream/genesys.py +1 -1
  327. rasa/core/channels/voice_stream/voice_channel.py +5 -3
  328. rasa/core/constants.py +0 -4
  329. rasa/core/policies/enterprise_search_policy.py +6 -11
  330. rasa/core/policies/flow_policy.py +4 -4
  331. rasa/core/policies/flows/flow_executor.py +45 -456
  332. rasa/core/policies/intentless_policy.py +1 -1
  333. rasa/core/policies/unexpected_intent_policy.py +0 -1
  334. rasa/core/processor.py +15 -18
  335. rasa/core/run.py +14 -11
  336. rasa/core/tracker_stores/tracker_store.py +7 -3
  337. rasa/core/train.py +1 -1
  338. rasa/core/training/interactive.py +16 -16
  339. rasa/core/training/story_conflict.py +5 -5
  340. rasa/core/utils.py +1 -21
  341. rasa/dialogue_understanding/commands/__init__.py +0 -8
  342. rasa/dialogue_understanding/commands/cancel_flow_command.py +4 -97
  343. rasa/dialogue_understanding/commands/chit_chat_answer_command.py +0 -11
  344. rasa/dialogue_understanding/commands/clarify_command.py +0 -10
  345. rasa/dialogue_understanding/commands/knowledge_answer_command.py +0 -11
  346. rasa/dialogue_understanding/commands/start_flow_command.py +8 -164
  347. rasa/dialogue_understanding/commands/utils.py +2 -6
  348. rasa/dialogue_understanding/generator/command_parser.py +0 -4
  349. rasa/dialogue_understanding/generator/flow_retrieval.py +10 -9
  350. rasa/dialogue_understanding/generator/llm_based_command_generator.py +12 -50
  351. rasa/dialogue_understanding/generator/llm_command_generator.py +1 -1
  352. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +1 -1
  353. rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +6 -7
  354. rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +6 -7
  355. rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +2 -41
  356. rasa/dialogue_understanding/patterns/continue_interrupted.py +1 -163
  357. rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +8 -52
  358. rasa/dialogue_understanding/processor/command_processor.py +15 -31
  359. rasa/dialogue_understanding/stack/dialogue_stack.py +2 -123
  360. rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +0 -57
  361. rasa/dialogue_understanding/stack/utils.py +2 -17
  362. rasa/dialogue_understanding_test/du_test_runner.py +2 -7
  363. rasa/e2e_test/e2e_test_runner.py +2 -12
  364. rasa/engine/caching.py +2 -2
  365. rasa/engine/recipes/default_components.py +18 -10
  366. rasa/engine/storage/local_model_storage.py +45 -2
  367. rasa/graph_components/validators/default_recipe_validator.py +134 -134
  368. rasa/hooks.py +5 -5
  369. rasa/llm_fine_tuning/utils.py +2 -2
  370. rasa/model_manager/model_api.py +4 -5
  371. rasa/model_manager/runner_service.py +1 -1
  372. rasa/model_manager/socket_bridge.py +20 -14
  373. rasa/model_manager/trainer_service.py +12 -9
  374. rasa/model_manager/utils.py +1 -29
  375. rasa/model_manager/warm_rasa_process.py +1 -1
  376. rasa/nlu/extractors/extractor.py +1 -2
  377. rasa/plugin.py +8 -8
  378. rasa/privacy/privacy_manager.py +2 -11
  379. rasa/server.py +2 -14
  380. rasa/shared/constants.py +0 -5
  381. rasa/shared/core/constants.py +1 -12
  382. rasa/shared/core/domain.py +58 -11
  383. rasa/shared/core/events.py +0 -327
  384. rasa/shared/core/flows/flow_step.py +7 -1
  385. rasa/shared/core/flows/flows_list.py +2 -2
  386. rasa/shared/core/flows/flows_yaml_schema.json +186 -112
  387. rasa/shared/core/flows/steps/call.py +5 -53
  388. rasa/shared/core/flows/validation.py +7 -46
  389. rasa/shared/core/flows/yaml_flows_io.py +17 -9
  390. rasa/shared/core/slots.py +6 -2
  391. rasa/shared/core/trackers.py +2 -5
  392. rasa/shared/exceptions.py +0 -4
  393. rasa/shared/importers/importer.py +6 -0
  394. rasa/shared/importers/utils.py +77 -1
  395. rasa/shared/providers/_utils.py +60 -44
  396. rasa/shared/providers/embedding/default_litellm_embedding_client.py +2 -0
  397. rasa/shared/providers/llm/_base_litellm_client.py +7 -39
  398. rasa/shared/providers/llm/default_litellm_llm_client.py +2 -0
  399. rasa/shared/providers/llm/litellm_router_llm_client.py +4 -8
  400. rasa/shared/providers/llm/llm_client.py +3 -7
  401. rasa/shared/providers/llm/llm_response.py +0 -49
  402. rasa/shared/providers/llm/self_hosted_llm_client.py +4 -8
  403. rasa/shared/utils/llm.py +5 -28
  404. rasa/shared/utils/schemas/events.py +0 -42
  405. rasa/shared/utils/yaml.py +1 -3
  406. rasa/studio/upload.py +16 -47
  407. rasa/telemetry.py +97 -23
  408. rasa/tracing/instrumentation/instrumentation.py +10 -12
  409. rasa/tracing/instrumentation/intentless_policy_instrumentation.py +4 -4
  410. rasa/utils/common.py +0 -79
  411. rasa/utils/io.py +27 -9
  412. rasa/utils/json_utils.py +6 -1
  413. rasa/utils/log_utils.py +6 -2
  414. rasa/utils/ml_utils.py +1 -1
  415. rasa/utils/openapi.py +144 -0
  416. rasa/utils/tensorflow/rasa_layers.py +1 -1
  417. rasa/utils/train_utils.py +15 -15
  418. rasa/validator.py +21 -19
  419. rasa/version.py +1 -1
  420. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/METADATA +17 -14
  421. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/RECORD +431 -200
  422. rasa/agents/agent_factory.py +0 -122
  423. rasa/agents/agent_manager.py +0 -162
  424. rasa/agents/constants.py +0 -40
  425. rasa/agents/core/agent_protocol.py +0 -107
  426. rasa/agents/core/types.py +0 -70
  427. rasa/agents/exceptions.py +0 -8
  428. rasa/agents/protocol/__init__.py +0 -5
  429. rasa/agents/protocol/a2a/a2a_agent.py +0 -662
  430. rasa/agents/protocol/mcp/mcp_base_agent.py +0 -676
  431. rasa/agents/protocol/mcp/mcp_open_agent.py +0 -276
  432. rasa/agents/protocol/mcp/mcp_task_agent.py +0 -469
  433. rasa/agents/schemas/__init__.py +0 -12
  434. rasa/agents/schemas/agent_input.py +0 -38
  435. rasa/agents/schemas/agent_output.py +0 -26
  436. rasa/agents/schemas/agent_tool_result.py +0 -51
  437. rasa/agents/schemas/agent_tool_schema.py +0 -134
  438. rasa/agents/templates/mcp_open_agent_prompt_template.jinja2 +0 -15
  439. rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +0 -17
  440. rasa/agents/utils.py +0 -72
  441. rasa/core/available_agents.py +0 -199
  442. rasa/core/channels/inspector/dist/assets/channel-0cd70adf.js +0 -1
  443. rasa/core/channels/inspector/dist/assets/clone-a0f9c4ed.js +0 -1
  444. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-de9cc4aa.js +0 -1
  445. rasa/core/channels/inspector/dist/assets/index-3e293924.js +0 -1353
  446. rasa/core/policies/flows/mcp_tool_executor.py +0 -277
  447. rasa/dialogue_understanding/commands/continue_agent_command.py +0 -91
  448. rasa/dialogue_understanding/commands/restart_agent_command.py +0 -162
  449. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +0 -61
  450. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +0 -81
  451. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +0 -81
  452. rasa/shared/agents/utils.py +0 -35
  453. rasa/shared/utils/mcp/server_connection.py +0 -157
  454. /rasa/{agents → builder}/__init__.py +0 -0
  455. /rasa/{agents/core → builder/copilot}/__init__.py +0 -0
  456. /rasa/{agents/protocol/a2a → builder/copilot/prompts}/__init__.py +0 -0
  457. /rasa/{agents/protocol/mcp → builder/copilot/templated_messages}/__init__.py +0 -0
  458. /rasa/{agents/templates → builder/document_retrieval}/__init__.py +0 -0
  459. /rasa/{shared/agents → cli/project_templates/finance/actions/accounts}/__init__.py +0 -0
  460. /rasa/{shared/utils/mcp → cli/project_templates/finance/actions/cards}/__init__.py +0 -0
  461. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/NOTICE +0 -0
  462. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/WHEEL +0 -0
  463. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/entry_points.txt +0 -0
@@ -1,662 +0,0 @@
1
- import asyncio
2
- import json
3
- import os
4
- import uuid
5
- from typing import Any, Dict, List, Optional
6
- from urllib.parse import urlparse
7
-
8
- import httpx
9
- import structlog
10
- from a2a.client import (
11
- A2ACardResolver,
12
- A2AClient,
13
- A2AClientError,
14
- A2AClientHTTPError,
15
- A2AClientJSONError,
16
- )
17
- from a2a.types import (
18
- AgentCapabilities,
19
- AgentCard,
20
- AgentSkill,
21
- DataPart,
22
- FilePart,
23
- FileWithUri,
24
- InternalError,
25
- InvalidAgentResponseError,
26
- JSONRPCErrorResponse,
27
- Message,
28
- MessageSendConfiguration,
29
- MessageSendParams,
30
- Part,
31
- Role,
32
- SendStreamingMessageRequest,
33
- SendStreamingMessageResponse,
34
- Task,
35
- TaskArtifactUpdateEvent,
36
- TaskState,
37
- TaskStatus,
38
- TaskStatusUpdateEvent,
39
- TextPart,
40
- )
41
-
42
- from rasa.agents.constants import (
43
- A2A_AGENT_CONTEXT_ID_KEY,
44
- A2A_AGENT_TASK_ID_KEY,
45
- AGENT_DEFAULT_MAX_RETRIES,
46
- AGENT_DEFAULT_TIMEOUT_SECONDS,
47
- AGENT_METADATA_TOOL_RESULTS_KEY,
48
- MAX_AGENT_RETRY_DELAY_SECONDS,
49
- )
50
- from rasa.agents.core.agent_protocol import AgentProtocol
51
- from rasa.agents.core.types import AgentStatus, ProtocolType
52
- from rasa.agents.schemas import AgentInput, AgentOutput
53
- from rasa.core.available_agents import AgentConfig
54
- from rasa.shared.exceptions import (
55
- AgentInitializationException,
56
- InvalidParameterException,
57
- RasaException,
58
- )
59
-
60
- structlogger = structlog.get_logger()
61
-
62
-
63
- class A2AAgent(AgentProtocol):
64
- """A2A client implementation"""
65
-
66
- def __init__(
67
- self,
68
- name: str,
69
- description: str,
70
- agent_card_path: str,
71
- timeout: int,
72
- max_retries: int,
73
- ) -> None:
74
- self._name = name
75
- self._description = description
76
- self._agent_card_path = agent_card_path
77
- self._timeout = timeout
78
- self._max_retries = max_retries
79
-
80
- self.agent_card: Optional[AgentCard] = None
81
- self._client: Optional[A2AClient] = None
82
-
83
- @classmethod
84
- def from_config(cls, config: AgentConfig) -> AgentProtocol:
85
- """Initialize the A2A Agent with the given configuration."""
86
- agent_card_path = (
87
- config.configuration.agent_card if config.configuration else None
88
- )
89
- if not agent_card_path:
90
- raise InvalidParameterException(
91
- "Agent card path or URL must be provided in the configuration "
92
- "for A2A agents."
93
- )
94
-
95
- timeout = (
96
- config.configuration.timeout
97
- if config.configuration and config.configuration.timeout
98
- else AGENT_DEFAULT_TIMEOUT_SECONDS
99
- )
100
- max_retries = (
101
- config.configuration.max_retries
102
- if config.configuration and config.configuration.max_retries
103
- else AGENT_DEFAULT_MAX_RETRIES
104
- )
105
-
106
- return cls(
107
- name=config.agent.name,
108
- description=config.agent.description,
109
- agent_card_path=agent_card_path,
110
- timeout=timeout,
111
- max_retries=max_retries,
112
- )
113
-
114
- @property
115
- def protocol_type(self) -> ProtocolType:
116
- return ProtocolType.A2A
117
-
118
- async def connect(self) -> None:
119
- """Fetch the AgentCard and initialize the A2A client."""
120
- from rasa.nlu.utils import is_url
121
-
122
- if is_url(self._agent_card_path):
123
- self.agent_card = await A2AAgent._resolve_agent_card_with_retry(
124
- self._agent_card_path, self._timeout, self._max_retries
125
- )
126
- else:
127
- self.agent_card = A2AAgent._load_agent_card_from_file(self._agent_card_path)
128
- structlogger.debug(
129
- "a2a_agent.from_config",
130
- event_info=f"Loaded agent card from {self._agent_card_path}",
131
- agent_card=self.agent_card,
132
- )
133
-
134
- try:
135
- self._client = A2AClient(
136
- httpx.AsyncClient(timeout=self._timeout), agent_card=self.agent_card
137
- )
138
- structlogger.debug(
139
- "a2a_agent.connect.success",
140
- event_info=f"Connected to A2A server '{self._name}' "
141
- f"at {self.agent_card.url}",
142
- )
143
- # TODO: Make a test request to /tasks to verify the connection
144
- except Exception as exception:
145
- structlogger.error(
146
- "a2a_agent.connect.error",
147
- event_info="Failed to initialize A2A client",
148
- agent_name=self._name,
149
- error=str(exception),
150
- )
151
- raise AgentInitializationException(
152
- f"Failed to initialize A2A client for agent "
153
- f"'{self._name}': {exception}"
154
- ) from exception
155
-
156
- async def disconnect(self) -> None:
157
- """We don't need to explicitly disconnect the A2A client"""
158
- return
159
-
160
- async def process_input(self, agent_input: AgentInput) -> AgentInput:
161
- """Pre-process the input before sending it to the agent."""
162
- # A2A-specific input processing logic
163
- return agent_input
164
-
165
- async def run(self, agent_input: AgentInput) -> AgentOutput:
166
- """Send a message to Agent/server and return response."""
167
- if not self._client or not self.agent_card:
168
- structlogger.error(
169
- "a2a_agent.run.error",
170
- event_info="A2A client is not initialized. " "Call connect() first.",
171
- )
172
- return AgentOutput(
173
- id=agent_input.id,
174
- status=AgentStatus.FATAL_ERROR,
175
- error_message="Client not initialized",
176
- )
177
-
178
- if self.agent_card.capabilities.streaming:
179
- structlogger.info(
180
- "a2a_agent.run.streaming",
181
- event_info="Running A2A agent in streaming mode",
182
- agent_name=self._name,
183
- )
184
- return await self._run_streaming_agent(agent_input)
185
- else:
186
- # we dont support non-streaming mode yet
187
- structlogger.error(
188
- "a2a_agent.run.error",
189
- event_info="Non-streaming mode is currently not supported",
190
- agent_name=self._name,
191
- )
192
- return AgentOutput(
193
- id=agent_input.id,
194
- status=AgentStatus.FATAL_ERROR,
195
- error_message="Non-streaming mode is not supported",
196
- )
197
-
198
- async def process_output(self, output: AgentOutput) -> AgentOutput:
199
- """Post-process the output before returning it to Rasa."""
200
- # A2A-specific output processing logic
201
- return output
202
-
203
- async def _run_streaming_agent(self, agent_input: AgentInput) -> AgentOutput:
204
- if not self._client:
205
- structlogger.error(
206
- "a2a_agent.run_streaming_agent.error",
207
- event_info="A2A client is not initialized. Call connect() first.",
208
- )
209
- return AgentOutput(
210
- id=agent_input.id,
211
- status=AgentStatus.FATAL_ERROR,
212
- error_message="Client not initialized",
213
- )
214
- message_send_params = self._prepare_message_send_params(agent_input)
215
-
216
- try:
217
- async for response in self._client.send_message_streaming(
218
- SendStreamingMessageRequest(
219
- id=str(uuid.uuid4()), params=message_send_params
220
- )
221
- ):
222
- agent_output = self._handle_streaming_response(agent_input, response)
223
- if agent_output is not None:
224
- return agent_output
225
- else:
226
- # Not a terminal response, continue waiting for next responses
227
- continue
228
-
229
- except A2AClientError as exception:
230
- structlogger.error(
231
- "a2a_agent.run_streaming_agent.error",
232
- event_info="Error during streaming message to A2A server",
233
- agent_name=self._name,
234
- error=str(exception),
235
- )
236
- return AgentOutput(
237
- id=agent_input.id,
238
- status=AgentStatus.FATAL_ERROR,
239
- error_message=f"Streaming error: {exception!s}",
240
- )
241
-
242
- # In case we didn't receive any response or the response ended unexpectedly
243
- structlogger.error(
244
- "a2a_agent.run_streaming_agent.unexpected_end",
245
- event_info="Unexpected end of streaming response from A2A server",
246
- agent_name=self._name,
247
- )
248
- return AgentOutput(
249
- id=agent_input.id,
250
- status=AgentStatus.FATAL_ERROR,
251
- error_message="Unexpected end of streaming response",
252
- )
253
-
254
- def _handle_streaming_response(
255
- self, agent_input: AgentInput, response: SendStreamingMessageResponse
256
- ) -> Optional[AgentOutput]:
257
- """If the agent response is terminal (i.e., completed, failed, etc.),
258
- this method will return an AgentOutput.
259
- Otherwise, the task is still in progress (i.e., submitted, working), so this
260
- method will return None, so that the streaming or pooling agent can continue
261
- to wait for updates.
262
- """
263
- if isinstance(response.root, JSONRPCErrorResponse):
264
- return self._handle_json_rpc_error_response(agent_input, response.root)
265
-
266
- response_result = response.root.result
267
- if isinstance(response_result, Task):
268
- return self._handle_task_response(agent_input, response_result)
269
- elif isinstance(response_result, Message):
270
- return self._handle_message_response(response_result)
271
- elif isinstance(response_result, TaskStatusUpdateEvent):
272
- return self._handle_task_status_update_event(agent_input, response_result)
273
- elif isinstance(response_result, TaskArtifactUpdateEvent):
274
- return self._handle_task_artifact_update_event(agent_input, response_result)
275
- else:
276
- # Currently, no other response types exist, so this branch is
277
- # unreachable. It is kept as a safeguard against future changes
278
- # to the A2A protocol: if new response types are introduced,
279
- # the agent will log an error instead of crashing.
280
- return self._handle_unexpected_response_type(agent_input, response_result)
281
-
282
- def _handle_json_rpc_error_response(
283
- self, agent_input: AgentInput, response: JSONRPCErrorResponse
284
- ) -> AgentOutput:
285
- structlogger.error(
286
- "a2a_agent.run_streaming_agent.error",
287
- event_info="Received error response from A2A server during streaming",
288
- agent_name=self._name,
289
- error=str(response.error),
290
- )
291
- if isinstance(
292
- response.error,
293
- (
294
- InternalError,
295
- InvalidAgentResponseError,
296
- ),
297
- ):
298
- return AgentOutput(
299
- id=agent_input.id,
300
- status=AgentStatus.RECOVERABLE_ERROR,
301
- error_message=str(response.error),
302
- )
303
- else:
304
- return AgentOutput(
305
- id=agent_input.id,
306
- status=AgentStatus.FATAL_ERROR,
307
- error_message=str(response.error),
308
- )
309
-
310
- def _handle_task_response(
311
- self, agent_input: AgentInput, task: Task
312
- ) -> Optional[AgentOutput]:
313
- structlogger.debug(
314
- "a2a_agent.run_streaming_agent.task_received",
315
- event_info="Received task from A2A",
316
- agent_name=self._name,
317
- task=task,
318
- )
319
- agent_output = self._handle_task_status(
320
- agent_input=agent_input,
321
- context_id=task.context_id,
322
- task_id=task.id,
323
- task_status=task.status,
324
- )
325
- return agent_output
326
-
327
- def _handle_message_response(self, message: Message) -> Optional[AgentOutput]:
328
- # Message represents an intermediate conversational update,
329
- # we need to continue waiting for task updates
330
- structlogger.debug(
331
- "a2a_agent.run_streaming_agent.message_received",
332
- event_info="Received message from A2A",
333
- agent_name=self._name,
334
- message=message,
335
- )
336
- return None
337
-
338
- def _handle_task_status_update_event(
339
- self, agent_input: AgentInput, event: TaskStatusUpdateEvent
340
- ) -> Optional[AgentOutput]:
341
- structlogger.debug(
342
- "a2a_agent.run_streaming_agent.task_status_update_received",
343
- event_info="Received task status update from A2A",
344
- agent_name=self._name,
345
- task_status_update_event=event,
346
- )
347
- agent_output = self._handle_task_status(
348
- agent_input=agent_input,
349
- context_id=event.context_id,
350
- task_id=event.task_id,
351
- task_status=event.status,
352
- )
353
- return agent_output
354
-
355
- def _handle_task_artifact_update_event(
356
- self, agent_input: AgentInput, event: TaskArtifactUpdateEvent
357
- ) -> AgentOutput:
358
- structlogger.debug(
359
- "a2a_agent.run_streaming_agent.task_artifact_update_received",
360
- event_info="Received task artifact update from A2A",
361
- agent_name=self._name,
362
- task_artifact_update_event=event,
363
- )
364
- return AgentOutput(
365
- id=agent_input.id,
366
- status=AgentStatus.COMPLETED,
367
- response_message=self._generate_response_message_from_parts(
368
- event.artifact.parts
369
- ),
370
- tool_results=self._generate_tool_results_from_parts(
371
- agent_input, event.artifact.parts
372
- ),
373
- )
374
-
375
- def _handle_unexpected_response_type(
376
- self, agent_input: AgentInput, response_result: Any
377
- ) -> AgentOutput:
378
- structlogger.error(
379
- "a2a_agent.run_streaming_agent.unexpected_response_type",
380
- event_info="Received unexpected response type from A2A server "
381
- "during streaming",
382
- agent_name=self._name,
383
- response_type=type(response_result),
384
- )
385
- return AgentOutput(
386
- id=agent_input.id,
387
- status=AgentStatus.FATAL_ERROR,
388
- error_message=f"Unexpected response type: {type(response_result)}",
389
- )
390
-
391
- def _handle_task_status(
392
- self,
393
- agent_input: AgentInput,
394
- context_id: str,
395
- task_id: str,
396
- task_status: TaskStatus,
397
- metadata: Optional[Dict[str, Any]] = None,
398
- ) -> Optional[AgentOutput]:
399
- """If the task status is terminal (i.e., completed, failed, etc.),
400
- return an AgentOutput.
401
- If the task is still in progress (i.e., submitted, working), return None,
402
- so that the streaming or pooling agent can continue to wait for updates.
403
- """
404
- state = task_status.state
405
-
406
- metadata = metadata or {}
407
- metadata[A2A_AGENT_CONTEXT_ID_KEY] = context_id
408
- metadata[A2A_AGENT_TASK_ID_KEY] = task_id
409
-
410
- if state == TaskState.input_required:
411
- response_message = (
412
- self._generate_response_message_from_parts(task_status.message.parts)
413
- if task_status.message
414
- else ""
415
- ) # This should not happen, but as type of message property
416
- # is optional, so we need to handle it
417
- return AgentOutput(
418
- id=agent_input.id,
419
- status=AgentStatus.INPUT_REQUIRED,
420
- response_message=response_message,
421
- metadata=metadata,
422
- )
423
- elif state == TaskState.completed:
424
- response_message = (
425
- self._generate_response_message_from_parts(task_status.message.parts)
426
- if task_status.message
427
- else ""
428
- ) # This should not happen, but as type of message property
429
- # is optional, so we need to handle it
430
- return AgentOutput(
431
- id=agent_input.id,
432
- status=AgentStatus.COMPLETED,
433
- response_message=response_message,
434
- metadata=metadata,
435
- )
436
- elif (
437
- state == TaskState.failed
438
- or state == TaskState.canceled
439
- or state == TaskState.rejected
440
- or state == TaskState.auth_required
441
- ):
442
- structlogger.error(
443
- "a2a_agent.run_streaming_agent.unsuccessful_task_state",
444
- event_info="Task execution finished with an unsuccessful state",
445
- agent_name=self._name,
446
- state=state,
447
- )
448
- return AgentOutput(
449
- id=agent_input.id,
450
- status=AgentStatus.RECOVERABLE_ERROR,
451
- error_message=f"Task state: {state}",
452
- metadata=metadata,
453
- )
454
- elif state == TaskState.submitted or state == TaskState.working:
455
- # The task is still in progress, return None to continue waiting for updates
456
- return None
457
- else:
458
- structlogger.error(
459
- "a2a_agent.run_streaming_agent.unexpected_task_state",
460
- event_info="Unexpected task state received from A2A",
461
- agent_name=self._name,
462
- state=state,
463
- )
464
- return AgentOutput(
465
- id=agent_input.id,
466
- status=AgentStatus.FATAL_ERROR,
467
- error_message=f"Unexpected task state: {state}",
468
- metadata=metadata,
469
- )
470
-
471
- @staticmethod
472
- def _prepare_message_send_params(agent_input: AgentInput) -> MessageSendParams:
473
- parts: List[Part] = []
474
- if agent_input.metadata and A2A_AGENT_CONTEXT_ID_KEY in agent_input.metadata:
475
- # Agent knows the conversation history already, send the last
476
- # user message only
477
- parts.append(Part(root=TextPart(text=agent_input.user_message)))
478
- else:
479
- # Send the full conversation history
480
- parts.append(Part(root=TextPart(text=agent_input.conversation_history)))
481
-
482
- if len(agent_input.slots) > 0:
483
- slots_dict: Dict[str, Any] = {
484
- "slots": [
485
- slot.model_dump(exclude={"type", "allowed_values"})
486
- for slot in agent_input.slots
487
- if slot.value is not None
488
- ]
489
- }
490
- parts.append(Part(root=DataPart(data=slots_dict)))
491
-
492
- agent_message = Message(
493
- role=Role.user,
494
- parts=parts,
495
- message_id=str(uuid.uuid4()),
496
- context_id=agent_input.metadata.get(A2A_AGENT_CONTEXT_ID_KEY, None),
497
- task_id=agent_input.metadata.get(A2A_AGENT_TASK_ID_KEY, None),
498
- )
499
- structlogger.debug(
500
- "a2a_agent._prepare_message_send_params",
501
- event_info="Prepared message to send to A2A server",
502
- agent_name=agent_input.id,
503
- message=agent_message,
504
- )
505
- return MessageSendParams(
506
- message=agent_message,
507
- configuration=MessageSendConfiguration(
508
- accepted_output_modes=["text", "text/plain", "application/json"],
509
- ),
510
- )
511
-
512
- @staticmethod
513
- def _generate_response_message_from_parts(parts: Optional[List[Part]]) -> str:
514
- """Convert a list of Part objects to a single string message."""
515
- result = ""
516
- if not parts:
517
- return result
518
- for part in parts:
519
- if isinstance(part.root, TextPart):
520
- result += part.root.text + "\n"
521
- elif isinstance(part.root, DataPart):
522
- # DataPart results will be returned as a pert of the tool results,
523
- # we don't need to include it in the response message
524
- continue
525
- elif isinstance(part.root, FilePart) and isinstance(
526
- part.root.file, FileWithUri
527
- ):
528
- # If the file is a FileWithUri, we can include the URI
529
- result += f"File: {part.root.file.uri}\n"
530
- else:
531
- structlogger.warning(
532
- "a2a_agent._parts_to_single_message.warning",
533
- event_info="Unsupported part type encountered",
534
- part_type=type(part.root),
535
- )
536
- return result.strip()
537
-
538
- @staticmethod
539
- def _generate_tool_results_from_parts(
540
- agent_input: AgentInput, parts: List[Part]
541
- ) -> Optional[List[List[Dict[str, Any]]]]:
542
- tool_results_of_current_iteration: List[Dict[str, Any]] = []
543
- for i, part in enumerate(parts):
544
- if (
545
- isinstance(part.root, DataPart)
546
- and part.root.data
547
- and len(part.root.data) > 0
548
- ):
549
- # There might be multiple DataParts in the response,
550
- # we will treat each of them as a separate tool result.
551
- # The tool name will be the agent ID + index of the part.
552
- tool_results_of_current_iteration.append(
553
- {"tool_name": f"{agent_input.id}_{i}", "result": part.root.data}
554
- )
555
-
556
- previous_tool_results: List[List[Dict[str, Any]]] = (
557
- agent_input.metadata.get(AGENT_METADATA_TOOL_RESULTS_KEY, []) or []
558
- )
559
- previous_tool_results.append(tool_results_of_current_iteration)
560
-
561
- return previous_tool_results
562
-
563
- @staticmethod
564
- def _load_agent_card_from_file(agent_card_path: str) -> AgentCard:
565
- """Load agent card from JSON file."""
566
- try:
567
- with open(os.path.abspath(agent_card_path), "r") as f:
568
- card_data = json.load(f)
569
-
570
- skills = [
571
- AgentSkill(
572
- id=skill_data["id"],
573
- name=skill_data["name"],
574
- description=skill_data["description"],
575
- tags=skill_data.get("tags", []),
576
- examples=skill_data.get("examples", []),
577
- )
578
- for skill_data in card_data.get("skills", [])
579
- ]
580
-
581
- return AgentCard(
582
- name=card_data["name"],
583
- description=card_data["description"],
584
- url=card_data["url"],
585
- version=card_data.get("version", "1.0.0"),
586
- default_input_modes=card_data.get(
587
- "defaultInputModes", ["text", "text/plain"]
588
- ),
589
- default_output_modes=card_data.get(
590
- "defaultOutputModes", ["text", "text/plain", "application/json"]
591
- ),
592
- capabilities=AgentCapabilities(
593
- streaming=card_data.get("capabilities", {}).get("streaming", True)
594
- ),
595
- skills=skills,
596
- )
597
- except FileNotFoundError:
598
- raise FileNotFoundError(f"Agent card file not found: {agent_card_path}")
599
- except json.JSONDecodeError as e:
600
- raise ValueError(f"Invalid JSON in agent card file {agent_card_path}: {e}")
601
- except KeyError as e:
602
- raise ValueError(
603
- f"Missing required field in agent card {agent_card_path}: {e}"
604
- )
605
-
606
- @staticmethod
607
- async def _resolve_agent_card_with_retry(
608
- agent_card_path: str, timeout: int, max_retries: int
609
- ) -> AgentCard:
610
- """Resolve the agent card from a given path or URL."""
611
- # split agent_card_path into base URL and path
612
- try:
613
- url_parts = urlparse(agent_card_path)
614
- base_url = f"{url_parts.scheme}://{url_parts.netloc}"
615
- path = url_parts.path
616
- except ValueError:
617
- raise RasaException(f"Could not parse the URL: '{agent_card_path}'.")
618
- structlogger.debug(
619
- "a2a_agent.resolve_agent_card",
620
- event_info="Resolving agent card from remote URL",
621
- agent_card_path=agent_card_path,
622
- base_url=base_url,
623
- path=path,
624
- timeout=timeout,
625
- )
626
-
627
- for attempt in range(max_retries):
628
- if attempt > 0:
629
- structlogger.debug(
630
- "a2a_agent.resolve_agent_card.retrying",
631
- agent_card_path=f"{base_url}/{path}",
632
- attempt=attempt + 1,
633
- num_retries=max_retries,
634
- )
635
-
636
- try:
637
- agent_card = await A2ACardResolver(
638
- httpx.AsyncClient(timeout=timeout),
639
- base_url=base_url,
640
- agent_card_path=path,
641
- ).get_agent_card()
642
-
643
- if agent_card:
644
- return agent_card
645
- except (A2AClientHTTPError, A2AClientJSONError) as exception:
646
- structlogger.warning(
647
- "a2a_agent.resolve_agent_card.error",
648
- event_info="Error while resolving agent card",
649
- agent_card_path=agent_card_path,
650
- attempt=attempt + 1,
651
- num_retries=max_retries,
652
- error=str(exception),
653
- )
654
- if attempt < max_retries - 1:
655
- # exponential backoff - wait longer with each retry
656
- # 1 second, 2 seconds, 4 seconds, etc.
657
- await asyncio.sleep(min(2**attempt, MAX_AGENT_RETRY_DELAY_SECONDS))
658
-
659
- raise AgentInitializationException(
660
- f"Failed to resolve agent card from {agent_card_path} after "
661
- f"{max_retries} attempts."
662
- )