rasa-pro 3.13.7__py3-none-any.whl → 3.14.0.dev1__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.
- rasa/agents/__init__.py +0 -0
- rasa/agents/agent_factory.py +122 -0
- rasa/agents/agent_manager.py +162 -0
- rasa/agents/constants.py +31 -0
- rasa/agents/core/__init__.py +0 -0
- rasa/agents/core/agent_protocol.py +108 -0
- rasa/agents/core/types.py +70 -0
- rasa/agents/exceptions.py +8 -0
- rasa/agents/protocol/__init__.py +5 -0
- rasa/agents/protocol/a2a/__init__.py +0 -0
- rasa/agents/protocol/a2a/a2a_agent.py +51 -0
- rasa/agents/protocol/mcp/__init__.py +0 -0
- rasa/agents/protocol/mcp/mcp_base_agent.py +697 -0
- rasa/agents/protocol/mcp/mcp_open_agent.py +275 -0
- rasa/agents/protocol/mcp/mcp_task_agent.py +447 -0
- rasa/agents/schemas/__init__.py +6 -0
- rasa/agents/schemas/agent_input.py +24 -0
- rasa/agents/schemas/agent_output.py +26 -0
- rasa/agents/schemas/agent_tool_result.py +51 -0
- rasa/agents/schemas/agent_tool_schema.py +112 -0
- rasa/agents/templates/__init__.py +0 -0
- rasa/agents/templates/mcp_open_agent_prompt_template.jinja2 +15 -0
- rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +13 -0
- rasa/agents/utils.py +72 -0
- rasa/api.py +5 -0
- rasa/cli/arguments/default_arguments.py +12 -0
- rasa/cli/arguments/run.py +2 -0
- rasa/cli/dialogue_understanding_test.py +4 -0
- rasa/cli/e2e_test.py +4 -0
- rasa/cli/inspect.py +3 -0
- rasa/cli/llm_fine_tuning.py +5 -0
- rasa/cli/run.py +4 -0
- rasa/cli/shell.py +3 -0
- rasa/cli/train.py +2 -2
- rasa/constants.py +6 -0
- rasa/core/actions/action.py +69 -39
- rasa/core/actions/action_run_slot_rejections.py +1 -1
- rasa/core/agent.py +16 -0
- rasa/core/available_agents.py +196 -0
- rasa/core/available_endpoints.py +30 -0
- rasa/core/channels/development_inspector.py +47 -14
- rasa/core/channels/inspector/dist/assets/{arc-0b11fe30.js → arc-2e78c586.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-9eef30a7.js → blockDiagram-38ab4fdb-806b712e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-03e94f28.js → c4Diagram-3d4e48cf-0745efa9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-c436ca7c.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-95c09eba.js → classDiagram-70f12bd4-7bd1082b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-38e8446c.js → classDiagram-v2-f2320105-d937ba49.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-50dd656b.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-57dc3038.js → createText-2e5e7dd3-a2a564ca.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-4bac0545.js → edges-e0da2a9e-b5256940.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-81795c90.js → erDiagram-9861fffd-e6883ad2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-89489ae6.js → flowDb-956e92f1-e576fc02.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-cd152627.js → flowDiagram-66a62f08-2e298d01.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-2b2aeaf8.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-3da369bc.js → flowchart-elk-definition-4a651766-dd7b150a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-85ec16f8.js → ganttDiagram-c361ad54-5b79575c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-495bc140.js → gitGraphDiagram-72cf32ee-3016f40a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-1ec4d266.js → graph-3e19170f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/index-1bd9135e.js +1353 -0
- rasa/core/channels/inspector/dist/assets/{index-3862675e-0a0e97c9.js → index-3862675e-eb9c86de.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-4d54bcde.js → infoDiagram-f8f76790-b4280e4d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-dc097114.js → journeyDiagram-49397b02-556091f8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-1a08981e.js → layout-08436411.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-95f7f1d3.js → line-683c4f3b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-97e69543.js → linear-cee6d791.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-8c71ff03.js → mindmap-definition-fc14e90a-a0bf0b1a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-f14c71c7.js → pieDiagram-8a3498a8-3730d5c4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-f1d3c9ff.js → quadrantDiagram-120e2f19-12a20fed.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-bfa2412f.js → requirementDiagram-deff3bca-b9732102.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-53f2c97b.js → sankeyDiagram-04a897e0-a2e72776.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-319d7c0e.js → sequenceDiagram-704730f1-8b7a76bb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-76a09418.js → stateDiagram-587899a1-e65853ac.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-a67f15d4.js → stateDiagram-v2-d93cdb3a-6f58a44b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-0654e7c3.js → styles-6aaf32cf-df25b934.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-1394bb9d.js → styles-9a916d00-88357141.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-e4c5bdae.js → styles-c10674c1-d600174d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-50957104.js → svgDrawCommon-08f97a94-4adc3e0b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-b0885a6a.js → timeline-definition-85554ec2-42816fa1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-79e6541a.js → xychartDiagram-e933f94c-621eb66a.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +2 -2
- rasa/core/channels/inspector/index.html +1 -1
- rasa/core/channels/inspector/src/App.tsx +53 -7
- rasa/core/channels/inspector/src/components/Chat.tsx +3 -2
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +1 -1
- rasa/core/channels/inspector/src/components/DialogueStack.tsx +7 -5
- rasa/core/channels/inspector/src/components/LatencyDisplay.tsx +268 -0
- rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +6 -2
- rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +8 -3
- rasa/core/channels/inspector/src/helpers/formatters.ts +24 -3
- rasa/core/channels/inspector/src/theme/base/styles.ts +19 -1
- rasa/core/channels/inspector/src/types.ts +12 -0
- rasa/core/channels/studio_chat.py +125 -34
- rasa/core/channels/voice_ready/twilio_voice.py +1 -1
- rasa/core/channels/voice_stream/audiocodes.py +9 -6
- rasa/core/channels/voice_stream/browser_audio.py +39 -4
- rasa/core/channels/voice_stream/call_state.py +13 -2
- rasa/core/channels/voice_stream/genesys.py +16 -13
- rasa/core/channels/voice_stream/jambonz.py +13 -11
- rasa/core/channels/voice_stream/twilio_media_streams.py +14 -13
- rasa/core/channels/voice_stream/util.py +11 -1
- rasa/core/channels/voice_stream/voice_channel.py +101 -29
- rasa/core/constants.py +4 -0
- rasa/core/nlg/contextual_response_rephraser.py +11 -7
- rasa/core/nlg/generator.py +21 -5
- rasa/core/nlg/response.py +43 -6
- rasa/core/nlg/translate.py +8 -0
- rasa/core/policies/enterprise_search_policy.py +4 -2
- rasa/core/policies/flow_policy.py +2 -2
- rasa/core/policies/flows/flow_executor.py +374 -35
- rasa/core/policies/flows/mcp_tool_executor.py +240 -0
- rasa/core/processor.py +6 -1
- rasa/core/run.py +8 -1
- rasa/core/utils.py +21 -1
- rasa/dialogue_understanding/commands/__init__.py +8 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +97 -4
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +11 -0
- rasa/dialogue_understanding/commands/continue_agent_command.py +91 -0
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +11 -0
- rasa/dialogue_understanding/commands/restart_agent_command.py +146 -0
- rasa/dialogue_understanding/commands/start_flow_command.py +129 -8
- rasa/dialogue_understanding/commands/utils.py +6 -2
- rasa/dialogue_understanding/generator/command_parser.py +4 -0
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +50 -12
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +61 -0
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +61 -0
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +81 -0
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +81 -0
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +7 -6
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +7 -6
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +41 -2
- rasa/dialogue_understanding/patterns/continue_interrupted.py +163 -1
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +51 -7
- rasa/dialogue_understanding/stack/dialogue_stack.py +123 -2
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +57 -0
- rasa/dialogue_understanding/stack/utils.py +3 -2
- rasa/dialogue_understanding_test/du_test_runner.py +7 -2
- rasa/dialogue_understanding_test/du_test_schema.yml +3 -3
- rasa/e2e_test/e2e_test_runner.py +5 -0
- rasa/e2e_test/e2e_test_schema.yml +3 -3
- rasa/model_manager/model_api.py +1 -1
- rasa/model_manager/socket_bridge.py +8 -2
- rasa/server.py +10 -0
- rasa/shared/agents/__init__.py +0 -0
- rasa/shared/agents/utils.py +35 -0
- rasa/shared/constants.py +5 -0
- rasa/shared/core/constants.py +12 -1
- rasa/shared/core/domain.py +5 -5
- rasa/shared/core/events.py +319 -0
- rasa/shared/core/flows/flows_list.py +2 -2
- rasa/shared/core/flows/flows_yaml_schema.json +101 -186
- rasa/shared/core/flows/steps/call.py +51 -5
- rasa/shared/core/flows/validation.py +45 -7
- rasa/shared/core/flows/yaml_flows_io.py +3 -3
- rasa/shared/providers/llm/_base_litellm_client.py +39 -7
- rasa/shared/providers/llm/litellm_router_llm_client.py +8 -4
- rasa/shared/providers/llm/llm_client.py +7 -3
- rasa/shared/providers/llm/llm_response.py +49 -0
- rasa/shared/providers/llm/self_hosted_llm_client.py +8 -4
- rasa/shared/utils/common.py +2 -1
- rasa/shared/utils/llm.py +28 -5
- rasa/shared/utils/mcp/__init__.py +0 -0
- rasa/shared/utils/mcp/server_connection.py +157 -0
- rasa/shared/utils/schemas/events.py +42 -0
- rasa/studio/upload.py +4 -7
- rasa/tracing/instrumentation/instrumentation.py +4 -2
- rasa/utils/common.py +53 -0
- rasa/utils/licensing.py +21 -10
- rasa/utils/plotting.py +1 -1
- rasa/version.py +1 -1
- {rasa_pro-3.13.7.dist-info → rasa_pro-3.14.0.dev1.dist-info}/METADATA +16 -15
- {rasa_pro-3.13.7.dist-info → rasa_pro-3.14.0.dev1.dist-info}/RECORD +174 -137
- rasa/core/channels/inspector/dist/assets/channel-51d02e9e.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-cc738fa6.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-0c716443.js +0 -1
- rasa/core/channels/inspector/dist/assets/index-c804b295.js +0 -1335
- {rasa_pro-3.13.7.dist-info → rasa_pro-3.14.0.dev1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.7.dist-info → rasa_pro-3.14.0.dev1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.7.dist-info → rasa_pro-3.14.0.dev1.dist-info}/entry_points.txt +0 -0
rasa/shared/core/events.py
CHANGED
|
@@ -2646,6 +2646,325 @@ class FlowCancelled(SkipEventInMDStoryMixin):
|
|
|
2646
2646
|
raise ValueError(f"Failed to parse flow_cancelled event. {e}")
|
|
2647
2647
|
|
|
2648
2648
|
|
|
2649
|
+
class AgentCompleted(SkipEventInMDStoryMixin):
|
|
2650
|
+
"""Mark the completion of an agent."""
|
|
2651
|
+
|
|
2652
|
+
type_name = "agent_completed"
|
|
2653
|
+
|
|
2654
|
+
def __init__(
|
|
2655
|
+
self,
|
|
2656
|
+
agent_id: str,
|
|
2657
|
+
flow_id: str,
|
|
2658
|
+
status: Optional[str] = None,
|
|
2659
|
+
timestamp: Optional[float] = None,
|
|
2660
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
2661
|
+
) -> None:
|
|
2662
|
+
self.agent_id = agent_id
|
|
2663
|
+
self.flow_id = flow_id
|
|
2664
|
+
self.status = status
|
|
2665
|
+
super().__init__(timestamp, metadata)
|
|
2666
|
+
|
|
2667
|
+
def __repr__(self) -> Text:
|
|
2668
|
+
"""Returns event as string for debugging."""
|
|
2669
|
+
return (
|
|
2670
|
+
f"AgentCompleted(agent: {self.agent_id}, flow: {self.flow_id}, "
|
|
2671
|
+
f"status: {self.status})"
|
|
2672
|
+
)
|
|
2673
|
+
|
|
2674
|
+
def __str__(self) -> str:
|
|
2675
|
+
"""Returns event as human-readable string."""
|
|
2676
|
+
return (
|
|
2677
|
+
f"{self.__class__.__name__}({self.agent_id}, {self.flow_id}, {self.status})"
|
|
2678
|
+
)
|
|
2679
|
+
|
|
2680
|
+
def __hash__(self) -> int:
|
|
2681
|
+
"""Returns unique hash for event."""
|
|
2682
|
+
return hash((self.agent_id, self.flow_id, self.status))
|
|
2683
|
+
|
|
2684
|
+
def __eq__(self, other: Any) -> bool:
|
|
2685
|
+
"""Compares object with other object."""
|
|
2686
|
+
if not isinstance(other, AgentCompleted):
|
|
2687
|
+
return NotImplemented
|
|
2688
|
+
return (self.agent_id, self.flow_id, self.status) == (
|
|
2689
|
+
other.agent_id,
|
|
2690
|
+
other.flow_id,
|
|
2691
|
+
other.status,
|
|
2692
|
+
)
|
|
2693
|
+
|
|
2694
|
+
def as_dict(self) -> Dict[str, Any]:
|
|
2695
|
+
"""Returns serialized event."""
|
|
2696
|
+
serialized = super().as_dict()
|
|
2697
|
+
serialized.update(
|
|
2698
|
+
{"agent_id": self.agent_id, "flow_id": self.flow_id, "status": self.status}
|
|
2699
|
+
)
|
|
2700
|
+
return serialized
|
|
2701
|
+
|
|
2702
|
+
@classmethod
|
|
2703
|
+
def _from_parameters(cls, parameters: Dict[str, Any]) -> "AgentCompleted":
|
|
2704
|
+
if "agent_id" not in parameters:
|
|
2705
|
+
raise ValueError(
|
|
2706
|
+
"Failed to parse agent_completed event: agent_id is required"
|
|
2707
|
+
)
|
|
2708
|
+
if "flow_id" not in parameters:
|
|
2709
|
+
raise ValueError(
|
|
2710
|
+
"Failed to parse agent_completed event: flow_id is required"
|
|
2711
|
+
)
|
|
2712
|
+
|
|
2713
|
+
return AgentCompleted(
|
|
2714
|
+
parameters["agent_id"],
|
|
2715
|
+
parameters["flow_id"],
|
|
2716
|
+
parameters.get("status"),
|
|
2717
|
+
parameters.get("timestamp"),
|
|
2718
|
+
parameters.get("metadata"),
|
|
2719
|
+
)
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
class AgentStarted(SkipEventInMDStoryMixin):
|
|
2723
|
+
"""Mark the start of an agent."""
|
|
2724
|
+
|
|
2725
|
+
type_name = "agent_started"
|
|
2726
|
+
|
|
2727
|
+
def __init__(
|
|
2728
|
+
self,
|
|
2729
|
+
agent_id: str,
|
|
2730
|
+
flow_id: str,
|
|
2731
|
+
timestamp: Optional[float] = None,
|
|
2732
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
2733
|
+
) -> None:
|
|
2734
|
+
self.agent_id = agent_id
|
|
2735
|
+
self.flow_id = flow_id
|
|
2736
|
+
super().__init__(timestamp, metadata)
|
|
2737
|
+
|
|
2738
|
+
def __repr__(self) -> str:
|
|
2739
|
+
"""Returns event as string for debugging."""
|
|
2740
|
+
return f"AgentStarted(agent: {self.agent_id}, flow: {self.flow_id})"
|
|
2741
|
+
|
|
2742
|
+
def __str__(self) -> str:
|
|
2743
|
+
"""Returns event as human-readable string."""
|
|
2744
|
+
return f"{self.__class__.__name__}({self.agent_id}, {self.flow_id})"
|
|
2745
|
+
|
|
2746
|
+
def __hash__(self) -> int:
|
|
2747
|
+
"""Returns unique hash for event."""
|
|
2748
|
+
return hash((self.agent_id, self.flow_id))
|
|
2749
|
+
|
|
2750
|
+
def __eq__(self, other: Any) -> bool:
|
|
2751
|
+
"""Compares object with other object."""
|
|
2752
|
+
if not isinstance(other, AgentStarted):
|
|
2753
|
+
return NotImplemented
|
|
2754
|
+
return (self.agent_id, self.flow_id) == (other.agent_id, other.flow_id)
|
|
2755
|
+
|
|
2756
|
+
def as_dict(self) -> Dict[str, Any]:
|
|
2757
|
+
"""Returns serialized event."""
|
|
2758
|
+
serialized = super().as_dict()
|
|
2759
|
+
serialized.update({"agent_id": self.agent_id, "flow_id": self.flow_id})
|
|
2760
|
+
return serialized
|
|
2761
|
+
|
|
2762
|
+
@classmethod
|
|
2763
|
+
def _from_parameters(cls, parameters: Dict[str, Any]) -> "AgentStarted":
|
|
2764
|
+
if "agent_id" not in parameters:
|
|
2765
|
+
raise ValueError(
|
|
2766
|
+
"Failed to parse agent_started event: agent_id is required"
|
|
2767
|
+
)
|
|
2768
|
+
if "flow_id" not in parameters:
|
|
2769
|
+
raise ValueError("Failed to parse agent_started event: flow_id is required")
|
|
2770
|
+
|
|
2771
|
+
return AgentStarted(
|
|
2772
|
+
parameters["agent_id"],
|
|
2773
|
+
parameters["flow_id"],
|
|
2774
|
+
parameters.get("timestamp"),
|
|
2775
|
+
parameters.get("metadata"),
|
|
2776
|
+
)
|
|
2777
|
+
|
|
2778
|
+
|
|
2779
|
+
class AgentInterrupted(SkipEventInMDStoryMixin):
|
|
2780
|
+
"""Mark the interruption of an agent."""
|
|
2781
|
+
|
|
2782
|
+
type_name = "agent_interrupted"
|
|
2783
|
+
|
|
2784
|
+
def __init__(
|
|
2785
|
+
self,
|
|
2786
|
+
agent_id: str,
|
|
2787
|
+
flow_id: str,
|
|
2788
|
+
timestamp: Optional[float] = None,
|
|
2789
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
2790
|
+
) -> None:
|
|
2791
|
+
self.agent_id = agent_id
|
|
2792
|
+
self.flow_id = flow_id
|
|
2793
|
+
super().__init__(timestamp, metadata)
|
|
2794
|
+
|
|
2795
|
+
def __repr__(self) -> str:
|
|
2796
|
+
"""Returns event as string for debugging."""
|
|
2797
|
+
return f"AgentInterrupted(agent: {self.agent_id}, flow: {self.flow_id})"
|
|
2798
|
+
|
|
2799
|
+
def __str__(self) -> str:
|
|
2800
|
+
"""Returns event as human-readable string."""
|
|
2801
|
+
return f"{self.__class__.__name__}({self.agent_id}, {self.flow_id})"
|
|
2802
|
+
|
|
2803
|
+
def __hash__(self) -> int:
|
|
2804
|
+
"""Returns unique hash for event."""
|
|
2805
|
+
return hash((self.agent_id, self.flow_id))
|
|
2806
|
+
|
|
2807
|
+
def __eq__(self, other: Any) -> bool:
|
|
2808
|
+
"""Compares object with other object."""
|
|
2809
|
+
if not isinstance(other, AgentInterrupted):
|
|
2810
|
+
return NotImplemented
|
|
2811
|
+
return (self.agent_id, self.flow_id) == (other.agent_id, other.flow_id)
|
|
2812
|
+
|
|
2813
|
+
def as_dict(self) -> Dict[str, Any]:
|
|
2814
|
+
"""Returns serialized event."""
|
|
2815
|
+
serialized = super().as_dict()
|
|
2816
|
+
serialized.update({"agent_id": self.agent_id, "flow_id": self.flow_id})
|
|
2817
|
+
return serialized
|
|
2818
|
+
|
|
2819
|
+
@classmethod
|
|
2820
|
+
def _from_parameters(cls, parameters: Dict[str, Any]) -> "AgentInterrupted":
|
|
2821
|
+
if "agent_id" not in parameters:
|
|
2822
|
+
raise ValueError(
|
|
2823
|
+
"Failed to parse agent_interrupted event: agent_id is required"
|
|
2824
|
+
)
|
|
2825
|
+
if "flow_id" not in parameters:
|
|
2826
|
+
raise ValueError(
|
|
2827
|
+
"Failed to parse agent_interrupted event: flow_id is required"
|
|
2828
|
+
)
|
|
2829
|
+
|
|
2830
|
+
return AgentInterrupted(
|
|
2831
|
+
parameters["agent_id"],
|
|
2832
|
+
parameters["flow_id"],
|
|
2833
|
+
parameters.get("timestamp"),
|
|
2834
|
+
parameters.get("metadata"),
|
|
2835
|
+
)
|
|
2836
|
+
|
|
2837
|
+
|
|
2838
|
+
class AgentCancelled(SkipEventInMDStoryMixin):
|
|
2839
|
+
"""Mark the cancellation of an agent."""
|
|
2840
|
+
|
|
2841
|
+
type_name = "agent_cancelled"
|
|
2842
|
+
|
|
2843
|
+
def __init__(
|
|
2844
|
+
self,
|
|
2845
|
+
agent_id: str,
|
|
2846
|
+
flow_id: str,
|
|
2847
|
+
reason: Optional[str] = None,
|
|
2848
|
+
timestamp: Optional[float] = None,
|
|
2849
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
2850
|
+
) -> None:
|
|
2851
|
+
self.agent_id = agent_id
|
|
2852
|
+
self.flow_id = flow_id
|
|
2853
|
+
self.reason = reason
|
|
2854
|
+
super().__init__(timestamp, metadata)
|
|
2855
|
+
|
|
2856
|
+
def __repr__(self) -> str:
|
|
2857
|
+
"""Returns event as string for debugging."""
|
|
2858
|
+
return (
|
|
2859
|
+
f"AgentCancelled(agent: {self.agent_id}, flow: {self.flow_id}, "
|
|
2860
|
+
f"reason: {self.reason})"
|
|
2861
|
+
)
|
|
2862
|
+
|
|
2863
|
+
def __str__(self) -> str:
|
|
2864
|
+
"""Returns event as human-readable string."""
|
|
2865
|
+
return (
|
|
2866
|
+
f"{self.__class__.__name__}({self.agent_id}, {self.flow_id}, {self.reason})"
|
|
2867
|
+
)
|
|
2868
|
+
|
|
2869
|
+
def __hash__(self) -> int:
|
|
2870
|
+
"""Returns unique hash for event."""
|
|
2871
|
+
return hash((self.agent_id, self.flow_id, self.reason))
|
|
2872
|
+
|
|
2873
|
+
def __eq__(self, other: Any) -> bool:
|
|
2874
|
+
"""Compares object with other object."""
|
|
2875
|
+
if not isinstance(other, AgentCancelled):
|
|
2876
|
+
return NotImplemented
|
|
2877
|
+
return (self.agent_id, self.flow_id, self.reason) == (
|
|
2878
|
+
other.agent_id,
|
|
2879
|
+
other.flow_id,
|
|
2880
|
+
other.reason,
|
|
2881
|
+
)
|
|
2882
|
+
|
|
2883
|
+
def as_dict(self) -> Dict[str, Any]:
|
|
2884
|
+
"""Returns serialized event."""
|
|
2885
|
+
serialized = super().as_dict()
|
|
2886
|
+
serialized.update(
|
|
2887
|
+
{"agent_id": self.agent_id, "flow_id": self.flow_id, "reason": self.reason}
|
|
2888
|
+
)
|
|
2889
|
+
return serialized
|
|
2890
|
+
|
|
2891
|
+
@classmethod
|
|
2892
|
+
def _from_parameters(cls, parameters: Dict[str, Any]) -> "AgentCancelled":
|
|
2893
|
+
if "agent_id" not in parameters:
|
|
2894
|
+
raise ValueError(
|
|
2895
|
+
"Failed to parse agent_cancelled event: agent_id is required"
|
|
2896
|
+
)
|
|
2897
|
+
if "flow_id" not in parameters:
|
|
2898
|
+
raise ValueError(
|
|
2899
|
+
"Failed to parse agent_cancelled event: flow_id is required"
|
|
2900
|
+
)
|
|
2901
|
+
|
|
2902
|
+
return AgentCancelled(
|
|
2903
|
+
parameters["agent_id"],
|
|
2904
|
+
parameters["flow_id"],
|
|
2905
|
+
parameters.get("reason"),
|
|
2906
|
+
parameters.get("timestamp"),
|
|
2907
|
+
parameters.get("metadata"),
|
|
2908
|
+
)
|
|
2909
|
+
|
|
2910
|
+
|
|
2911
|
+
class AgentResumed(SkipEventInMDStoryMixin):
|
|
2912
|
+
"""Mark the resumption of an agent."""
|
|
2913
|
+
|
|
2914
|
+
type_name = "agent_resumed"
|
|
2915
|
+
|
|
2916
|
+
def __init__(
|
|
2917
|
+
self,
|
|
2918
|
+
agent_id: str,
|
|
2919
|
+
flow_id: str,
|
|
2920
|
+
timestamp: Optional[float] = None,
|
|
2921
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
2922
|
+
) -> None:
|
|
2923
|
+
self.agent_id = agent_id
|
|
2924
|
+
self.flow_id = flow_id
|
|
2925
|
+
super().__init__(timestamp, metadata)
|
|
2926
|
+
|
|
2927
|
+
def __repr__(self) -> str:
|
|
2928
|
+
"""Returns event as string for debugging."""
|
|
2929
|
+
return f"AgentResumed(agent: {self.agent_id}, flow: {self.flow_id})"
|
|
2930
|
+
|
|
2931
|
+
def __str__(self) -> str:
|
|
2932
|
+
"""Returns event as human-readable string."""
|
|
2933
|
+
return f"{self.__class__.__name__}({self.agent_id}, {self.flow_id})"
|
|
2934
|
+
|
|
2935
|
+
def __hash__(self) -> int:
|
|
2936
|
+
"""Returns unique hash for event."""
|
|
2937
|
+
return hash((self.agent_id, self.flow_id))
|
|
2938
|
+
|
|
2939
|
+
def __eq__(self, other: Any) -> bool:
|
|
2940
|
+
"""Compares object with other object."""
|
|
2941
|
+
if not isinstance(other, AgentResumed):
|
|
2942
|
+
return NotImplemented
|
|
2943
|
+
return (self.agent_id, self.flow_id) == (other.agent_id, other.flow_id)
|
|
2944
|
+
|
|
2945
|
+
def as_dict(self) -> Dict[str, Any]:
|
|
2946
|
+
"""Returns serialized event."""
|
|
2947
|
+
serialized = super().as_dict()
|
|
2948
|
+
serialized.update({"agent_id": self.agent_id, "flow_id": self.flow_id})
|
|
2949
|
+
return serialized
|
|
2950
|
+
|
|
2951
|
+
@classmethod
|
|
2952
|
+
def _from_parameters(cls, parameters: Dict[str, Any]) -> "AgentResumed":
|
|
2953
|
+
if "agent_id" not in parameters:
|
|
2954
|
+
raise ValueError(
|
|
2955
|
+
"Failed to parse agent_resumed event: agent_id is required"
|
|
2956
|
+
)
|
|
2957
|
+
if "flow_id" not in parameters:
|
|
2958
|
+
raise ValueError("Failed to parse agent_resumed event: flow_id is required")
|
|
2959
|
+
|
|
2960
|
+
return AgentResumed(
|
|
2961
|
+
parameters["agent_id"],
|
|
2962
|
+
parameters["flow_id"],
|
|
2963
|
+
parameters.get("timestamp"),
|
|
2964
|
+
parameters.get("metadata"),
|
|
2965
|
+
)
|
|
2966
|
+
|
|
2967
|
+
|
|
2649
2968
|
class SessionEnded(AlwaysEqualEventMixin):
|
|
2650
2969
|
"""Mark the end of a conversation session."""
|
|
2651
2970
|
|
|
@@ -9,7 +9,7 @@ from rasa.shared.core.flows import Flow
|
|
|
9
9
|
from rasa.shared.core.flows.flow_path import FlowPathsList
|
|
10
10
|
from rasa.shared.core.flows.validation import (
|
|
11
11
|
DuplicatedFlowIdException,
|
|
12
|
-
|
|
12
|
+
validate_call_steps,
|
|
13
13
|
validate_flow,
|
|
14
14
|
validate_link_in_call_restriction,
|
|
15
15
|
validate_linked_flows_exists,
|
|
@@ -166,7 +166,7 @@ class FlowsList:
|
|
|
166
166
|
validate_flow(flow)
|
|
167
167
|
validate_nlu_trigger(self.underlying_flows)
|
|
168
168
|
validate_link_in_call_restriction(self)
|
|
169
|
-
|
|
169
|
+
validate_call_steps(self)
|
|
170
170
|
validate_linked_flows_exists(self)
|
|
171
171
|
validate_patterns_are_not_called_or_linked(self)
|
|
172
172
|
validate_patterns_are_not_calling_or_linking_other_flows(self)
|