rasa-pro 3.14.0.dev20250922__py3-none-any.whl → 3.14.0rc2__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 (304) hide show
  1. rasa/__main__.py +15 -3
  2. rasa/agents/__init__.py +0 -0
  3. rasa/agents/agent_factory.py +122 -0
  4. rasa/agents/agent_manager.py +211 -0
  5. rasa/agents/constants.py +43 -0
  6. rasa/agents/core/__init__.py +0 -0
  7. rasa/agents/core/agent_protocol.py +107 -0
  8. rasa/agents/core/types.py +81 -0
  9. rasa/agents/exceptions.py +38 -0
  10. rasa/agents/protocol/__init__.py +5 -0
  11. rasa/agents/protocol/a2a/__init__.py +0 -0
  12. rasa/agents/protocol/a2a/a2a_agent.py +879 -0
  13. rasa/agents/protocol/mcp/__init__.py +0 -0
  14. rasa/agents/protocol/mcp/mcp_base_agent.py +726 -0
  15. rasa/agents/protocol/mcp/mcp_open_agent.py +327 -0
  16. rasa/agents/protocol/mcp/mcp_task_agent.py +522 -0
  17. rasa/agents/schemas/__init__.py +13 -0
  18. rasa/agents/schemas/agent_input.py +38 -0
  19. rasa/agents/schemas/agent_output.py +26 -0
  20. rasa/agents/schemas/agent_tool_result.py +65 -0
  21. rasa/agents/schemas/agent_tool_schema.py +186 -0
  22. rasa/agents/templates/__init__.py +0 -0
  23. rasa/agents/templates/mcp_open_agent_prompt_template.jinja2 +20 -0
  24. rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +22 -0
  25. rasa/agents/utils.py +206 -0
  26. rasa/agents/validation.py +485 -0
  27. rasa/api.py +24 -9
  28. rasa/builder/config.py +6 -2
  29. rasa/builder/copilot/constants.py +4 -1
  30. rasa/builder/copilot/copilot.py +155 -79
  31. rasa/builder/copilot/models.py +304 -108
  32. rasa/builder/copilot/prompts/copilot_training_error_handler_prompt.jinja2 +53 -0
  33. rasa/builder/guardrails/{lakera.py → clients.py} +55 -5
  34. rasa/builder/guardrails/constants.py +3 -0
  35. rasa/builder/guardrails/models.py +45 -10
  36. rasa/builder/guardrails/policy_checker.py +324 -0
  37. rasa/builder/guardrails/utils.py +42 -276
  38. rasa/builder/jobs.py +182 -12
  39. rasa/builder/llm_service.py +32 -5
  40. rasa/builder/models.py +13 -3
  41. rasa/builder/project_generator.py +6 -1
  42. rasa/builder/service.py +31 -15
  43. rasa/builder/training_service.py +18 -24
  44. rasa/builder/validation_service.py +1 -1
  45. rasa/cli/arguments/default_arguments.py +12 -0
  46. rasa/cli/arguments/run.py +2 -0
  47. rasa/cli/arguments/train.py +2 -0
  48. rasa/cli/data.py +10 -8
  49. rasa/cli/dialogue_understanding_test.py +10 -7
  50. rasa/cli/e2e_test.py +9 -6
  51. rasa/cli/evaluate.py +4 -2
  52. rasa/cli/export.py +5 -2
  53. rasa/cli/inspect.py +8 -4
  54. rasa/cli/interactive.py +5 -4
  55. rasa/cli/llm_fine_tuning.py +11 -6
  56. rasa/cli/project_templates/finance/domain/general/help.yml +0 -0
  57. rasa/cli/project_templates/tutorial/credentials.yml +10 -0
  58. rasa/cli/run.py +12 -10
  59. rasa/cli/scaffold.py +4 -4
  60. rasa/cli/shell.py +9 -5
  61. rasa/cli/studio/studio.py +1 -1
  62. rasa/cli/test.py +34 -14
  63. rasa/cli/train.py +41 -28
  64. rasa/cli/utils.py +1 -393
  65. rasa/cli/validation/__init__.py +0 -0
  66. rasa/cli/validation/bot_config.py +223 -0
  67. rasa/cli/validation/config_path_validation.py +257 -0
  68. rasa/cli/x.py +8 -4
  69. rasa/constants.py +7 -1
  70. rasa/core/actions/action.py +51 -10
  71. rasa/core/actions/grpc_custom_action_executor.py +1 -1
  72. rasa/core/agent.py +19 -2
  73. rasa/core/available_agents.py +229 -0
  74. rasa/core/brokers/kafka.py +5 -1
  75. rasa/core/channels/__init__.py +82 -35
  76. rasa/core/channels/development_inspector.py +3 -3
  77. rasa/core/channels/inspector/README.md +25 -13
  78. rasa/core/channels/inspector/dist/assets/{arc-35222594.js → arc-6177260a.js} +1 -1
  79. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-a0efbfd3.js → blockDiagram-38ab4fdb-b054f038.js} +1 -1
  80. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-0584c0f2.js → c4Diagram-3d4e48cf-f25427d5.js} +1 -1
  81. rasa/core/channels/inspector/dist/assets/channel-bf9cbb34.js +1 -0
  82. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-39f40dbe.js → classDiagram-70f12bd4-c7a2af53.js} +1 -1
  83. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-1ad755f3.js → classDiagram-v2-f2320105-58db65c0.js} +1 -1
  84. rasa/core/channels/inspector/dist/assets/clone-8f9083bb.js +1 -0
  85. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-b0f4f0fe.js → createText-2e5e7dd3-088372e2.js} +1 -1
  86. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-9039bff9.js → edges-e0da2a9e-58676240.js} +1 -1
  87. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-65c9b127.js → erDiagram-9861fffd-0c14d7c6.js} +1 -1
  88. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-4f08b38e.js → flowDb-956e92f1-ea63f85c.js} +1 -1
  89. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-e95c362a.js → flowDiagram-66a62f08-a2af48cd.js} +1 -1
  90. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-9ecd5b59.js +1 -0
  91. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-703c3015.js → flowchart-elk-definition-4a651766-6937abe7.js} +1 -1
  92. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-699328ea.js → ganttDiagram-c361ad54-7473f357.js} +1 -1
  93. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-04cf4b05.js → gitGraphDiagram-72cf32ee-d0c9405e.js} +1 -1
  94. rasa/core/channels/inspector/dist/assets/{graph-ee94449e.js → graph-0a6f8466.js} +1 -1
  95. rasa/core/channels/inspector/dist/assets/{index-3862675e-940162b4.js → index-3862675e-7610671a.js} +1 -1
  96. rasa/core/channels/inspector/dist/assets/index-74e01d94.js +1354 -0
  97. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-c79c2866.js → infoDiagram-f8f76790-be397dc7.js} +1 -1
  98. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-84489d30.js → journeyDiagram-49397b02-4cefbf62.js} +1 -1
  99. rasa/core/channels/inspector/dist/assets/{layout-a9aa9858.js → layout-e7fbc2bf.js} +1 -1
  100. rasa/core/channels/inspector/dist/assets/{line-eb73cf26.js → line-a8aa457c.js} +1 -1
  101. rasa/core/channels/inspector/dist/assets/{linear-b3399f9a.js → linear-3351e0d2.js} +1 -1
  102. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-b095bf1a.js → mindmap-definition-fc14e90a-b8cbf605.js} +1 -1
  103. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-07644b66.js → pieDiagram-8a3498a8-f327f774.js} +1 -1
  104. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-573a3f9c.js → quadrantDiagram-120e2f19-2854c591.js} +1 -1
  105. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-d457e1e1.js → requirementDiagram-deff3bca-964985d5.js} +1 -1
  106. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-9d26e1a2.js → sankeyDiagram-04a897e0-edeb4f33.js} +1 -1
  107. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-3a9cde10.js → sequenceDiagram-704730f1-fcf70125.js} +1 -1
  108. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-4f3e8cec.js → stateDiagram-587899a1-0e770395.js} +1 -1
  109. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-e617e5bf.js → stateDiagram-v2-d93cdb3a-af8dcd22.js} +1 -1
  110. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-eab30d2f.js → styles-6aaf32cf-36a9e70d.js} +1 -1
  111. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-09994be2.js → styles-9a916d00-884a8b5b.js} +1 -1
  112. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-b7110364.js → styles-c10674c1-dc097813.js} +1 -1
  113. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-3ebc92ad.js → svgDrawCommon-08f97a94-5a2c7eed.js} +1 -1
  114. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-7d13d2f2.js → timeline-definition-85554ec2-e89c4f6e.js} +1 -1
  115. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-488385e1.js → xychartDiagram-e933f94c-afb6fe56.js} +1 -1
  116. rasa/core/channels/inspector/dist/index.html +1 -1
  117. rasa/core/channels/inspector/package.json +18 -18
  118. rasa/core/channels/inspector/src/App.tsx +29 -4
  119. rasa/core/channels/inspector/src/components/DialogueAgentStack.tsx +108 -0
  120. rasa/core/channels/inspector/src/components/{DialogueStack.tsx → DialogueHistoryStack.tsx} +4 -2
  121. rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +7 -4
  122. rasa/core/channels/inspector/src/helpers/formatters.test.ts +4 -0
  123. rasa/core/channels/inspector/src/helpers/formatters.ts +24 -3
  124. rasa/core/channels/inspector/src/helpers/utils.test.ts +127 -0
  125. rasa/core/channels/inspector/src/helpers/utils.ts +66 -1
  126. rasa/core/channels/inspector/src/theme/base/styles.ts +19 -1
  127. rasa/core/channels/inspector/src/types.ts +21 -0
  128. rasa/core/channels/inspector/yarn.lock +336 -189
  129. rasa/core/channels/studio_chat.py +6 -6
  130. rasa/core/channels/telegram.py +4 -9
  131. rasa/core/channels/voice_stream/genesys.py +1 -1
  132. rasa/core/channels/voice_stream/tts/deepgram.py +140 -0
  133. rasa/core/channels/voice_stream/twilio_media_streams.py +5 -1
  134. rasa/core/channels/voice_stream/voice_channel.py +3 -0
  135. rasa/core/concurrent_lock_store.py +38 -21
  136. rasa/core/config/__init__.py +0 -0
  137. rasa/core/{available_endpoints.py → config/available_endpoints.py} +51 -16
  138. rasa/core/config/configuration.py +260 -0
  139. rasa/core/config/credentials.py +19 -0
  140. rasa/core/config/message_procesing_config.py +34 -0
  141. rasa/core/constants.py +10 -0
  142. rasa/core/iam_credentials_providers/aws_iam_credentials_providers.py +69 -4
  143. rasa/core/iam_credentials_providers/credentials_provider_protocol.py +2 -1
  144. rasa/core/lock_store.py +4 -0
  145. rasa/core/policies/enterprise_search_policy.py +5 -3
  146. rasa/core/policies/flow_policy.py +4 -4
  147. rasa/core/policies/flows/agent_executor.py +632 -0
  148. rasa/core/policies/flows/flow_executor.py +136 -75
  149. rasa/core/policies/flows/mcp_tool_executor.py +298 -0
  150. rasa/core/policies/intentless_policy.py +1 -1
  151. rasa/core/policies/ted_policy.py +20 -12
  152. rasa/core/policies/unexpected_intent_policy.py +6 -0
  153. rasa/core/processor.py +68 -44
  154. rasa/core/redis_connection_factory.py +7 -2
  155. rasa/core/run.py +37 -8
  156. rasa/core/test.py +4 -0
  157. rasa/core/tracker_stores/redis_tracker_store.py +4 -0
  158. rasa/core/tracker_stores/sql_tracker_store.py +3 -1
  159. rasa/core/tracker_stores/tracker_store.py +3 -7
  160. rasa/core/train.py +1 -1
  161. rasa/core/training/interactive.py +20 -18
  162. rasa/core/training/story_conflict.py +5 -5
  163. rasa/core/utils.py +22 -23
  164. rasa/dialogue_understanding/commands/__init__.py +8 -0
  165. rasa/dialogue_understanding/commands/cancel_flow_command.py +19 -5
  166. rasa/dialogue_understanding/commands/chit_chat_answer_command.py +21 -2
  167. rasa/dialogue_understanding/commands/clarify_command.py +20 -2
  168. rasa/dialogue_understanding/commands/continue_agent_command.py +91 -0
  169. rasa/dialogue_understanding/commands/knowledge_answer_command.py +21 -2
  170. rasa/dialogue_understanding/commands/restart_agent_command.py +162 -0
  171. rasa/dialogue_understanding/commands/start_flow_command.py +68 -7
  172. rasa/dialogue_understanding/commands/utils.py +124 -2
  173. rasa/dialogue_understanding/generator/command_parser.py +4 -0
  174. rasa/dialogue_understanding/generator/llm_based_command_generator.py +50 -12
  175. rasa/dialogue_understanding/generator/llm_command_generator.py +1 -1
  176. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +1 -1
  177. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +66 -0
  178. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +66 -0
  179. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +89 -0
  180. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +88 -0
  181. rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +42 -7
  182. rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +40 -3
  183. rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +20 -3
  184. rasa/dialogue_understanding/patterns/cancel.py +27 -6
  185. rasa/dialogue_understanding/patterns/clarify.py +3 -14
  186. rasa/dialogue_understanding/patterns/continue_interrupted.py +239 -6
  187. rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +46 -8
  188. rasa/dialogue_understanding/processor/command_processor.py +136 -15
  189. rasa/dialogue_understanding/stack/dialogue_stack.py +98 -2
  190. rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +57 -0
  191. rasa/dialogue_understanding/stack/utils.py +57 -3
  192. rasa/dialogue_understanding/utils.py +24 -4
  193. rasa/dialogue_understanding_test/du_test_runner.py +8 -3
  194. rasa/e2e_test/e2e_test_runner.py +13 -3
  195. rasa/engine/caching.py +2 -2
  196. rasa/engine/constants.py +1 -1
  197. rasa/engine/recipes/default_components.py +138 -49
  198. rasa/engine/recipes/default_recipe.py +108 -11
  199. rasa/engine/runner/dask.py +8 -5
  200. rasa/engine/validation.py +19 -6
  201. rasa/graph_components/validators/default_recipe_validator.py +86 -28
  202. rasa/hooks.py +5 -5
  203. rasa/llm_fine_tuning/utils.py +2 -2
  204. rasa/model_training.py +60 -47
  205. rasa/nlu/classifiers/diet_classifier.py +198 -98
  206. rasa/nlu/classifiers/logistic_regression_classifier.py +1 -4
  207. rasa/nlu/classifiers/mitie_intent_classifier.py +3 -0
  208. rasa/nlu/classifiers/sklearn_intent_classifier.py +1 -3
  209. rasa/nlu/extractors/crf_entity_extractor.py +9 -10
  210. rasa/nlu/extractors/mitie_entity_extractor.py +3 -0
  211. rasa/nlu/extractors/spacy_entity_extractor.py +3 -0
  212. rasa/nlu/featurizers/dense_featurizer/convert_featurizer.py +4 -0
  213. rasa/nlu/featurizers/dense_featurizer/lm_featurizer.py +5 -0
  214. rasa/nlu/featurizers/dense_featurizer/mitie_featurizer.py +2 -0
  215. rasa/nlu/featurizers/dense_featurizer/spacy_featurizer.py +3 -0
  216. rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +4 -2
  217. rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +4 -0
  218. rasa/nlu/selectors/response_selector.py +10 -2
  219. rasa/nlu/tokenizers/jieba_tokenizer.py +3 -4
  220. rasa/nlu/tokenizers/mitie_tokenizer.py +3 -2
  221. rasa/nlu/tokenizers/spacy_tokenizer.py +3 -2
  222. rasa/nlu/utils/mitie_utils.py +3 -0
  223. rasa/nlu/utils/spacy_utils.py +3 -2
  224. rasa/plugin.py +8 -8
  225. rasa/privacy/privacy_manager.py +12 -3
  226. rasa/server.py +15 -3
  227. rasa/shared/agents/__init__.py +0 -0
  228. rasa/shared/agents/auth/__init__.py +0 -0
  229. rasa/shared/agents/auth/agent_auth_factory.py +105 -0
  230. rasa/shared/agents/auth/agent_auth_manager.py +92 -0
  231. rasa/shared/agents/auth/auth_strategy/__init__.py +19 -0
  232. rasa/shared/agents/auth/auth_strategy/agent_auth_strategy.py +52 -0
  233. rasa/shared/agents/auth/auth_strategy/api_key_auth_strategy.py +42 -0
  234. rasa/shared/agents/auth/auth_strategy/bearer_token_auth_strategy.py +28 -0
  235. rasa/shared/agents/auth/auth_strategy/oauth2_auth_strategy.py +167 -0
  236. rasa/shared/agents/auth/constants.py +12 -0
  237. rasa/shared/agents/auth/types.py +12 -0
  238. rasa/shared/agents/utils.py +35 -0
  239. rasa/shared/constants.py +8 -0
  240. rasa/shared/core/constants.py +16 -1
  241. rasa/shared/core/domain.py +0 -7
  242. rasa/shared/core/events.py +327 -0
  243. rasa/shared/core/flows/constants.py +5 -0
  244. rasa/shared/core/flows/flows_list.py +21 -5
  245. rasa/shared/core/flows/flows_yaml_schema.json +119 -184
  246. rasa/shared/core/flows/steps/call.py +49 -5
  247. rasa/shared/core/flows/steps/collect.py +98 -13
  248. rasa/shared/core/flows/validation.py +372 -8
  249. rasa/shared/core/flows/yaml_flows_io.py +3 -2
  250. rasa/shared/core/slots.py +2 -2
  251. rasa/shared/core/trackers.py +5 -2
  252. rasa/shared/exceptions.py +16 -0
  253. rasa/shared/importers/rasa.py +1 -1
  254. rasa/shared/importers/utils.py +9 -3
  255. rasa/shared/providers/llm/_base_litellm_client.py +41 -9
  256. rasa/shared/providers/llm/litellm_router_llm_client.py +8 -4
  257. rasa/shared/providers/llm/llm_client.py +7 -3
  258. rasa/shared/providers/llm/llm_response.py +66 -0
  259. rasa/shared/providers/llm/self_hosted_llm_client.py +8 -4
  260. rasa/shared/utils/common.py +24 -0
  261. rasa/shared/utils/health_check/health_check.py +7 -3
  262. rasa/shared/utils/llm.py +39 -16
  263. rasa/shared/utils/mcp/__init__.py +0 -0
  264. rasa/shared/utils/mcp/server_connection.py +247 -0
  265. rasa/shared/utils/mcp/utils.py +20 -0
  266. rasa/shared/utils/schemas/events.py +42 -0
  267. rasa/shared/utils/yaml.py +3 -1
  268. rasa/studio/pull/pull.py +3 -2
  269. rasa/studio/train.py +8 -7
  270. rasa/studio/upload.py +3 -6
  271. rasa/telemetry.py +69 -5
  272. rasa/tracing/config.py +45 -12
  273. rasa/tracing/constants.py +14 -0
  274. rasa/tracing/instrumentation/attribute_extractors.py +142 -9
  275. rasa/tracing/instrumentation/instrumentation.py +626 -21
  276. rasa/tracing/instrumentation/intentless_policy_instrumentation.py +4 -4
  277. rasa/tracing/instrumentation/metrics.py +32 -0
  278. rasa/tracing/metric_instrument_provider.py +68 -0
  279. rasa/utils/common.py +92 -1
  280. rasa/utils/endpoints.py +11 -2
  281. rasa/utils/log_utils.py +96 -5
  282. rasa/utils/ml_utils.py +1 -1
  283. rasa/utils/tensorflow/__init__.py +7 -0
  284. rasa/utils/tensorflow/callback.py +136 -101
  285. rasa/utils/tensorflow/crf.py +1 -1
  286. rasa/utils/tensorflow/data_generator.py +21 -8
  287. rasa/utils/tensorflow/layers.py +21 -11
  288. rasa/utils/tensorflow/metrics.py +7 -3
  289. rasa/utils/tensorflow/models.py +56 -8
  290. rasa/utils/tensorflow/rasa_layers.py +8 -6
  291. rasa/utils/tensorflow/transformer.py +2 -3
  292. rasa/utils/train_utils.py +54 -24
  293. rasa/validator.py +5 -5
  294. rasa/version.py +1 -1
  295. {rasa_pro-3.14.0.dev20250922.dist-info → rasa_pro-3.14.0rc2.dist-info}/METADATA +47 -41
  296. {rasa_pro-3.14.0.dev20250922.dist-info → rasa_pro-3.14.0rc2.dist-info}/RECORD +299 -238
  297. rasa/builder/scrape_rasa_docs.py +0 -97
  298. rasa/core/channels/inspector/dist/assets/channel-8e08bed9.js +0 -1
  299. rasa/core/channels/inspector/dist/assets/clone-78c82dea.js +0 -1
  300. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-2b08f601.js +0 -1
  301. rasa/core/channels/inspector/dist/assets/index-c941dcb3.js +0 -1336
  302. {rasa_pro-3.14.0.dev20250922.dist-info → rasa_pro-3.14.0rc2.dist-info}/NOTICE +0 -0
  303. {rasa_pro-3.14.0.dev20250922.dist-info → rasa_pro-3.14.0rc2.dist-info}/WHEEL +0 -0
  304. {rasa_pro-3.14.0.dev20250922.dist-info → rasa_pro-3.14.0rc2.dist-info}/entry_points.txt +0 -0
@@ -11,15 +11,25 @@ from rasa.dialogue_understanding.commands.command_syntax_manager import (
11
11
  CommandSyntaxManager,
12
12
  CommandSyntaxVersion,
13
13
  )
14
+ from rasa.dialogue_understanding.commands.utils import (
15
+ remove_pattern_continue_interrupted_frames,
16
+ resume_flow,
17
+ )
14
18
  from rasa.dialogue_understanding.stack.frames.flow_stack_frame import (
19
+ AgentState,
15
20
  FlowStackFrameType,
16
21
  UserFlowStackFrame,
17
22
  )
18
23
  from rasa.dialogue_understanding.stack.utils import (
24
+ is_continue_interrupted_flow_active,
19
25
  top_user_flow_frame,
20
26
  user_flows_on_the_stack,
21
27
  )
22
- from rasa.shared.core.events import Event, FlowInterrupted
28
+ from rasa.shared.core.events import (
29
+ AgentInterrupted,
30
+ Event,
31
+ FlowInterrupted,
32
+ )
23
33
  from rasa.shared.core.flows import FlowsList
24
34
  from rasa.shared.core.trackers import DialogueStateTracker
25
35
 
@@ -71,12 +81,7 @@ class StartFlowCommand(Command):
71
81
  original_stack = original_tracker.stack
72
82
  applied_events: List[Event] = []
73
83
 
74
- if self.flow in user_flows_on_the_stack(stack):
75
- structlogger.debug(
76
- "start_flow_command.skip_command.already_started_flow", command=self
77
- )
78
- return []
79
- elif self.flow not in all_flows.flow_ids:
84
+ if self.flow not in all_flows.flow_ids:
80
85
  structlogger.debug(
81
86
  "start_flow_command.skip_command.start_invalid_flow_id", command=self
82
87
  )
@@ -87,9 +92,47 @@ class StartFlowCommand(Command):
87
92
  original_user_frame.flow(all_flows) if original_user_frame else None
88
93
  )
89
94
 
95
+ # if the original top flow is the same as the flow to start, the flow is
96
+ # already active, do nothing
97
+ if original_top_flow is not None and original_top_flow.id == self.flow:
98
+ # in case continue_interrupted is not active, skip the already active start
99
+ # flow command
100
+ if not is_continue_interrupted_flow_active(stack):
101
+ return []
102
+
103
+ # if the continue interrupted flow is active, and the command generator
104
+ # predicted a start flow command for the flow which is on top of the stack,
105
+ # we just need to remove the pattern_continue_interrupted frame(s) from the
106
+ # stack
107
+ stack = remove_pattern_continue_interrupted_frames(stack)
108
+ return applied_events + tracker.create_stack_updated_events(stack)
109
+
110
+ # if the flow is already on the stack, resume it
111
+ if (
112
+ self.flow in user_flows_on_the_stack(stack)
113
+ and original_user_frame is not None
114
+ ):
115
+ # if pattern_continue_interrupted is active, we need to remove it
116
+ # from the stack before resuming the flow
117
+ stack = remove_pattern_continue_interrupted_frames(stack)
118
+ applied_events.extend(resume_flow(self.flow, tracker, stack))
119
+ # the current active flow is interrupted
120
+ applied_events.append(
121
+ FlowInterrupted(
122
+ original_user_frame.flow_id, original_user_frame.step_id
123
+ )
124
+ )
125
+ return applied_events
126
+
90
127
  frame_type = FlowStackFrameType.REGULAR
91
128
 
129
+ # remove the pattern_continue_interrupted frames from the stack
130
+ # if it is currently active but the user digressed from the pattern
131
+ stack = remove_pattern_continue_interrupted_frames(stack)
132
+
92
133
  if original_top_flow:
134
+ # if the original top flow is not the same as the flow to start,
135
+ # interrupt the current active flow
93
136
  frame_type = FlowStackFrameType.INTERRUPT
94
137
 
95
138
  if original_user_frame is not None:
@@ -99,6 +142,24 @@ class StartFlowCommand(Command):
99
142
  )
100
143
  )
101
144
 
145
+ # If there is an active agent frame, interrupt it
146
+ active_agent_stack_frame = stack.find_active_agent_frame()
147
+ if active_agent_stack_frame:
148
+ structlogger.debug(
149
+ "start_flow_command.interrupt_agent",
150
+ command=self,
151
+ agent_id=active_agent_stack_frame.agent_id,
152
+ frame_id=active_agent_stack_frame.frame_id,
153
+ flow_id=active_agent_stack_frame.flow_id,
154
+ )
155
+ active_agent_stack_frame.state = AgentState.INTERRUPTED
156
+ applied_events.append(
157
+ AgentInterrupted(
158
+ active_agent_stack_frame.agent_id,
159
+ active_agent_stack_frame.flow_id,
160
+ )
161
+ )
162
+
102
163
  structlogger.debug("start_flow_command.start_flow", command=self)
103
164
  stack.push(UserFlowStackFrame(flow_id=self.flow, frame_type=frame_type))
104
165
  return applied_events + tracker.create_stack_updated_events(stack)
@@ -5,8 +5,23 @@ import structlog
5
5
  from rasa.dialogue_understanding.patterns.validate_slot import (
6
6
  ValidateSlotPatternFlowStackFrame,
7
7
  )
8
+ from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack
9
+ from rasa.dialogue_understanding.stack.frames.dialogue_stack_frame import (
10
+ DialogueStackFrame,
11
+ )
12
+ from rasa.dialogue_understanding.stack.frames.flow_stack_frame import (
13
+ AgentStackFrame,
14
+ FlowStackFrameType,
15
+ UserFlowStackFrame,
16
+ )
17
+ from rasa.dialogue_understanding.stack.frames.pattern_frame import PatternFlowStackFrame
8
18
  from rasa.shared.constants import ACTION_ASK_PREFIX, UTTER_ASK_PREFIX
9
- from rasa.shared.core.events import Event, SlotSet
19
+ from rasa.shared.core.events import (
20
+ AgentResumed,
21
+ Event,
22
+ FlowResumed,
23
+ SlotSet,
24
+ )
10
25
  from rasa.shared.core.flows import FlowsList
11
26
  from rasa.shared.core.slots import Slot
12
27
  from rasa.shared.core.trackers import DialogueStateTracker
@@ -103,7 +118,8 @@ def create_validate_frames_from_slot_set_events(
103
118
  Args:
104
119
  tracker: The dialogue state tracker.
105
120
  events: List of events to process.
106
- should_break: whether or not to break after the first non-SlotSet event.
121
+ validate_frames: List to collect validation frames.
122
+ should_break: whether to break after the first non-SlotSet event.
107
123
  if True, break out of the event loop as soon as the first non-SlotSet
108
124
  event is encountered.
109
125
  if False, continue processing the events until the end.
@@ -150,3 +166,109 @@ def find_default_flows_collecting_slot(
150
166
  for step in flow.get_collect_steps()
151
167
  )
152
168
  ]
169
+
170
+
171
+ def resume_flow(
172
+ flow_to_resume: str,
173
+ tracker: DialogueStateTracker,
174
+ stack: DialogueStack,
175
+ ) -> List[Event]:
176
+ """Resumes a flow by reordering frames."""
177
+ applied_events: List[Event] = []
178
+
179
+ # Resume existing flow by reordering frames
180
+ frames_to_resume, user_frame_to_resume = collect_frames_to_resume(
181
+ stack, flow_to_resume
182
+ )
183
+
184
+ # if the flow is not on the stack, do nothing
185
+ # this should not happen, but just in case
186
+ if user_frame_to_resume is None:
187
+ structlogger.error(
188
+ "resume_flow.no_user_frame_to_resume",
189
+ flow_to_resume=flow_to_resume,
190
+ )
191
+ return []
192
+
193
+ # move the frames to the top of the stack, e.g. reorder the frames
194
+ # on the stack
195
+ stack.move_frames_to_top(frames_to_resume)
196
+
197
+ # create agent resumed events if the agent frame is now on top of the stack
198
+ agent_stack_frame = next(
199
+ (frame for frame in frames_to_resume if isinstance(frame, AgentStackFrame)),
200
+ None,
201
+ )
202
+ if agent_stack_frame:
203
+ agent_id = agent_stack_frame.agent_id
204
+ applied_events.append(AgentResumed(agent_id, agent_stack_frame.flow_id))
205
+
206
+ # Create flow interruption and resumption events
207
+ applied_events.extend(
208
+ [
209
+ # the flow, which was on the stack, is resumed
210
+ FlowResumed(user_frame_to_resume.flow_id, user_frame_to_resume.step_id),
211
+ ]
212
+ )
213
+
214
+ return applied_events + tracker.create_stack_updated_events(stack)
215
+
216
+
217
+ def collect_frames_to_resume(
218
+ stack: DialogueStack,
219
+ target_flow_id: str, # pyright: ignore[reportUndefinedVariable]
220
+ ) -> Tuple[List[DialogueStackFrame], Optional[UserFlowStackFrame]]:
221
+ """Collect frames that need to be resumed for the target flow.
222
+
223
+ Args:
224
+ stack: The stack to collect frames from.
225
+ target_flow_id: The ID of the flow to resume.
226
+
227
+ Returns:
228
+ A tuple containing (frames_to_resume, frame_to_resume).
229
+ """
230
+ frames_to_resume: List[DialogueStackFrame] = []
231
+ frame_found = False
232
+ frame_to_resume = None
233
+
234
+ for frame in stack.frames:
235
+ if isinstance(frame, UserFlowStackFrame) and (
236
+ frame.frame_type == FlowStackFrameType.REGULAR
237
+ or frame.frame_type == FlowStackFrameType.INTERRUPT
238
+ ):
239
+ if frame.flow_id == target_flow_id:
240
+ frames_to_resume.append(frame)
241
+ frame_to_resume = frame
242
+ frame_found = True
243
+ continue
244
+ elif frame_found:
245
+ break
246
+
247
+ if frame_found:
248
+ frames_to_resume.append(frame)
249
+
250
+ return list(frames_to_resume), frame_to_resume
251
+
252
+
253
+ def remove_pattern_continue_interrupted_frames(stack: DialogueStack) -> DialogueStack:
254
+ """Remove pattern_continue_interrupted frames from the stack."""
255
+ from rasa.dialogue_understanding.stack.utils import (
256
+ is_continue_interrupted_flow_active,
257
+ )
258
+
259
+ if not is_continue_interrupted_flow_active(stack):
260
+ return stack
261
+
262
+ # remove pattern_continue_interrupted from the stack
263
+ top_frame = stack.top()
264
+ while isinstance(top_frame, PatternFlowStackFrame):
265
+ # If the top frame is a pattern frame, we need to remove it
266
+ # before continuing with the active user flow frame.
267
+ # This prevents the pattern frame
268
+ # from being left on the stack when the flow is started
269
+ # which would prevent pattern_completed to be triggered
270
+ # once the user flow is completed.
271
+ stack.pop()
272
+ top_frame = stack.top()
273
+
274
+ return stack
@@ -9,9 +9,11 @@ from rasa.dialogue_understanding.commands import (
9
9
  ChitChatAnswerCommand,
10
10
  ClarifyCommand,
11
11
  Command,
12
+ ContinueAgentCommand,
12
13
  HumanHandoffCommand,
13
14
  KnowledgeAnswerCommand,
14
15
  RepeatBotMessagesCommand,
16
+ RestartAgentCommand,
15
17
  SetSlotCommand,
16
18
  SkipQuestionCommand,
17
19
  StartFlowCommand,
@@ -34,6 +36,8 @@ DEFAULT_COMMANDS = [
34
36
  HumanHandoffCommand,
35
37
  ClarifyCommand,
36
38
  RepeatBotMessagesCommand,
39
+ ContinueAgentCommand,
40
+ RestartAgentCommand,
37
41
  ]
38
42
 
39
43
 
@@ -7,6 +7,7 @@ from jinja2 import Environment, Template, select_autoescape
7
7
 
8
8
  import rasa.dialogue_understanding.generator.utils
9
9
  import rasa.shared.utils.io
10
+ from rasa.core.available_agents import AvailableAgents
10
11
  from rasa.dialogue_understanding.commands import (
11
12
  Command,
12
13
  SetSlotCommand,
@@ -31,6 +32,7 @@ from rasa.engine.storage.resource import Resource
31
32
  from rasa.engine.storage.storage import ModelStorage
32
33
  from rasa.shared.core.constants import SetSlotExtractor
33
34
  from rasa.shared.core.domain import Domain
35
+ from rasa.shared.core.events import AgentStarted
34
36
  from rasa.shared.core.flows import Flow, FlowsList, FlowStep
35
37
  from rasa.shared.core.flows.steps.collect import CollectInformationFlowStep
36
38
  from rasa.shared.core.slot_mappings import SlotFillingManager
@@ -225,8 +227,7 @@ class LLMBasedCommandGenerator(
225
227
 
226
228
  @lru_cache
227
229
  def compile_template(self, template: str) -> Template:
228
- """
229
- Compile the prompt template and register custom filters.
230
+ """Compile the prompt template and register custom filters.
230
231
 
231
232
  Compiling the template is an expensive operation,
232
233
  so we cache the result.
@@ -361,20 +362,24 @@ class LLMBasedCommandGenerator(
361
362
  )
362
363
 
363
364
  def prepare_flows_for_template(
364
- self, flows: FlowsList, tracker: DialogueStateTracker
365
+ self,
366
+ flows: FlowsList,
367
+ tracker: DialogueStateTracker,
368
+ add_agent_info: bool = False,
365
369
  ) -> List[Dict[str, Any]]:
366
370
  """Format data on available flows for insertion into the prompt template.
367
371
 
368
372
  Args:
369
373
  flows: The flows available to the user.
370
374
  tracker: The tracker containing the current state of the conversation.
375
+ add_agent_info: Whether to add agent info to flows or not.
371
376
 
372
377
  Returns:
373
378
  The inputs for the prompt template.
374
379
  """
375
- result = []
380
+ result: List[Dict[str, Any]] = []
376
381
  for flow in flows.user_flows:
377
- slots_with_info = [
382
+ slots_with_info: List[Dict[str, Any]] = [
378
383
  {
379
384
  "name": q.collect,
380
385
  "description": q.description,
@@ -383,13 +388,46 @@ class LLMBasedCommandGenerator(
383
388
  for q in flow.get_collect_steps()
384
389
  if self.is_extractable(q, tracker)
385
390
  ]
386
- result.append(
387
- {
388
- "name": flow.id,
389
- "description": flow.description,
390
- "slots": slots_with_info,
391
- }
392
- )
391
+
392
+ agent_info: List[Dict[str, Any]] = []
393
+ if add_agent_info:
394
+ # add information about agents that have been started for this flow
395
+ agent_events = [
396
+ event
397
+ for event in tracker.events
398
+ if isinstance(event, AgentStarted) and event.flow_id == flow.id
399
+ ]
400
+ available_agents = [
401
+ AvailableAgents.get_agent_config(event.agent_id)
402
+ for event in agent_events
403
+ ]
404
+ if available_agents:
405
+ agent_info = [
406
+ {
407
+ "name": available_agent.agent.name,
408
+ "description": available_agent.agent.description,
409
+ }
410
+ for available_agent in available_agents
411
+ if available_agent is not None
412
+ ]
413
+
414
+ if agent_info:
415
+ result.append(
416
+ {
417
+ "name": flow.id,
418
+ "description": flow.description,
419
+ "slots": slots_with_info,
420
+ "agent_info": agent_info,
421
+ }
422
+ )
423
+ else:
424
+ result.append(
425
+ {
426
+ "name": flow.id,
427
+ "description": flow.description,
428
+ "slots": slots_with_info,
429
+ }
430
+ )
393
431
  return result
394
432
 
395
433
  @staticmethod
@@ -1,7 +1,7 @@
1
1
  from typing import Any, Dict, List, Optional, Text, Union
2
2
 
3
3
  import structlog
4
- from deprecated import deprecated # type: ignore[import]
4
+ from deprecated import deprecated # type: ignore[import-untyped]
5
5
 
6
6
  from rasa.dialogue_understanding.generator.single_step.single_step_llm_command_generator import ( # noqa: E501
7
7
  SingleStepLLMCommandGenerator,
@@ -2,7 +2,7 @@ import importlib.resources
2
2
  from typing import Any, Dict, List, Optional, Text, Tuple, Union
3
3
 
4
4
  import structlog
5
- from deprecated import deprecated # type: ignore[import]
5
+ from deprecated import deprecated # type: ignore[import-untyped]
6
6
  from jinja2 import Template
7
7
 
8
8
  import rasa.shared.utils.io
@@ -0,0 +1,66 @@
1
+ ## Task Description
2
+ Your task is to analyze the current conversation context and generate a list of actions to start new business processes that we call flows, to extract slots, or respond to small talk and knowledge requests.
3
+
4
+ --
5
+
6
+ ## Available Actions:
7
+ * `start flow flow_name`: Starting a flow. For example, `start flow transfer_money` or `start flow list_contacts`.
8
+ * `set slot slot_name slot_value`: Slot setting. For example, `set slot transfer_money_recipient Freddy`. Can be used to correct and change previously set values. ONLY use slots that are explicitly defined in the flow's slot list.
9
+ * `cancel flow`: Cancelling the current flow.
10
+ * `disambiguate flows flow_name1 flow_name2 ... flow_name_n`: Disambiguate which flow should be started when user input is ambiguous by listing the potential flows as options. For example, `disambiguate flows list_contacts add_contact remove_contact ...` if the user just wrote "contacts".
11
+ * `provide info`: Responding to the user's questions by supplying relevant information, such as answering FAQs or explaining services.
12
+ * `offtopic reply`: Responding to casual or social user messages that are unrelated to any flows, engaging in friendly conversation and addressing off-topic remarks.
13
+ * `hand over`: Handing over to a human, in case the user seems frustrated or explicitly asks to speak to one.
14
+ * `repeat message`: Repeating the last bot message.{% if active_agent %}
15
+ * `continue agent`: Continue the currently active agent {{ active_agent.name }}. This has HIGHEST PRIORITY when an agent is active and the user is responding to agent questions.{% endif %}{% if completed_agents %}
16
+ * `restart agent agent_name`: Restart the agent with the given name, in case the user wants to change some answer to a previous question asked by the agent. For example, `restart agent car_research_agent` if the user changed his mind about the car he wants to buy. ONLY use agents that are listed in the `completed_agents` section.{% endif %}
17
+
18
+ --
19
+
20
+ ## General Tips
21
+ * Do not fill slots with abstract values or placeholders.
22
+ * For categorical slots try to match the user message with allowed slot values. Use "other" if you cannot match it.
23
+ * Set the boolean slots based on the user response. Map positive responses to `True`, and negative to `False`.
24
+ * Always refer to the slot description to determine what information should be extracted and how it should be formatted.
25
+ * For text slots, extract values exactly as provided by the user unless the slot description specifies otherwise. Preserve formatting and avoid rewording, truncation, or making assumptions.
26
+ * ONLY use `set slot` with slots that are explicitly defined in the current flow's slot list. Do NOT create or assume slots that don't exist.
27
+ * Only use information provided by the user.
28
+ * Use clarification in ambiguous cases.
29
+ * Multiple flows can be started. If a user wants to digress into a second flow, you do not need to cancel the current flow.
30
+ * Do not cancel the flow unless the user explicitly requests it.
31
+ * Strictly adhere to the provided action format.
32
+ * ONLY use the exact actions listed above. Do NOT invent new actions like "respond <message>" or any other variations.
33
+ * Focus on the last message and take it one step at a time.
34
+ * Use the previous conversation steps only to aid understanding.{% if active_agent %}
35
+ * When an agent is active, ALWAYS prioritize `continue agent` over `provide info` or `offtopic reply` unless the user is clearly asking something unrelated to the agent's task.{% endif %}{% if completed_agents %}
36
+ * ONLY use `restart agent` with agents that are listed in the `completed_agents` section. Do NOT restart non-existent agents.{% endif %}{% if active_agent or completed_agents %}
37
+ * If you're unsure about agent names, refer to the structured data provided in the `Current State` section.{% endif %}
38
+
39
+ --
40
+
41
+ ## Available Flows and Slots
42
+ Use the following structured data:
43
+ ```json
44
+ {"flows":[{% for flow in available_flows %}{"name":"{{ flow.name }}","description":{{ flow.description | to_json_escaped_string }}{% if flow.agent_info %},"sub-agents":[{% for agent in flow.agent_info %}{"name":"{{ agent.name }}","description":{{ agent.description | to_json_escaped_string }}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}{% if flow.slots %},"slots":[{% for slot in flow.slots %}{"name":"{{ slot.name }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":{{ slot.allowed_values }}{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}
45
+ ```
46
+
47
+ --
48
+
49
+ ## Current State
50
+ {% if current_flow != None %}Use the following structured data:
51
+ ```json
52
+ {"active_flow":{"name":"{{ current_flow }}","current_step":{"requested_slot":"{{ current_slot }}","requested_slot_description":{{ current_slot_description | to_json_escaped_string }}},"slots":[{% for slot in flow_slots %}{"name":"{{ slot.name }}","value":"{{ slot.value }}","type":"{{ slot.type }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":"{{ slot.allowed_values }}"{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}{% if active_agent %},"active_agent":{"name":"{{ active_agent.name }}","description":{{ active_agent.description | to_json_escaped_string }}}{% endif %}{% if completed_agents %},"completed_agents":[{% for agent in completed_agents %}{"name":"{{ agent.name }}","description":{{ agent.description | to_json_escaped_string }}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}
53
+ ```{% else %}
54
+ You are currently not inside any flow.{% endif %}
55
+
56
+ ---
57
+
58
+ ## Conversation History
59
+ {{ current_conversation }}
60
+
61
+ ---
62
+
63
+ ## Task
64
+ Create an action list with one action per line in response to the user's last message: """{{ user_message }}""".
65
+
66
+ Your action list:
@@ -0,0 +1,66 @@
1
+ ## Task Description
2
+ Your task is to analyze the current conversation context and generate a list of actions to start new business processes that we call flows, to extract slots, or respond to small talk and knowledge requests.
3
+
4
+ ---
5
+
6
+ ## Available Flows and Slots
7
+ Use the following structured data:
8
+ ```json
9
+ {"flows":[{% for flow in available_flows %}{"name":"{{ flow.name }}","description":{{ flow.description | to_json_escaped_string }}{% if flow.agent_info %},"sub-agents":[{% for agent in flow.agent_info %}{"name":"{{ agent.name }}","description":{{ agent.description | to_json_escaped_string }}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}{% if flow.slots %},"slots":[{% for slot in flow.slots %}{"name":"{{ slot.name }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":{{ slot.allowed_values }}{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}
10
+ ```
11
+
12
+ ---
13
+
14
+ ## Available Actions:
15
+ * `start flow flow_name`: Starting a flow. For example, `start flow transfer_money` or `start flow list_contacts`.
16
+ * `set slot slot_name slot_value`: Slot setting. For example, `set slot transfer_money_recipient Freddy`. Can be used to correct and change previously set values. ONLY use slots that are explicitly defined in the flow's slot list.
17
+ * `cancel flow`: Cancelling the current flow.
18
+ * `disambiguate flows flow_name1 flow_name2 ... flow_name_n`: Disambiguate which flow should be started when user input is ambiguous by listing the potential flows as options. For example, `disambiguate flows list_contacts add_contact remove_contact ...` if the user just wrote "contacts".
19
+ * `provide info`: Responding to the user's questions by supplying relevant information, such as answering FAQs or explaining services.
20
+ * `offtopic reply`: Responding to casual or social user messages that are unrelated to any flows, engaging in friendly conversation and addressing off-topic remarks.
21
+ * `hand over`: Handing over to a human, in case the user seems frustrated or explicitly asks to speak to one.
22
+ * `repeat message`: Repeating the last bot message.{% if active_agent %}
23
+ * `continue agent`: Continue the currently active agent {{ active_agent.name }}. This has HIGHEST PRIORITY when an agent is active and the user is responding to agent questions.{% endif %}{% if completed_agents %}
24
+ * `restart agent agent_name`: Restart the agent with the given name, in case the user wants to change some answer to a previous question asked by the agent. For example, `restart agent car_research_agent` if the user changed his mind about the car he wants to buy. ONLY use agents that are listed in the `completed_agents` section.{% endif %}
25
+
26
+ ---
27
+
28
+ ## General Tips
29
+ * Do not fill slots with abstract values or placeholders.
30
+ * For categorical slots try to match the user message with allowed slot values. Use "other" if you cannot match it.
31
+ * Set the boolean slots based on the user response. Map positive responses to `True`, and negative to `False`.
32
+ * Extract text slot values exactly as provided by the user. Avoid assumptions, format changes, or partial extractions.
33
+ * ONLY use `set slot` with slots that are explicitly defined in the current flow's slot list. Do NOT create or assume slots that don't exist.
34
+ * Only use information provided by the user.
35
+ * Use clarification in ambiguous cases.
36
+ * Multiple flows can be started. If a user wants to digress into a second flow, you do not need to cancel the current flow.
37
+ * Do not cancel the flow unless the user explicitly requests it.
38
+ * Strictly adhere to the provided action format.
39
+ * ONLY use the exact actions listed above. Do NOT invent new actions like "respond <message>" or any other variations.
40
+ * Focus on the last message and take it one step at a time.
41
+ * Use the previous conversation steps only to aid understanding.{% if active_agent %}
42
+ * When an agent is active, ALWAYS prioritize `continue agent` over `provide info` or `offtopic reply` unless the user is clearly asking something unrelated to the agent's task.{% endif %}{% if completed_agents %}
43
+ * ONLY use `restart agent` with agents that are listed in the `completed_agents` section. Do NOT restart non-existent agents.{% endif %}{% if active_agent or completed_agents %}
44
+ * If you're unsure about agent names, refer to the structured data provided in the `Current State` section.{% endif %}
45
+
46
+ ---
47
+
48
+ ## Current State
49
+ {% if current_flow != None %}
50
+ Use the following structured data:
51
+ ```json
52
+ {"active_flow":{"name":"{{ current_flow }}","current_step":{"requested_slot":"{{ current_slot }}","requested_slot_description":{{ current_slot_description | to_json_escaped_string }}},"slots":[{% for slot in flow_slots %}{"name":"{{ slot.name }}","value":"{{ slot.value }}","type":"{{ slot.type }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":"{{ slot.allowed_values }}"{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}{% if active_agent %},"active_agent":{"name":"{{ active_agent.name }}","description":{{ active_agent.description | to_json_escaped_string }}}{% endif %}{% if completed_agents %},"completed_agents":[{% for agent in completed_agents %}{"name":"{{ agent.name }}","description":{{ agent.description | to_json_escaped_string }}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}
53
+ ```{% else %}
54
+ You are currently not inside any flow.{% endif %}
55
+
56
+ ---
57
+
58
+ ## Conversation History
59
+ {{ current_conversation }}
60
+
61
+ ---
62
+
63
+ ## Task
64
+ Create an action list with one action per line in response to the user's last message: """{{ user_message }}""".
65
+
66
+ Your action list:
@@ -0,0 +1,89 @@
1
+ ## Task Description
2
+ Your task is to analyze the current conversation context and generate a list of actions to start new business processes that we call flows, to extract slots, or respond to off-topic and knowledge requests.
3
+
4
+ ---
5
+
6
+ ## Available Actions:
7
+ * `start flow flow_name`: Start a flow. For example, `start flow transfer_money` or `start flow list_contacts`.
8
+ * `set slot slot_name slot_value`: Set a slot for the active flow. For example, `set slot transfer_money_recipient Freddy`. Can be used to correct and change previously set values. ONLY use slots that are explicitly defined in the flow's slot list.
9
+ * `disambiguate flows flow_name1 flow_name2 ... flow_name_n`: When a message could refer to multiple flows, list the possible flows as options to clarify. Example: `disambiguate flows list_contacts add_contact remove_contact`.
10
+ * `search and reply`: Provide a response from the knowledge base to address the user's inquiry when no flows fit, including domain knowledge, FAQs, and all off-topic or social messages.
11
+ * `cancel flow`: Cancel the current flow if the user requests it.
12
+ * `repeat message`: Repeat the last bot message.{% if active_agent %}
13
+ * `continue agent`: Continue the currently active agent {{ active_agent.name }}. This has HIGHEST PRIORITY when an agent is active and the user is responding to agent questions.{% endif %}{% if completed_agents %}
14
+ * `restart agent agent_name`: Restart the agent with the given name, in case the user wants to change some answer to a previous question asked by the agent. For example, `restart agent car_research_agent` if the user changed his mind about the car he wants to buy. ONLY use agents that are listed in the `completed_agents` section.{% endif %}
15
+
16
+ ---
17
+
18
+ ## General Instructions
19
+ ### Start Flow
20
+ * Only start a flow if the user's message is clear and fully addressed by that flow's description and purpose.
21
+ * Pay close attention to exact wording and scope in the flow description — do not assume or “stretch” the intended use of a flow.
22
+ ### Set Slot
23
+ * Do not fill slots with abstract values or placeholders.
24
+ * For categorical slots, try to match the user message with allowed slot values. Use "other" if you cannot match it.
25
+ * Set the boolean slots based on the user's response. Map positive responses to `True`, and negative to `False`.
26
+ * Extract text slot values exactly as provided by the user. Avoid assumptions, format changes, or partial extractions.
27
+ * ONLY use `set slot` with slots that are explicitly defined in the current flow's slot list. Do NOT create or assume slots that don't exist.
28
+ ### Disambiguate Flows
29
+ * Use `disambiguate flows` when the user's message matches multiple flows and you cannot decide which flow is most appropriate.
30
+ * If the user message is short and not precise enough to start a flow or `search and reply`, disambiguate.
31
+ * If a single flow is a strong/plausible fit, prefer starting that flow directly.
32
+ * If a user's message unambiguously and distinctly matches multiple flows, start all relevant flows at once (rather than disambiguating).
33
+ ### Search and Reply
34
+ * Only start `search and reply` if the user intent is clear.
35
+ * Flow Priority: If you are unsure between starting a flow or `search and reply`, always prioritize starting a flow.
36
+ ### Cancel Flow
37
+ * Do not cancel any flow unless the user explicitly requests it.
38
+ * Multiple flows can be started without cancelling the previous, if the user wants to pursue multiple processes.{% if active_agent or completed_agents %}
39
+ ### Agents{% if active_agent %}
40
+ * When an agent is active, ALWAYS prioritize `continue agent` over `search and reply` unless the user is clearly asking something unrelated to the agent's task.{% endif %}{% if completed_agents %}
41
+ * ONLY use `restart agent` with agents that are listed in the `completed_agents` section. Do NOT restart non-existent agents.{% endif %}
42
+ * If you're unsure about agent names, refer to the structured data provided in the `Current State` section.
43
+ {% endif %}### General Tips
44
+ * Only use information provided by the user.
45
+ * Strictly adhere to the provided action format.
46
+ * ONLY use the exact actions listed above. Do NOT invent new actions like "respond <message>" or any other variations.
47
+ * Focus on the last message and take it one step at a time.
48
+ * Use the previous conversation steps only to aid understanding.
49
+
50
+
51
+ ---
52
+
53
+ ## Decision Rule Table
54
+ | Condition | Action |
55
+ |---------------------------------------------------------------|--------------------|{% if active_agent %}
56
+ | Agent is active and the user is responding to agent questions | continue agent |{% endif %}
57
+ | Flow perfectly matches user's message | start flow |
58
+ | Multiple flows are equally strong, relevant matches | disambiguate flows |
59
+ | User's message is unclear or imprecise | disambiguate flows |
60
+ | No flow fits at all, but knowledge base may help | search and reply |
61
+
62
+ ---
63
+
64
+ ## Available Flows and Slots
65
+ Use the following structured data:
66
+ ```json
67
+ {"flows":[{% for flow in available_flows %}{"name":"{{ flow.name }}","description":{{ flow.description | to_json_escaped_string }}{% if flow.agent_info %},"sub-agents":[{% for agent in flow.agent_info %}{"name":"{{ agent.name }}","description":{{ agent.description | to_json_escaped_string }}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}{% if flow.slots %},"slots":[{% for slot in flow.slots %}{"name":"{{ slot.name }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":{{ slot.allowed_values }}{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Current State
73
+ {% if current_flow != None %}Use the following structured data:
74
+ ```json
75
+ {"active_flow":{"name":"{{ current_flow }}","current_step":{"requested_slot":"{{ current_slot }}","requested_slot_description":{{ current_slot_description | to_json_escaped_string }}},"slots":[{% for slot in flow_slots %}{"name":"{{ slot.name }}","value":"{{ slot.value }}","type":"{{ slot.type }}"{% if slot.description %},"description":{{ slot.description | to_json_escaped_string }}{% endif %}{% if slot.allowed_values %},"allowed_values":"{{ slot.allowed_values }}"{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]}{% if active_agent %},"active_agent":{"name":"{{ active_agent.name }}","description":{{ active_agent.description | to_json_escaped_string }}}{% endif %}{% if completed_agents %},"completed_agents":[{% for agent in completed_agents %}{"name":"{{ agent.name }}","description":{{ agent.description | to_json_escaped_string }}}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}
76
+ ```{% else %}
77
+ You are currently not inside any flow.{% endif %}
78
+
79
+ ---
80
+
81
+ ## Conversation History
82
+ {{ current_conversation }}
83
+
84
+ ---
85
+
86
+ ## Task
87
+ Create an action list with one action per line in response to the user's last message: """{{ user_message }}""".
88
+
89
+ Your action list: