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
@@ -0,0 +1,485 @@
1
+ """Validation functions for agent configurations with reduced redundancies."""
2
+
3
+ import os
4
+ import urllib.parse
5
+ from collections import Counter
6
+ from typing import Any, Dict, List, NoReturn, Set
7
+
8
+ from pydantic import ValidationError as PydanticValidationError
9
+ from ruamel import yaml
10
+
11
+ from rasa.agents.exceptions import (
12
+ AgentNameFlowConflictException,
13
+ DuplicatedAgentNameException,
14
+ )
15
+ from rasa.core.available_agents import (
16
+ DEFAULT_AGENTS_CONFIG_FOLDER,
17
+ AgentConfig,
18
+ AgentConfiguration,
19
+ AgentConnections,
20
+ AgentInfo,
21
+ ProtocolConfig,
22
+ )
23
+ from rasa.core.config.available_endpoints import AvailableEndpoints
24
+ from rasa.core.config.configuration import Configuration
25
+ from rasa.exceptions import ValidationError
26
+
27
+ # Centralized allowed keys configuration to eliminate duplication
28
+ ALLOWED_KEYS = {
29
+ "agent": {"name", "protocol", "description"},
30
+ "configuration": {
31
+ "llm",
32
+ "prompt_template",
33
+ "module",
34
+ "timeout",
35
+ "max_retries",
36
+ "agent_card",
37
+ },
38
+ "connections": {"mcp_servers"},
39
+ }
40
+
41
+
42
+ def validate_agent_names_unique(agents: List[AgentConfig]) -> None:
43
+ """Validate that agent names are unique across all loaded agents.
44
+
45
+ Args:
46
+ agents: List of agent configurations.
47
+
48
+ Raises:
49
+ DuplicatedAgentNameException: If agent names are not unique.
50
+ """
51
+ agent_names = [agent_config.agent.name for agent_config in agents]
52
+ name_counts = Counter(agent_names)
53
+
54
+ duplicated_names = [name for name, count in name_counts.items() if count > 1]
55
+
56
+ if duplicated_names:
57
+ raise DuplicatedAgentNameException(duplicated_names)
58
+
59
+
60
+ def validate_agent_names_not_conflicting_with_flows(
61
+ agents: Dict[str, AgentConfig], flow_names: Set[str]
62
+ ) -> None:
63
+ """Validate that agent names do not conflict with flow names.
64
+
65
+ Args:
66
+ agents: Dictionary of agent configurations.
67
+ flow_names: Set of flow names to check against.
68
+
69
+ Raises:
70
+ AgentNameFlowConflictException: If agent names conflict with flow names.
71
+ """
72
+ conflicting_names = [
73
+ agent_name for agent_name in agents.keys() if agent_name in flow_names
74
+ ]
75
+
76
+ if conflicting_names:
77
+ raise AgentNameFlowConflictException(conflicting_names)
78
+
79
+
80
+ def _validate_mcp_config(agent_config: AgentConfig) -> None:
81
+ """Validate MCP-specific configuration requirements."""
82
+ agent_name = agent_config.agent.name
83
+
84
+ # Check connections.mcp_servers exists
85
+ if agent_config.connections is None or agent_config.connections.mcp_servers is None:
86
+ raise ValidationError(
87
+ code="agent.validation.mcp.missing_connections",
88
+ event_info=f"For protocol 'RASA', agent '{agent_name}' must have "
89
+ "'connections.mcp_servers' configured.",
90
+ )
91
+
92
+ # Check mcp_servers list is not empty
93
+ if not agent_config.connections.mcp_servers:
94
+ raise ValidationError(
95
+ code="agent.validation.mcp.empty_servers_list",
96
+ event_info=f"For protocol 'RASA', agent '{agent_name}' must have "
97
+ "at least one MCP server configured in 'connections.mcp_servers'.",
98
+ )
99
+
100
+ # Validate each MCP server configuration
101
+ for i, server in enumerate(agent_config.connections.mcp_servers):
102
+ if not server.name:
103
+ raise ValidationError(
104
+ code="agent.validation.mcp.server_missing_name",
105
+ event_info=f"For protocol 'RASA', agent '{agent_name}' MCP server "
106
+ f"at index {i} must have a 'name' field.",
107
+ )
108
+
109
+
110
+ def _validate_a2a_config(agent_config: AgentConfig) -> None:
111
+ """Validate A2A-specific configuration requirements."""
112
+ agent_name = agent_config.agent.name
113
+
114
+ # Check configuration.agent_card exists
115
+ if (
116
+ agent_config.configuration is None
117
+ or agent_config.configuration.agent_card is None
118
+ ):
119
+ raise ValidationError(
120
+ code="agent.validation.a2a.missing_agent_card",
121
+ event_info=f"For protocol 'A2A', agent '{agent_name}' must have "
122
+ "'configuration.agent_card' specified.",
123
+ )
124
+
125
+ # Validate agent_card path or URL
126
+ agent_card = agent_config.configuration.agent_card
127
+ if not agent_card:
128
+ raise ValidationError(
129
+ code="agent.validation.a2a.empty_agent_card",
130
+ event_info=f"Agent '{agent_name}' has empty 'agent_card' value",
131
+ )
132
+
133
+ # Check if it's a URL
134
+ parsed_url = urllib.parse.urlparse(agent_card)
135
+ if parsed_url.scheme and parsed_url.netloc:
136
+ # It's a URL, validate format
137
+ if parsed_url.scheme not in ["http", "https"]:
138
+ raise ValidationError(
139
+ code="agent.validation.a2a.invalid_agent_card_url",
140
+ event_info=f"Agent '{agent_name}' has invalid URL scheme "
141
+ f"'{parsed_url.scheme}' for 'agent_card'",
142
+ )
143
+ else:
144
+ # It's a file path, check if it exists
145
+ if not os.path.exists(agent_card):
146
+ raise ValidationError(
147
+ code="agent.validation.a2a.agent_card_file_not_found",
148
+ event_info=f"Agent '{agent_name}' has 'agent_card' file that doesn't "
149
+ f"exist: {agent_card}",
150
+ )
151
+
152
+
153
+ def _validate_optional_keys(agent_config: AgentConfig) -> None:
154
+ """Validate optional keys in agent configuration."""
155
+ agent_name = agent_config.agent.name
156
+
157
+ # Validate prompt_template if present
158
+ if agent_config.configuration and agent_config.configuration.prompt_template:
159
+ prompt_path = agent_config.configuration.prompt_template
160
+ if not os.path.exists(prompt_path):
161
+ raise ValidationError(
162
+ code="agent.validation.optional.prompt_template_not_found",
163
+ event_info=f"Agent '{agent_name}' has prompt template that "
164
+ f"does not exist: {prompt_path}",
165
+ )
166
+
167
+ # Validate module if present
168
+ if agent_config.configuration and agent_config.configuration.module:
169
+ import importlib
170
+
171
+ module_name = agent_config.configuration.module
172
+ try:
173
+ module_path, class_name = module_name.rsplit(".", 1)
174
+ getattr(importlib.import_module(module_path), class_name)
175
+ except (ImportError, AttributeError) as e:
176
+ raise ValidationError(
177
+ code="agent.validation.optional.module_not_found",
178
+ event_info=f"Agent '{agent_name}' has module '{module_name}' "
179
+ f"that could not be imported: {e}",
180
+ )
181
+
182
+
183
+ def _validate_llm_references(
184
+ llm_config: Dict[str, Any],
185
+ endpoints: "AvailableEndpoints",
186
+ agent_name: str,
187
+ ) -> None:
188
+ """Validate LLM configuration references against endpoints."""
189
+ if "model_group" in llm_config:
190
+ from rasa.engine.validation import (
191
+ _validate_component_model_client_config_has_references_to_endpoints,
192
+ )
193
+
194
+ component_config = {"llm": llm_config}
195
+ _validate_component_model_client_config_has_references_to_endpoints(
196
+ component_config, "llm", component_name=agent_name
197
+ )
198
+
199
+
200
+ def _validate_mcp_server_references(
201
+ mcp_servers: list, endpoints: "AvailableEndpoints", agent_name: str
202
+ ) -> None:
203
+ """Validate MCP server references against endpoints."""
204
+ if not endpoints.mcp_servers:
205
+ raise ValidationError(
206
+ code="agent.validation.endpoints.no_mcp_servers",
207
+ event_info=(
208
+ f"Agent '{agent_name}' references MCP servers but no MCP "
209
+ "servers are defined in endpoints.yml."
210
+ ),
211
+ )
212
+
213
+ available_mcp_server_names = [server.name for server in endpoints.mcp_servers]
214
+
215
+ for i, mcp_server in enumerate(mcp_servers):
216
+ server_name = mcp_server.name
217
+ if server_name not in available_mcp_server_names:
218
+ raise ValidationError(
219
+ code="agent.validation.endpoints.invalid_mcp_server",
220
+ event_info=(
221
+ f"MCP server '{server_name}' at index {i} for Agent "
222
+ f"'{agent_name}' does not exist in endpoints.yml. Available MCP "
223
+ f"servers: {', '.join(available_mcp_server_names)}"
224
+ ),
225
+ )
226
+
227
+
228
+ def _handle_pydantic_validation_error(
229
+ error: PydanticValidationError, agent_name: str
230
+ ) -> NoReturn:
231
+ """Handle specific Pydantic validation errors that are actually possible.
232
+
233
+ Args:
234
+ error: The Pydantic validation error to handle
235
+ agent_name: Name of the agent for error messages
236
+ """
237
+ missing_fields = []
238
+ invalid_protocol = False
239
+ type_error = None
240
+
241
+ for pydantic_error in error.errors():
242
+ error_type = pydantic_error["type"]
243
+ field_path = ".".join(str(loc) for loc in pydantic_error["loc"])
244
+
245
+ if error_type == "missing":
246
+ for field in ["name", "protocol", "description"]:
247
+ if field in field_path:
248
+ missing_fields.append(field)
249
+ elif error_type == "enum" and "protocol" in field_path:
250
+ invalid_protocol = True
251
+ elif error_type in ["string_type", "int_parsing"]:
252
+ type_error = (field_path, pydantic_error["msg"])
253
+
254
+ # Handle missing required fields
255
+ if missing_fields:
256
+ raise ValidationError(
257
+ code="agent.validation.mandatory.fields_missing",
258
+ event_info=(
259
+ f"Agent '{agent_name}' is missing required fields "
260
+ f"in agent section: {', '.join(missing_fields)}"
261
+ ),
262
+ )
263
+
264
+ # Handle invalid protocol
265
+ elif invalid_protocol:
266
+ raise ValidationError(
267
+ code="agent.validation.pydantic.invalid_protocol",
268
+ event_info=(
269
+ f"Agent '{agent_name}' has invalid protocol value. "
270
+ "Supported protocols: MCP, A2A"
271
+ ),
272
+ )
273
+
274
+ # Handle type errors
275
+ elif type_error:
276
+ field, msg = type_error
277
+ raise ValidationError(
278
+ code="agent.validation.pydantic.type_error",
279
+ event_info=(
280
+ f"Agent '{agent_name}' has invalid type for field " f"'{field}': {msg}"
281
+ ),
282
+ )
283
+
284
+ # Handle other Pydantic validation errors
285
+ else:
286
+ raise ValidationError(
287
+ code="agent.validation.pydantic.failed",
288
+ event_info=f"Agent '{agent_name}' validation failed: {error}",
289
+ )
290
+
291
+
292
+ def _validate_endpoint_references(agent_config: AgentConfig) -> None:
293
+ """Validate that LLM and MCP server references in agent config are valid."""
294
+ agent_name = agent_config.agent.name
295
+
296
+ # Get available endpoints
297
+ endpoints = Configuration.get_instance().endpoints
298
+
299
+ # Validate LLM configuration references
300
+ if agent_config.configuration and agent_config.configuration.llm:
301
+ _validate_llm_references(agent_config.configuration.llm, endpoints, agent_name)
302
+
303
+ # Validate MCP server references
304
+ if agent_config.connections and agent_config.connections.mcp_servers:
305
+ _validate_mcp_server_references(
306
+ agent_config.connections.mcp_servers, endpoints, agent_name
307
+ )
308
+
309
+
310
+ def _validate_section_keys(
311
+ data: Dict[str, Any], section: str, allowed_keys: set
312
+ ) -> None:
313
+ """Generic function to validate keys in a specific section."""
314
+ if section not in data:
315
+ return
316
+
317
+ section_data = data[section]
318
+ if not isinstance(section_data, dict):
319
+ return
320
+
321
+ additional_keys = set(section_data.keys()) - allowed_keys
322
+ if additional_keys:
323
+ agent_name = data.get("agent", {}).get("name", "unknown")
324
+ raise ValidationError(
325
+ code=f"agent.validation.structure.additional_{section}_keys",
326
+ event_info=(
327
+ f"Agent '{agent_name}' contains additional keys in "
328
+ f"'{section}' section: {', '.join(sorted(additional_keys))}"
329
+ ),
330
+ )
331
+
332
+
333
+ def _validate_mandatory_fields(data: Dict[str, Any], agent_name: str) -> None:
334
+ """Validate that all mandatory fields are present in the agent section."""
335
+ if "agent" not in data:
336
+ raise ValidationError(
337
+ code="agent.validation.mandatory.agent_section_missing",
338
+ event_info=f"Agent '{agent_name}' is missing 'agent' section",
339
+ )
340
+
341
+ agent_data = data["agent"]
342
+ if not isinstance(agent_data, dict):
343
+ raise ValidationError(
344
+ code="agent.validation.mandatory.agent_section_invalid",
345
+ event_info=(
346
+ f"Agent '{agent_name}' has invalid 'agent' section - "
347
+ "must be a dictionary"
348
+ ),
349
+ )
350
+
351
+ # Check for required fields
352
+ missing_fields = []
353
+ for field in ["name", "protocol", "description"]:
354
+ if field not in agent_data or not agent_data[field]:
355
+ missing_fields.append(field)
356
+
357
+ if missing_fields:
358
+ raise ValidationError(
359
+ code="agent.validation.mandatory.fields_missing",
360
+ event_info=(
361
+ f"Agent '{agent_name}' is missing required fields in agent section: "
362
+ f"{', '.join(missing_fields)}"
363
+ ),
364
+ )
365
+
366
+
367
+ def _validate_no_additional_keys_raw_data(data: Dict[str, Any]) -> None:
368
+ """Validate that no additional, unexpected keys are present in the raw data."""
369
+ # Use the generic validation function for each section
370
+ _validate_section_keys(data, "agent", ALLOWED_KEYS["agent"])
371
+ _validate_section_keys(data, "configuration", ALLOWED_KEYS["configuration"])
372
+ _validate_section_keys(data, "connections", ALLOWED_KEYS["connections"])
373
+
374
+
375
+ def _validate_folder_structure(agent_folder: str) -> None:
376
+ """Validate agent folder structure."""
377
+ if not os.path.exists(agent_folder):
378
+ raise ValidationError(
379
+ code="agent.validation.folder.not_found",
380
+ event_info=f"Agent folder does not exist: {agent_folder}",
381
+ )
382
+
383
+ if not os.path.isdir(agent_folder):
384
+ raise ValidationError(
385
+ code="agent.validation.folder.not_directory",
386
+ event_info=f"Agent folder is not a directory: {agent_folder}",
387
+ )
388
+
389
+
390
+ def _validate_config_file_exists(config_path: str, agent_name: str) -> None:
391
+ """Validate config.yml file exists."""
392
+ if not os.path.isfile(config_path):
393
+ raise ValidationError(
394
+ code="agent.validation.folder.missing_config",
395
+ event_info=f"Agent '{agent_name}' is missing 'config.yml' file",
396
+ )
397
+
398
+
399
+ def validate_agent_config(agent_config: AgentConfig) -> None:
400
+ """Validate an agent configuration using all applicable validators."""
401
+ protocol = agent_config.agent.protocol
402
+
403
+ # Run protocol-specific validation
404
+ if protocol == ProtocolConfig.RASA:
405
+ _validate_mcp_config(agent_config)
406
+ elif protocol == ProtocolConfig.A2A:
407
+ _validate_a2a_config(agent_config)
408
+
409
+ # Run optional keys validation
410
+ _validate_optional_keys(agent_config)
411
+
412
+ # Run endpoint references validation
413
+ _validate_endpoint_references(agent_config)
414
+
415
+
416
+ def validate_agent_folder(agent_folder: str = DEFAULT_AGENTS_CONFIG_FOLDER) -> None:
417
+ """Validate all agent configurations in a folder."""
418
+ # Validate folder structure
419
+ _validate_folder_structure(agent_folder)
420
+
421
+ # Scan for agent folders
422
+ for agent_folder_name in os.listdir(agent_folder):
423
+ agent_path = os.path.join(agent_folder, agent_folder_name)
424
+
425
+ if not os.path.isdir(agent_path):
426
+ continue
427
+
428
+ config_path = os.path.join(agent_path, "config.yml")
429
+
430
+ # Validate config file exists
431
+ _validate_config_file_exists(config_path, agent_folder_name)
432
+
433
+ # Read and validate the config content
434
+ try:
435
+ # First read the raw YAML data to validate structure
436
+ with open(config_path, "r") as f:
437
+ data = yaml.safe_load(f)
438
+
439
+ # Validate no additional keys
440
+ _validate_no_additional_keys_raw_data(data)
441
+
442
+ # Validate mandatory fields before creating Pydantic models
443
+ _validate_mandatory_fields(data, agent_folder_name)
444
+
445
+ # Create the agent config using AvailableAgents
446
+ from rasa.core.available_agents import AvailableAgents
447
+
448
+ agent_config = AvailableAgents._read_agent_config(config_path)
449
+
450
+ # Validate the agent config (protocol-specific and endpoint references)
451
+ validate_agent_config(agent_config)
452
+ except PydanticValidationError as e:
453
+ _handle_pydantic_validation_error(e, agent_folder_name)
454
+ except Exception as e:
455
+ # Handle non-Pydantic exceptions
456
+ raise ValidationError(
457
+ code="agent.validation.folder.config_validation_failed",
458
+ event_info=f"Agent '{agent_folder_name}' validation failed: {e}",
459
+ )
460
+
461
+
462
+ def validate_agent_config_data(data: Dict[str, Any]) -> "AgentConfig":
463
+ """Validate agent configuration data."""
464
+ try:
465
+ # Validate no additional keys before creating Pydantic models
466
+ _validate_no_additional_keys_raw_data(data)
467
+
468
+ # Create the agent config (this will trigger Pydantic validation)
469
+ agent_config = AgentConfig(
470
+ agent=AgentInfo(**data.get("agent", {})),
471
+ configuration=AgentConfiguration(**data.get("configuration", {}))
472
+ if data.get("configuration")
473
+ else None,
474
+ connections=AgentConnections(**data.get("connections", {}))
475
+ if data.get("connections")
476
+ else None,
477
+ )
478
+
479
+ return agent_config
480
+
481
+ except PydanticValidationError as e:
482
+ _handle_pydantic_validation_error(e, "Agent configuration")
483
+ except Exception:
484
+ # Re-raise other exceptions
485
+ raise
rasa/api.py CHANGED
@@ -2,6 +2,7 @@ import asyncio
2
2
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Text, Union
3
3
 
4
4
  import rasa.shared.constants
5
+ from rasa.core.config.configuration import Configuration
5
6
  from rasa.core.persistor import StorageType
6
7
 
7
8
  # WARNING: Be careful about adding any top level imports at this place!
@@ -19,30 +20,30 @@ if TYPE_CHECKING:
19
20
 
20
21
  def run(
21
22
  model: Text,
22
- endpoints: Text,
23
+ sub_agents: Text,
23
24
  connector: Optional[Text] = None,
24
- credentials: Optional[Text] = None,
25
25
  **kwargs: Dict[Text, Any],
26
26
  ) -> None:
27
27
  """Runs a Rasa model.
28
28
 
29
29
  Args:
30
30
  model: Path to model archive.
31
- endpoints: Path to endpoints file.
31
+ sub_agents: Path to sub-agents directory.
32
32
  connector: Connector which should be use (overwrites `credentials`
33
33
  field).
34
- credentials: Path to channel credentials file.
35
34
  **kwargs: Additional arguments which are passed to
36
35
  `rasa.core.run.serve_application`.
37
36
 
38
37
  """
39
38
  import rasa.core.run
40
39
  import rasa.shared.utils.common
41
- from rasa.core.available_endpoints import AvailableEndpoints
40
+ from rasa.core.available_agents import AvailableAgents
42
41
  from rasa.shared.constants import DOCS_BASE_URL
43
42
  from rasa.shared.utils.cli import print_warning
44
43
 
45
- _endpoints = AvailableEndpoints.get_instance(endpoints)
44
+ _sub_agents = AvailableAgents.get_instance(sub_agents)
45
+
46
+ credentials = Configuration.get_instance().credentials
46
47
 
47
48
  if not connector and not credentials:
48
49
  connector = "rest"
@@ -56,11 +57,19 @@ def run(
56
57
  kwargs = rasa.shared.utils.common.minimal_kwargs(
57
58
  kwargs, rasa.core.run.serve_application
58
59
  )
60
+
61
+ if "endpoints" in kwargs:
62
+ del kwargs["endpoints"]
63
+
64
+ if "credentials" in kwargs:
65
+ del kwargs["credentials"]
66
+
59
67
  rasa.core.run.serve_application(
60
68
  model,
61
69
  channel=connector,
62
70
  credentials=credentials,
63
- endpoints=_endpoints,
71
+ endpoints=Configuration.get_instance().endpoints,
72
+ sub_agents=_sub_agents,
64
73
  **kwargs,
65
74
  )
66
75
 
@@ -69,25 +78,28 @@ def train(
69
78
  domain: Text,
70
79
  config: Text,
71
80
  training_files: "Union[Text, List[Text]]",
81
+ endpoints: Text = rasa.shared.constants.DEFAULT_ENDPOINTS_PATH,
72
82
  output: Text = rasa.shared.constants.DEFAULT_MODELS_PATH,
73
83
  dry_run: bool = False,
74
84
  force_training: bool = False,
75
- fixed_model_name: Optional[Text] = None,
85
+ fixed_model_name: Optional[str] = None,
76
86
  persist_nlu_training_data: bool = False,
77
87
  core_additional_arguments: Optional[Dict] = None,
78
88
  nlu_additional_arguments: Optional[Dict] = None,
79
- model_to_finetune: Optional[Text] = None,
89
+ model_to_finetune: Optional[str] = None,
80
90
  finetuning_epoch_fraction: float = 1.0,
81
91
  remote_storage: Optional[StorageType] = None,
82
92
  file_importer: Optional["TrainingDataImporter"] = None,
83
93
  keep_local_model_copy: bool = False,
84
94
  remote_root_only: bool = False,
95
+ sub_agents: Optional[str] = None,
85
96
  ) -> "TrainingResult":
86
97
  """Runs Rasa Core and NLU training in `async` loop.
87
98
 
88
99
  Args:
89
100
  domain: Path to the domain file.
90
101
  config: Path to the config for Core and NLU.
102
+ endpoints: Path to the endpoints file.
91
103
  training_files: Paths to the training data for Core and NLU.
92
104
  output: Output path.
93
105
  dry_run: If `True` then no training will be done, and the information about
@@ -111,6 +123,7 @@ def train(
111
123
  remote storage is configured.
112
124
  remote_root_only: If `True`, the model will be stored in the root of the
113
125
  remote model storage.
126
+ sub_agents: Path to sub-agents directory.
114
127
 
115
128
  Returns:
116
129
  An instance of `TrainingResult`.
@@ -122,6 +135,7 @@ def train(
122
135
  domain=domain,
123
136
  config=config,
124
137
  training_files=training_files,
138
+ endpoints=endpoints,
125
139
  output=output,
126
140
  dry_run=dry_run,
127
141
  force_training=force_training,
@@ -135,6 +149,7 @@ def train(
135
149
  file_importer=file_importer,
136
150
  keep_local_model_copy=keep_local_model_copy,
137
151
  remote_root_only=remote_root_only,
152
+ sub_agents=sub_agents,
138
153
  )
139
154
  )
140
155
 
rasa/builder/config.py CHANGED
@@ -42,9 +42,13 @@ COPILOT_ASSISTANT_TRACKER_MAX_TURNS = 10
42
42
  COPILOT_DOCUMENTATION_SEARCH_QUERY_HISTORY_MESSAGES = 5
43
43
 
44
44
  # Guardrail Configuration
45
+ ENABLE_GUARDRAILS_RAW = os.getenv("ENABLE_GUARDRAILS", "false")
46
+ ENABLE_GUARDRAILS = ENABLE_GUARDRAILS_RAW.strip().lower() == "true"
47
+
48
+ # TODO: Replace with Open Source guardrails implementation once it's ready
45
49
  LAKERA_BASE_URL = os.getenv("LAKERA_BASE_URL", "https://api.lakera.ai/v2").rstrip("/")
46
- ASSISTANT_HISTORY_GUARDRAIL_PROJECT_ID = "project-5442154580"
47
- COPILOT_HISTORY_GUARDRAIL_PROJECT_ID = "project-4637497223"
50
+ LAKERA_ASSISTANT_HISTORY_GUARDRAIL_PROJECT_ID = "project-5442154580"
51
+ LAKERA_COPILOT_HISTORY_GUARDRAIL_PROJECT_ID = "project-4637497223"
48
52
 
49
53
  # Guardrails blocking configuration
50
54
  GUARDRAILS_ENABLE_BLOCKING_RAW = os.getenv("GUARDRAILS_ENABLE_BLOCKING", "false")
@@ -6,6 +6,9 @@ COPILOT_PROMPTS_FILE = "copilot_system_prompt.jinja2"
6
6
  COPILOT_LAST_USER_MESSAGE_CONTEXT_PROMPT_FILE = (
7
7
  "latest_user_message_context_prompt.jinja2"
8
8
  )
9
+ COPILOT_TRAINING_ERROR_HANDLER_PROMPT_FILE = (
10
+ "copilot_training_error_handler_prompt.jinja2"
11
+ )
9
12
 
10
13
  # A dot-path for importlib to the rasa internal messages templates
11
14
  COPILOT_MESSAGE_TEMPLATES_DIR = "builder.copilot.templated_messages"
@@ -22,7 +25,7 @@ ROLE_COPILOT: Literal["copilot"] = "copilot"
22
25
 
23
26
  # Rasa internal role - Used to indicate that the message is from the Rasa internal
24
27
  # system components.
25
- ROLE_COPILOT_INTERNAL: Literal["copilot_internal"] = "copilot_internal"
28
+ ROLE_COPILOT_INTERNAL: Literal["internal_copilot_request"] = "internal_copilot_request"
26
29
 
27
30
  # Copilot Telemetry
28
31
  COPILOT_SEGMENT_WRITE_KEY_ENV_VAR = "COPILOT_SEGMENT_WRITE_KEY"