rasa-pro 3.14.0.dev1__py3-none-any.whl → 3.14.0.dev20250818__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/api.py +0 -5
- rasa/cli/arguments/default_arguments.py +0 -12
- rasa/cli/arguments/run.py +0 -2
- rasa/cli/dialogue_understanding_test.py +0 -4
- rasa/cli/e2e_test.py +0 -4
- rasa/cli/inspect.py +0 -3
- rasa/cli/llm_fine_tuning.py +0 -5
- rasa/cli/run.py +0 -4
- rasa/cli/shell.py +0 -3
- rasa/constants.py +0 -6
- rasa/core/actions/action.py +2 -42
- rasa/core/agent.py +0 -16
- rasa/core/available_endpoints.py +0 -30
- rasa/core/channels/inspector/dist/assets/{arc-2e78c586.js → arc-1ddec37b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-806b712e.js → blockDiagram-38ab4fdb-18af387c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-0745efa9.js → c4Diagram-3d4e48cf-250127a3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-59f6d54b.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-7bd1082b.js → classDiagram-70f12bd4-c3388b34.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-d937ba49.js → classDiagram-v2-f2320105-9c893a82.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-26177ddb.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-a2a564ca.js → createText-2e5e7dd3-c111213b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-b5256940.js → edges-e0da2a9e-812a729d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-e6883ad2.js → erDiagram-9861fffd-fd5051bc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-e576fc02.js → flowDb-956e92f1-3287ac02.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-2e298d01.js → flowDiagram-66a62f08-692fb0b2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-29c03f5a.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-dd7b150a.js → flowchart-elk-definition-4a651766-008376f1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-5b79575c.js → ganttDiagram-c361ad54-df330a69.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-3016f40a.js → gitGraphDiagram-72cf32ee-e03676fb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-3e19170f.js → graph-46fad2ba.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-eb9c86de.js → index-3862675e-a484ac55.js} +1 -1
- rasa/core/channels/inspector/dist/assets/index-a003633f.js +1335 -0
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-b4280e4d.js → infoDiagram-f8f76790-3f9e6ec2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-556091f8.js → journeyDiagram-49397b02-79f72383.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-08436411.js → layout-aad098e5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-683c4f3b.js → line-219ab7ae.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-cee6d791.js → linear-2cddbe62.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-a0bf0b1a.js → mindmap-definition-fc14e90a-1d41ed99.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-3730d5c4.js → pieDiagram-8a3498a8-cc496ee8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-12a20fed.js → quadrantDiagram-120e2f19-84d32884.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-b9732102.js → requirementDiagram-deff3bca-c0deb984.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-a2e72776.js → sankeyDiagram-04a897e0-b9d7fd62.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-8b7a76bb.js → sequenceDiagram-704730f1-7d517565.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-e65853ac.js → stateDiagram-587899a1-98ef9b27.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-6f58a44b.js → stateDiagram-v2-d93cdb3a-cee70748.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-df25b934.js → styles-6aaf32cf-3f9d1c96.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-88357141.js → styles-9a916d00-67471923.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-d600174d.js → styles-c10674c1-bd093fb7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-4adc3e0b.js → svgDrawCommon-08f97a94-675794e8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-42816fa1.js → timeline-definition-85554ec2-0ac67617.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-621eb66a.js → xychartDiagram-e933f94c-c018dc37.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/components/DialogueStack.tsx +5 -7
- rasa/core/channels/inspector/src/helpers/formatters.ts +3 -24
- rasa/core/channels/inspector/src/theme/base/styles.ts +1 -19
- rasa/core/channels/inspector/src/types.ts +0 -4
- rasa/core/constants.py +0 -4
- rasa/core/policies/enterprise_search_policy.py +2 -4
- rasa/core/policies/flow_policy.py +2 -2
- rasa/core/policies/flows/flow_executor.py +35 -374
- rasa/core/processor.py +1 -6
- rasa/core/run.py +1 -8
- rasa/core/utils.py +1 -21
- rasa/dialogue_understanding/commands/__init__.py +0 -8
- rasa/dialogue_understanding/commands/cancel_flow_command.py +4 -97
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +0 -11
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +0 -11
- rasa/dialogue_understanding/commands/start_flow_command.py +8 -129
- rasa/dialogue_understanding/commands/utils.py +2 -6
- rasa/dialogue_understanding/generator/command_parser.py +0 -4
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +12 -50
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +6 -7
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +6 -7
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +2 -41
- rasa/dialogue_understanding/patterns/continue_interrupted.py +1 -163
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +7 -51
- rasa/dialogue_understanding/stack/dialogue_stack.py +2 -123
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +0 -57
- rasa/dialogue_understanding/stack/utils.py +2 -3
- rasa/dialogue_understanding_test/du_test_runner.py +2 -7
- rasa/e2e_test/e2e_test_runner.py +0 -5
- rasa/server.py +0 -10
- rasa/shared/constants.py +0 -5
- rasa/shared/core/constants.py +1 -12
- rasa/shared/core/domain.py +5 -5
- rasa/shared/core/events.py +0 -319
- rasa/shared/core/flows/flows_list.py +2 -2
- rasa/shared/core/flows/flows_yaml_schema.json +186 -101
- rasa/shared/core/flows/steps/call.py +5 -51
- rasa/shared/core/flows/validation.py +7 -45
- rasa/shared/core/flows/yaml_flows_io.py +3 -3
- rasa/shared/providers/llm/_base_litellm_client.py +7 -39
- rasa/shared/providers/llm/litellm_router_llm_client.py +4 -8
- rasa/shared/providers/llm/llm_client.py +3 -7
- rasa/shared/providers/llm/llm_response.py +0 -49
- rasa/shared/providers/llm/self_hosted_llm_client.py +4 -8
- rasa/shared/utils/llm.py +5 -28
- rasa/shared/utils/schemas/events.py +0 -42
- rasa/studio/upload.py +7 -4
- rasa/tracing/instrumentation/instrumentation.py +2 -4
- rasa/utils/common.py +0 -53
- rasa/version.py +1 -1
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/METADATA +2 -3
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/RECORD +107 -143
- rasa/agents/__init__.py +0 -0
- rasa/agents/agent_factory.py +0 -122
- rasa/agents/agent_manager.py +0 -162
- rasa/agents/constants.py +0 -31
- rasa/agents/core/__init__.py +0 -0
- rasa/agents/core/agent_protocol.py +0 -108
- rasa/agents/core/types.py +0 -70
- rasa/agents/exceptions.py +0 -8
- rasa/agents/protocol/__init__.py +0 -5
- rasa/agents/protocol/a2a/__init__.py +0 -0
- rasa/agents/protocol/a2a/a2a_agent.py +0 -51
- rasa/agents/protocol/mcp/__init__.py +0 -0
- rasa/agents/protocol/mcp/mcp_base_agent.py +0 -697
- rasa/agents/protocol/mcp/mcp_open_agent.py +0 -275
- rasa/agents/protocol/mcp/mcp_task_agent.py +0 -447
- rasa/agents/schemas/__init__.py +0 -6
- rasa/agents/schemas/agent_input.py +0 -24
- rasa/agents/schemas/agent_output.py +0 -26
- rasa/agents/schemas/agent_tool_result.py +0 -51
- rasa/agents/schemas/agent_tool_schema.py +0 -112
- rasa/agents/templates/__init__.py +0 -0
- rasa/agents/templates/mcp_open_agent_prompt_template.jinja2 +0 -15
- rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +0 -13
- rasa/agents/utils.py +0 -72
- rasa/core/available_agents.py +0 -196
- rasa/core/channels/inspector/dist/assets/channel-c436ca7c.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-50dd656b.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-2b2aeaf8.js +0 -1
- rasa/core/channels/inspector/dist/assets/index-1bd9135e.js +0 -1353
- rasa/core/policies/flows/mcp_tool_executor.py +0 -240
- rasa/dialogue_understanding/commands/continue_agent_command.py +0 -91
- rasa/dialogue_understanding/commands/restart_agent_command.py +0 -146
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +0 -61
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +0 -61
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +0 -81
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +0 -81
- rasa/shared/agents/__init__.py +0 -0
- rasa/shared/agents/utils.py +0 -35
- rasa/shared/utils/mcp/__init__.py +0 -0
- rasa/shared/utils/mcp/server_connection.py +0 -157
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/NOTICE +0 -0
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/WHEEL +0 -0
- {rasa_pro-3.14.0.dev1.dist-info → rasa_pro-3.14.0.dev20250818.dist-info}/entry_points.txt +0 -0
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from typing import Any, Dict, List, Optional
|
|
3
|
-
|
|
4
|
-
import structlog
|
|
5
|
-
from mcp.types import CallToolResult
|
|
6
|
-
|
|
7
|
-
from rasa.core.available_endpoints import AvailableEndpoints
|
|
8
|
-
from rasa.core.policies.flows.flow_step_result import (
|
|
9
|
-
ContinueFlowWithNextStep,
|
|
10
|
-
FlowStepResult,
|
|
11
|
-
)
|
|
12
|
-
from rasa.dialogue_understanding.patterns.internal_error import (
|
|
13
|
-
InternalErrorPatternFlowStackFrame,
|
|
14
|
-
)
|
|
15
|
-
from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack
|
|
16
|
-
from rasa.shared.core.events import Event, SlotSet
|
|
17
|
-
from rasa.shared.core.flows.steps import CallFlowStep
|
|
18
|
-
from rasa.shared.core.trackers import DialogueStateTracker
|
|
19
|
-
from rasa.shared.utils.mcp.server_connection import MCPServerConnection
|
|
20
|
-
|
|
21
|
-
structlogger = structlog.get_logger()
|
|
22
|
-
|
|
23
|
-
SEPARATOR = "\n###\n"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
async def call_mcp_tool(
|
|
27
|
-
initial_events: List[Event],
|
|
28
|
-
stack: DialogueStack,
|
|
29
|
-
step: CallFlowStep,
|
|
30
|
-
tracker: DialogueStateTracker,
|
|
31
|
-
) -> FlowStepResult:
|
|
32
|
-
"""Run an MCP tool call step."""
|
|
33
|
-
structlogger.debug(
|
|
34
|
-
"flow.step.call_mcp_tool",
|
|
35
|
-
tool_id=step.call,
|
|
36
|
-
mcp_server=step.mcp_server,
|
|
37
|
-
mapping=step.mapping,
|
|
38
|
-
step_id=step.id,
|
|
39
|
-
flow_id=step.flow_id,
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
try:
|
|
43
|
-
return await _execute_mcp_tool_call(initial_events, stack, step, tracker)
|
|
44
|
-
except Exception as e:
|
|
45
|
-
return _handle_mcp_tool_error(
|
|
46
|
-
stack,
|
|
47
|
-
initial_events,
|
|
48
|
-
error_message=f"Failed to execute MCP tool call: {e}.",
|
|
49
|
-
tool_name=step.call,
|
|
50
|
-
mcp_server=step.mcp_server,
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
async def _execute_mcp_tool_call(
|
|
55
|
-
initial_events: List[Event],
|
|
56
|
-
stack: DialogueStack,
|
|
57
|
-
step: CallFlowStep,
|
|
58
|
-
tracker: DialogueStateTracker,
|
|
59
|
-
) -> FlowStepResult:
|
|
60
|
-
"""Execute the MCP tool call with proper error handling."""
|
|
61
|
-
mcp_server_connection = None
|
|
62
|
-
try:
|
|
63
|
-
# Connect to the MCP server
|
|
64
|
-
mcp_server_connection = await _connect_to_mcp_server(step.mcp_server)
|
|
65
|
-
|
|
66
|
-
if not mcp_server_connection:
|
|
67
|
-
return _handle_mcp_tool_error(
|
|
68
|
-
stack,
|
|
69
|
-
initial_events,
|
|
70
|
-
f"Cannot connect to MCP server '{step.mcp_server}'.",
|
|
71
|
-
tool_name=step.call,
|
|
72
|
-
mcp_server=step.mcp_server,
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
# Validate tool availability
|
|
76
|
-
if not await _is_tool_available(mcp_server_connection, step.call):
|
|
77
|
-
return _handle_mcp_tool_error(
|
|
78
|
-
stack,
|
|
79
|
-
initial_events,
|
|
80
|
-
f"Tool '{step.call}' is not available on MCP server "
|
|
81
|
-
f"'{step.mcp_server}'.",
|
|
82
|
-
tool_name=step.call,
|
|
83
|
-
mcp_server=step.mcp_server,
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
# This should not happen, but we need to check for type checking to pass
|
|
87
|
-
if not step.mapping:
|
|
88
|
-
return _handle_mcp_tool_error(
|
|
89
|
-
stack,
|
|
90
|
-
initial_events,
|
|
91
|
-
f"No mapping found for tool '{step.call}'.",
|
|
92
|
-
tool_name=step.call,
|
|
93
|
-
mcp_server=step.mcp_server,
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
# Prepare arguments for the tool call
|
|
97
|
-
arguments = _prepare_tool_arguments(step.mapping["input"], tracker)
|
|
98
|
-
|
|
99
|
-
# Call the tool with parameters
|
|
100
|
-
mcp_server = await mcp_server_connection.ensure_active_session()
|
|
101
|
-
result = await mcp_server.call_tool(step.call, arguments)
|
|
102
|
-
|
|
103
|
-
# Handle tool execution result
|
|
104
|
-
if result.isError:
|
|
105
|
-
return _handle_mcp_tool_error(
|
|
106
|
-
stack,
|
|
107
|
-
initial_events,
|
|
108
|
-
f"Tool '{step.call}' execution failed: {result.content}.",
|
|
109
|
-
tool_name=step.call,
|
|
110
|
-
mcp_server=step.mcp_server,
|
|
111
|
-
)
|
|
112
|
-
elif not result.content:
|
|
113
|
-
structlogger.warning(
|
|
114
|
-
"call_mcp_tool.empty_tool_result",
|
|
115
|
-
tool_name=step.call,
|
|
116
|
-
mcp_server=step.mcp_server,
|
|
117
|
-
)
|
|
118
|
-
else:
|
|
119
|
-
structlogger.debug(
|
|
120
|
-
"call_mcp_tool.tool_execution_success",
|
|
121
|
-
tool_name=step.call,
|
|
122
|
-
mcp_server=step.mcp_server,
|
|
123
|
-
result_content=result.content,
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
# Process successful result
|
|
127
|
-
set_slot_event = _process_tool_result(result, step.mapping["output"])
|
|
128
|
-
if set_slot_event:
|
|
129
|
-
initial_events.append(set_slot_event)
|
|
130
|
-
|
|
131
|
-
return ContinueFlowWithNextStep(events=initial_events)
|
|
132
|
-
|
|
133
|
-
finally:
|
|
134
|
-
# Always clean up the connection to prevent resource leaks
|
|
135
|
-
if mcp_server_connection:
|
|
136
|
-
try:
|
|
137
|
-
await mcp_server_connection.close()
|
|
138
|
-
except Exception as e:
|
|
139
|
-
structlogger.warning(
|
|
140
|
-
"call_mcp_tool.connection_cleanup_failed",
|
|
141
|
-
tool_name=step.call,
|
|
142
|
-
mcp_server=step.mcp_server,
|
|
143
|
-
error=str(e),
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
async def _is_tool_available(
|
|
148
|
-
mcp_server_connection: MCPServerConnection, tool_name: str
|
|
149
|
-
) -> bool:
|
|
150
|
-
"""Check if the specified tool is available on the MCP server."""
|
|
151
|
-
try:
|
|
152
|
-
# Get the active session from the connection
|
|
153
|
-
mcp_server = await mcp_server_connection.ensure_active_session()
|
|
154
|
-
available_tools = await mcp_server.list_tools()
|
|
155
|
-
tool_names = [tool.name for tool in available_tools.tools]
|
|
156
|
-
return tool_name in tool_names
|
|
157
|
-
except Exception as e:
|
|
158
|
-
structlogger.warning(
|
|
159
|
-
"call_mcp_tool.tool_availability_check_failed",
|
|
160
|
-
tool_name=tool_name,
|
|
161
|
-
error=str(e),
|
|
162
|
-
)
|
|
163
|
-
return False
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
async def _connect_to_mcp_server(
|
|
167
|
-
mcp_server_name: Optional[str],
|
|
168
|
-
) -> Optional[MCPServerConnection]:
|
|
169
|
-
"""Connect to the MCP server."""
|
|
170
|
-
if not mcp_server_name:
|
|
171
|
-
return None
|
|
172
|
-
|
|
173
|
-
# get the MCP server config from the available endpoints
|
|
174
|
-
endpoints = AvailableEndpoints.get_instance()
|
|
175
|
-
mcp_servers = endpoints.mcp_servers
|
|
176
|
-
if not mcp_servers:
|
|
177
|
-
return None
|
|
178
|
-
|
|
179
|
-
mcp_server_configs = [
|
|
180
|
-
mcp_server for mcp_server in mcp_servers if mcp_server.name == mcp_server_name
|
|
181
|
-
]
|
|
182
|
-
if not mcp_server_configs or len(mcp_server_configs) != 1:
|
|
183
|
-
return None
|
|
184
|
-
|
|
185
|
-
mcp_server_config = mcp_server_configs[0]
|
|
186
|
-
mcp_server_connection = MCPServerConnection(
|
|
187
|
-
mcp_server_config.name, mcp_server_config.url, mcp_server_config.type
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
# Ensure the connection is established and return the connection object
|
|
191
|
-
await mcp_server_connection.ensure_active_session()
|
|
192
|
-
return mcp_server_connection
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
def _prepare_tool_arguments(
|
|
196
|
-
input_mapping: List[Dict[str, str]], tracker: DialogueStateTracker
|
|
197
|
-
) -> Dict[str, Any]:
|
|
198
|
-
"""Prepare arguments for the tool call from slot values."""
|
|
199
|
-
arguments = {}
|
|
200
|
-
for argument in input_mapping:
|
|
201
|
-
slot_value = tracker.get_slot(argument["slot"])
|
|
202
|
-
arguments[argument["param"]] = slot_value
|
|
203
|
-
return arguments
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
def _process_tool_result(
|
|
207
|
-
result: CallToolResult,
|
|
208
|
-
output_mapping: str,
|
|
209
|
-
) -> Optional[SlotSet]:
|
|
210
|
-
"""Create a SetSlot event for the tool result."""
|
|
211
|
-
try:
|
|
212
|
-
content_as_string = [
|
|
213
|
-
json.dumps(content_part.model_dump()) for content_part in result.content
|
|
214
|
-
]
|
|
215
|
-
return SlotSet(key=output_mapping, value=SEPARATOR.join(content_as_string))
|
|
216
|
-
except Exception as e:
|
|
217
|
-
structlogger.error(
|
|
218
|
-
"call_mcp_tool.result_processing_failed",
|
|
219
|
-
error=str(e),
|
|
220
|
-
result=result,
|
|
221
|
-
)
|
|
222
|
-
return None
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
def _handle_mcp_tool_error(
|
|
226
|
-
stack: DialogueStack,
|
|
227
|
-
events: List[Event],
|
|
228
|
-
error_message: str,
|
|
229
|
-
tool_name: str,
|
|
230
|
-
mcp_server: Optional[str],
|
|
231
|
-
) -> FlowStepResult:
|
|
232
|
-
"""Handle MCP tool errors consistently."""
|
|
233
|
-
structlogger.error(
|
|
234
|
-
"call_mcp_tool.error",
|
|
235
|
-
error_message=error_message,
|
|
236
|
-
tool_name=tool_name,
|
|
237
|
-
mcp_server=mcp_server,
|
|
238
|
-
)
|
|
239
|
-
stack.push(InternalErrorPatternFlowStackFrame())
|
|
240
|
-
return ContinueFlowWithNextStep(events=events)
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import re
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
from typing import Any, Dict, List
|
|
6
|
-
|
|
7
|
-
import structlog
|
|
8
|
-
|
|
9
|
-
from rasa.dialogue_understanding.commands.command import Command
|
|
10
|
-
from rasa.dialogue_understanding.commands.command_syntax_manager import (
|
|
11
|
-
CommandSyntaxManager,
|
|
12
|
-
CommandSyntaxVersion,
|
|
13
|
-
)
|
|
14
|
-
from rasa.shared.core.events import Event
|
|
15
|
-
from rasa.shared.core.flows import FlowsList
|
|
16
|
-
from rasa.shared.core.trackers import DialogueStateTracker
|
|
17
|
-
|
|
18
|
-
structlogger = structlog.get_logger()
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@dataclass
|
|
22
|
-
class ContinueAgentCommand(Command):
|
|
23
|
-
"""A command to continue the currently active agent's execution."""
|
|
24
|
-
|
|
25
|
-
@classmethod
|
|
26
|
-
def command(cls) -> str:
|
|
27
|
-
"""Returns the command type."""
|
|
28
|
-
return "continue agent"
|
|
29
|
-
|
|
30
|
-
@classmethod
|
|
31
|
-
def from_dict(cls, data: Dict[str, Any]) -> ContinueAgentCommand:
|
|
32
|
-
"""Converts the dictionary to a command.
|
|
33
|
-
|
|
34
|
-
Returns:
|
|
35
|
-
The converted dictionary.
|
|
36
|
-
"""
|
|
37
|
-
return ContinueAgentCommand()
|
|
38
|
-
|
|
39
|
-
def run_command_on_tracker(
|
|
40
|
-
self,
|
|
41
|
-
tracker: DialogueStateTracker,
|
|
42
|
-
all_flows: FlowsList,
|
|
43
|
-
original_tracker: DialogueStateTracker,
|
|
44
|
-
) -> List[Event]:
|
|
45
|
-
"""Runs the command on the tracker.
|
|
46
|
-
|
|
47
|
-
Args:
|
|
48
|
-
tracker: The tracker to run the command on.
|
|
49
|
-
all_flows: All flows in the assistant.
|
|
50
|
-
original_tracker: The tracker before any command was executed.
|
|
51
|
-
|
|
52
|
-
Returns:
|
|
53
|
-
The events to apply to the tracker.
|
|
54
|
-
"""
|
|
55
|
-
# do nothing
|
|
56
|
-
return []
|
|
57
|
-
|
|
58
|
-
def __hash__(self) -> int:
|
|
59
|
-
return hash(self.command())
|
|
60
|
-
|
|
61
|
-
def __eq__(self, other: object) -> bool:
|
|
62
|
-
return isinstance(other, ContinueAgentCommand)
|
|
63
|
-
|
|
64
|
-
def to_dsl(self) -> str:
|
|
65
|
-
"""Converts the command to a DSL string."""
|
|
66
|
-
mapper = {
|
|
67
|
-
CommandSyntaxVersion.v1: "ContinueAgent()",
|
|
68
|
-
CommandSyntaxVersion.v2: "continue agent",
|
|
69
|
-
CommandSyntaxVersion.v3: "continue agent",
|
|
70
|
-
}
|
|
71
|
-
return mapper.get(
|
|
72
|
-
CommandSyntaxManager.get_syntax_version(),
|
|
73
|
-
mapper[CommandSyntaxManager.get_default_syntax_version()],
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
@classmethod
|
|
77
|
-
def from_dsl(cls, match: re.Match, **kwargs: Any) -> ContinueAgentCommand:
|
|
78
|
-
"""Converts a DSL string to a command."""
|
|
79
|
-
return ContinueAgentCommand()
|
|
80
|
-
|
|
81
|
-
@staticmethod
|
|
82
|
-
def regex_pattern() -> str:
|
|
83
|
-
mapper = {
|
|
84
|
-
CommandSyntaxVersion.v1: r"ContinueAgent\(\)",
|
|
85
|
-
CommandSyntaxVersion.v2: r"""^[\s\W\d]*continue agent['"`]*$""",
|
|
86
|
-
CommandSyntaxVersion.v3: r"""^[\s\W\d]*continue agent['"`]*$""",
|
|
87
|
-
}
|
|
88
|
-
return mapper.get(
|
|
89
|
-
CommandSyntaxManager.get_syntax_version(),
|
|
90
|
-
mapper[CommandSyntaxManager.get_default_syntax_version()],
|
|
91
|
-
)
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import re
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
from typing import Any, Dict, List, Optional
|
|
6
|
-
|
|
7
|
-
from rasa.dialogue_understanding.commands.command import Command
|
|
8
|
-
from rasa.dialogue_understanding.commands.command_syntax_manager import (
|
|
9
|
-
CommandSyntaxManager,
|
|
10
|
-
CommandSyntaxVersion,
|
|
11
|
-
)
|
|
12
|
-
from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack
|
|
13
|
-
from rasa.dialogue_understanding.stack.frames.flow_stack_frame import (
|
|
14
|
-
AgentStackFrame,
|
|
15
|
-
AgentState,
|
|
16
|
-
)
|
|
17
|
-
from rasa.shared.core.events import AgentStarted, Event
|
|
18
|
-
from rasa.shared.core.flows import FlowsList
|
|
19
|
-
from rasa.shared.core.trackers import DialogueStateTracker
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@dataclass
|
|
23
|
-
class RestartAgentCommand(Command):
|
|
24
|
-
"""A command to restart an agentic loop within a flow."""
|
|
25
|
-
|
|
26
|
-
agent_id: str
|
|
27
|
-
|
|
28
|
-
@classmethod
|
|
29
|
-
def command(cls) -> str:
|
|
30
|
-
"""Returns the command type."""
|
|
31
|
-
return "restart agent"
|
|
32
|
-
|
|
33
|
-
@classmethod
|
|
34
|
-
def from_dict(cls, data: Dict[str, Any]) -> RestartAgentCommand:
|
|
35
|
-
"""Converts the dictionary to a command.
|
|
36
|
-
|
|
37
|
-
Returns:
|
|
38
|
-
The converted dictionary.
|
|
39
|
-
"""
|
|
40
|
-
try:
|
|
41
|
-
return RestartAgentCommand(agent_id=data["agent_id"])
|
|
42
|
-
except KeyError as e:
|
|
43
|
-
raise ValueError(
|
|
44
|
-
f"Missing parameter '{e}' while parsing RestartAgentCommand."
|
|
45
|
-
) from e
|
|
46
|
-
|
|
47
|
-
def run_command_on_tracker(
|
|
48
|
-
self,
|
|
49
|
-
tracker: DialogueStateTracker,
|
|
50
|
-
all_flows: FlowsList,
|
|
51
|
-
original_tracker: DialogueStateTracker,
|
|
52
|
-
) -> List[Event]:
|
|
53
|
-
"""Runs the command on the tracker.
|
|
54
|
-
|
|
55
|
-
Args:
|
|
56
|
-
tracker: The tracker to run the command on.
|
|
57
|
-
all_flows: All flows in the assistant.
|
|
58
|
-
original_tracker: The tracker before any command was executed.
|
|
59
|
-
|
|
60
|
-
Returns:
|
|
61
|
-
The events to apply to the tracker.
|
|
62
|
-
"""
|
|
63
|
-
stack = tracker.stack
|
|
64
|
-
|
|
65
|
-
# get the agent flow
|
|
66
|
-
agent_flow_id = self._get_agent_flow(original_tracker)
|
|
67
|
-
|
|
68
|
-
# create a new agent stack frame to restart the agent
|
|
69
|
-
restart_agent_frame = self.create_restart_agent_stack_frame(agent_flow_id)
|
|
70
|
-
|
|
71
|
-
# if the stack contains an agent stack frame with status
|
|
72
|
-
# "waiting for input" update the status to "interrupted"
|
|
73
|
-
self.update_agent_stack_frames_on_stack(stack)
|
|
74
|
-
|
|
75
|
-
# push the stack frame on the top of the stack
|
|
76
|
-
stack.push(restart_agent_frame)
|
|
77
|
-
return tracker.create_stack_updated_events(stack)
|
|
78
|
-
|
|
79
|
-
def __hash__(self) -> int:
|
|
80
|
-
return hash(self.command())
|
|
81
|
-
|
|
82
|
-
def __eq__(self, other: object) -> bool:
|
|
83
|
-
return isinstance(other, RestartAgentCommand)
|
|
84
|
-
|
|
85
|
-
def to_dsl(self) -> str:
|
|
86
|
-
"""Converts the command to a DSL string."""
|
|
87
|
-
mapper = {
|
|
88
|
-
CommandSyntaxVersion.v1: f"RestartAgent({self.agent_id})",
|
|
89
|
-
CommandSyntaxVersion.v2: f"restart agent {self.agent_id}",
|
|
90
|
-
CommandSyntaxVersion.v3: f"restart agent {self.agent_id}",
|
|
91
|
-
}
|
|
92
|
-
return mapper.get(
|
|
93
|
-
CommandSyntaxManager.get_syntax_version(),
|
|
94
|
-
mapper[CommandSyntaxManager.get_default_syntax_version()],
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
@classmethod
|
|
98
|
-
def from_dsl(cls, match: re.Match, **kwargs: Any) -> RestartAgentCommand:
|
|
99
|
-
"""Converts a DSL string to a command."""
|
|
100
|
-
return RestartAgentCommand(agent_id=str(match.group(1).strip()))
|
|
101
|
-
|
|
102
|
-
@staticmethod
|
|
103
|
-
def regex_pattern() -> str:
|
|
104
|
-
mapper = {
|
|
105
|
-
CommandSyntaxVersion.v1: r"RestartAgent\(['\"]?([a-zA-Z0-9_-]+)['\"]?\)",
|
|
106
|
-
CommandSyntaxVersion.v2: (
|
|
107
|
-
r"""^[\s\W\d]*restart agent ['"`]?([a-zA-Z0-9_-]+)['"`]*"""
|
|
108
|
-
),
|
|
109
|
-
CommandSyntaxVersion.v3: (
|
|
110
|
-
r"""^[\s\W\d]*restart agent ['"`]?([a-zA-Z0-9_-]+)['"`]*"""
|
|
111
|
-
),
|
|
112
|
-
}
|
|
113
|
-
return mapper.get(
|
|
114
|
-
CommandSyntaxManager.get_syntax_version(),
|
|
115
|
-
mapper[CommandSyntaxManager.get_default_syntax_version()],
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
def create_restart_agent_stack_frame(self, agent_flow_id: str) -> AgentStackFrame:
|
|
119
|
-
# Create a new AgentStackFrame for restarting the agent
|
|
120
|
-
return AgentStackFrame(
|
|
121
|
-
frame_id=f"restart_agent_{self.agent_id}",
|
|
122
|
-
flow_id=agent_flow_id,
|
|
123
|
-
step_id=f"call_{self.agent_id}",
|
|
124
|
-
agent_id=self.agent_id,
|
|
125
|
-
state=AgentState.WAITING_FOR_INPUT,
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
def update_agent_stack_frames_on_stack(self, stack: DialogueStack) -> None:
|
|
129
|
-
for frame in stack.frames:
|
|
130
|
-
if (
|
|
131
|
-
isinstance(frame, AgentStackFrame)
|
|
132
|
-
and frame.state == AgentState.WAITING_FOR_INPUT
|
|
133
|
-
):
|
|
134
|
-
frame.state = AgentState.INTERRUPTED
|
|
135
|
-
|
|
136
|
-
def _get_agent_flow(self, tracker: DialogueStateTracker) -> Optional[str]:
|
|
137
|
-
# find events associated with the agent
|
|
138
|
-
agent_started_events = [
|
|
139
|
-
event
|
|
140
|
-
for event in tracker.events
|
|
141
|
-
if type(event) == AgentStarted and event.agent_id == self.agent_id
|
|
142
|
-
]
|
|
143
|
-
# take the last one if the agent was started multiple times
|
|
144
|
-
if agent_started_events:
|
|
145
|
-
return agent_started_events[-1].flow_id
|
|
146
|
-
return None
|
|
@@ -1,61 +0,0 @@
|
|
|
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.
|
|
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.
|
|
15
|
-
{% if active_agent %} * `continue agent`: Continue the currently active agent {{ active_agent.name }}.{% endif %}
|
|
16
|
-
{% if completed_agents %}* `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 chnaged his mind about the car he wants to buy.{% 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 information provided by the user.
|
|
27
|
-
* Use clarification in ambiguous cases.
|
|
28
|
-
* Multiple flows can be started. If a user wants to digress into a second flow, you do not need to cancel the current flow.
|
|
29
|
-
* Do not cancel the flow unless the user explicitly requests it.
|
|
30
|
-
* Strictly adhere to the provided action format.
|
|
31
|
-
* Focus on the last message and take it one step at a time.
|
|
32
|
-
* Use the previous conversation steps only to aid understanding.
|
|
33
|
-
|
|
34
|
-
--
|
|
35
|
-
|
|
36
|
-
## Available Flows and Slots
|
|
37
|
-
Use the following structured data:
|
|
38
|
-
```json
|
|
39
|
-
{"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 %}]}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
--
|
|
43
|
-
|
|
44
|
-
## Current State
|
|
45
|
-
{% if current_flow != None %}Use the following structured data:
|
|
46
|
-
```json
|
|
47
|
-
{"active_flow": "{{ 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 or slot.allowed_values else "" }}{% if slot.description %}"description": {{ slot.description | to_json_escaped_string }}{{ "," if slot.allowed_values else "" }}{% endif %}{% if slot.allowed_values %}"allowed_values": "{{ slot.allowed_values }}"{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]{% if active_agent or completed_agents %},{% endif %}{% if active_agent %}"active_agent": {"name": "{{ active_agent.name }}","description": "{{ active_agent.description }}"}{% if completed_agents %},{% endif %}{% endif %}{% if completed_agents %}"completed_agents": [{% for agent in completed_agents %}{"name": "{{ agent.name }}","description": "{{ agent.description }}"}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}
|
|
48
|
-
```{% else %}
|
|
49
|
-
You are currently not inside any flow.{% endif %}
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Conversation History
|
|
54
|
-
{{ current_conversation }}
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Task
|
|
59
|
-
Create an action list with one action per line in response to the user's last message: """{{ user_message }}""".
|
|
60
|
-
|
|
61
|
-
Your action list:
|
|
@@ -1,61 +0,0 @@
|
|
|
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.
|
|
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.
|
|
23
|
-
{% if active_agent %} * `continue agent`: Continue the currently active agent {{ active_agent.name }}.{% endif %}
|
|
24
|
-
{% if completed_agents %}* `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 chnaged his mind about the car he wants to buy.{% 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 information provided by the user.
|
|
34
|
-
* Use clarification in ambiguous cases.
|
|
35
|
-
* Multiple flows can be started. If a user wants to digress into a second flow, you do not need to cancel the current flow.
|
|
36
|
-
* Do not cancel the flow unless the user explicitly requests it.
|
|
37
|
-
* Strictly adhere to the provided action format.
|
|
38
|
-
* Focus on the last message and take it one step at a time.
|
|
39
|
-
* Use the previous conversation steps only to aid understanding.
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Current State
|
|
44
|
-
{% if current_flow != None %}
|
|
45
|
-
Use the following structured data:
|
|
46
|
-
```json
|
|
47
|
-
{"active_flow": "{{ 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 or slot.allowed_values else "" }}{% if slot.description %}"description": {{ slot.description | to_json_escaped_string }}{{ "," if slot.allowed_values else "" }}{% endif %}{% if slot.allowed_values %}"allowed_values": "{{ slot.allowed_values }}"{% endif %}}{% if not loop.last %},{% endif %}{% endfor %}]{% if active_agent or completed_agents %},{% endif %}{% if active_agent %}"active_agent": {"name": "{{ active_agent.name }}","description": "{{ active_agent.description }}"}{% if completed_agents %},{% endif %}{% endif %}{% if completed_agents %}"completed_agents": [{% for agent in completed_agents %}{"name": "{{ agent.name }}","description": "{{ agent.description }}"}{% if not loop.last %},{% endif %}{% endfor %}]{% endif %}}
|
|
48
|
-
```{% else %}
|
|
49
|
-
You are currently not inside any flow.{% endif %}
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Conversation History
|
|
54
|
-
{{ current_conversation }}
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Task
|
|
59
|
-
Create an action list with one action per line in response to the user's last message: """{{ user_message }}""".
|
|
60
|
-
|
|
61
|
-
Your action list:
|