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,13 +0,0 @@
|
|
|
1
|
-
You are a helpful assistant that should assist the user in the best possible way.
|
|
2
|
-
|
|
3
|
-
### Task
|
|
4
|
-
{{ description }}
|
|
5
|
-
|
|
6
|
-
### Instructions
|
|
7
|
-
* Always make sure to output responses to the user in a clear, helpful format.
|
|
8
|
-
* Always avoid asking multiple questions at once. Ask questions sequentially one at a time and wait for the user's response before proceeding to next question.
|
|
9
|
-
* Always avoid making assumptions about what values to pass into tools. Ask for clarification if a user's request is ambiguous.
|
|
10
|
-
* Strictly avoid making up information or ability to take some action which is not available in `tool` provided.
|
|
11
|
-
|
|
12
|
-
### Conversation history
|
|
13
|
-
{{ conversation_history }}
|
rasa/agents/utils.py
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
2
|
-
|
|
3
|
-
from rasa.agents.agent_manager import AgentManager
|
|
4
|
-
from rasa.agents.exceptions import AgentNotFoundException
|
|
5
|
-
from rasa.core.available_agents import (
|
|
6
|
-
AgentConfig,
|
|
7
|
-
AgentMCPServerConfig,
|
|
8
|
-
AvailableAgents,
|
|
9
|
-
)
|
|
10
|
-
from rasa.core.available_endpoints import AvailableEndpoints
|
|
11
|
-
from rasa.shared.agents.utils import get_protocol_type
|
|
12
|
-
from rasa.shared.core.domain import Domain
|
|
13
|
-
from rasa.shared.core.flows import FlowsList
|
|
14
|
-
from rasa.shared.core.flows.steps import CallFlowStep
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def resolve_agent_config(
|
|
18
|
-
agent_config: AgentConfig,
|
|
19
|
-
available_endpoints: AvailableEndpoints,
|
|
20
|
-
) -> Optional[AgentConfig]:
|
|
21
|
-
if agent_config is None:
|
|
22
|
-
return None
|
|
23
|
-
|
|
24
|
-
connections = agent_config.connections
|
|
25
|
-
mcp_connections: List[AgentMCPServerConfig] = (
|
|
26
|
-
connections.mcp_servers
|
|
27
|
-
if connections and connections.mcp_servers is not None
|
|
28
|
-
else []
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
for mcp_server in mcp_connections:
|
|
32
|
-
for mcp_server_endpoint in available_endpoints.mcp_servers or []:
|
|
33
|
-
if mcp_server_endpoint.name == mcp_server.name:
|
|
34
|
-
mcp_server.url = mcp_server_endpoint.url
|
|
35
|
-
mcp_server.type = mcp_server_endpoint.type
|
|
36
|
-
|
|
37
|
-
return agent_config
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
async def initialize_agents(
|
|
41
|
-
flows: FlowsList,
|
|
42
|
-
domain: Domain,
|
|
43
|
-
sub_agents: AvailableAgents,
|
|
44
|
-
) -> None:
|
|
45
|
-
"""Iterate over flows and create/connect the referenced agents."""
|
|
46
|
-
agent_manager: AgentManager = AgentManager()
|
|
47
|
-
endpoints = AvailableEndpoints.get_instance()
|
|
48
|
-
|
|
49
|
-
for flow in flows.underlying_flows:
|
|
50
|
-
for step in flow.steps:
|
|
51
|
-
if isinstance(step, CallFlowStep):
|
|
52
|
-
if flows.flow_by_id(step.call) is not None:
|
|
53
|
-
continue
|
|
54
|
-
|
|
55
|
-
if step.is_calling_mcp_tool():
|
|
56
|
-
# The call step is calling an MCP tool, so we don't need to
|
|
57
|
-
# initialize any agent.
|
|
58
|
-
continue
|
|
59
|
-
|
|
60
|
-
if not step.is_calling_agent():
|
|
61
|
-
raise AgentNotFoundException(step.call)
|
|
62
|
-
|
|
63
|
-
agent_name = step.call
|
|
64
|
-
agent_config = sub_agents.get_agent_config(agent_name)
|
|
65
|
-
resolved_agent_config = resolve_agent_config(agent_config, endpoints)
|
|
66
|
-
protocol_type = get_protocol_type(step, agent_config)
|
|
67
|
-
|
|
68
|
-
await agent_manager.connect_agent(
|
|
69
|
-
agent_name,
|
|
70
|
-
protocol_type,
|
|
71
|
-
resolved_agent_config,
|
|
72
|
-
)
|
rasa/core/available_agents.py
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
from enum import Enum
|
|
5
|
-
from typing import Any, Dict, List, Optional
|
|
6
|
-
|
|
7
|
-
import structlog
|
|
8
|
-
from pydantic import BaseModel, Field, model_validator
|
|
9
|
-
from ruamel import yaml as yaml
|
|
10
|
-
|
|
11
|
-
from rasa.utils.singleton import Singleton
|
|
12
|
-
|
|
13
|
-
DEFAULT_AGENTS_CONFIG_FOLDER = "sub_agents"
|
|
14
|
-
|
|
15
|
-
structlogger = structlog.get_logger()
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class ProtocolConfig(str, Enum):
|
|
19
|
-
"""Supported protocols for agents."""
|
|
20
|
-
|
|
21
|
-
MCP = "MCP"
|
|
22
|
-
A2A = "A2A"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class AgentInfo(BaseModel):
|
|
26
|
-
"""Configuration for an agent."""
|
|
27
|
-
|
|
28
|
-
name: str = Field(..., description="Agent name")
|
|
29
|
-
protocol: ProtocolConfig = Field(
|
|
30
|
-
..., description="Protocol used to communicate with the agent."
|
|
31
|
-
)
|
|
32
|
-
description: str = Field(..., description="Agent description")
|
|
33
|
-
|
|
34
|
-
@model_validator(mode="before")
|
|
35
|
-
@classmethod
|
|
36
|
-
def validate_protocol(cls, values: Any) -> Any:
|
|
37
|
-
"""Validate and normalize protocol values to support lowercase input."""
|
|
38
|
-
if isinstance(values, dict) and "protocol" in values:
|
|
39
|
-
protocol_value = values["protocol"]
|
|
40
|
-
if isinstance(protocol_value, str):
|
|
41
|
-
# Map lowercase protocol names to uppercase enum values
|
|
42
|
-
protocol_mapping = {
|
|
43
|
-
"mcp": ProtocolConfig.MCP,
|
|
44
|
-
"a2a": ProtocolConfig.A2A,
|
|
45
|
-
"MCP": ProtocolConfig.MCP,
|
|
46
|
-
"A2A": ProtocolConfig.A2A,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if protocol_value.lower() in protocol_mapping:
|
|
50
|
-
values["protocol"] = protocol_mapping[protocol_value.lower()]
|
|
51
|
-
else:
|
|
52
|
-
# If it's not a recognized protocol, let Pydantic handle the
|
|
53
|
-
# validation
|
|
54
|
-
# This will raise a proper validation error
|
|
55
|
-
pass
|
|
56
|
-
|
|
57
|
-
return values
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
class AgentConfiguration(BaseModel):
|
|
61
|
-
llm: Optional[Dict[str, Any]] = None
|
|
62
|
-
prompt_template: Optional[str] = None
|
|
63
|
-
module: Optional[str] = None
|
|
64
|
-
timeout: Optional[int] = None # timeout in seconds
|
|
65
|
-
max_retries: Optional[int] = None
|
|
66
|
-
agent_card: Optional[str] = None
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
class AgentConnections(BaseModel):
|
|
70
|
-
mcp_servers: Optional[List[AgentMCPServerConfig]] = None
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
class AgentMCPServerConfig(BaseModel):
|
|
74
|
-
name: str # Reference to MCPServerConfig
|
|
75
|
-
url: Optional[str] = None
|
|
76
|
-
type: Optional[str] = None
|
|
77
|
-
include_tools: Optional[List[str]] = None
|
|
78
|
-
exclude_tools: Optional[List[str]] = None
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
class AgentConfig(BaseModel):
|
|
82
|
-
agent: AgentInfo
|
|
83
|
-
configuration: Optional[AgentConfiguration] = None
|
|
84
|
-
connections: Optional[AgentConnections] = None
|
|
85
|
-
|
|
86
|
-
@model_validator(mode="after")
|
|
87
|
-
def check_agent_config(self) -> AgentConfig:
|
|
88
|
-
protocol = self.agent.protocol if self.agent else None
|
|
89
|
-
if protocol == ProtocolConfig.MCP:
|
|
90
|
-
if self.connections is None or self.connections.mcp_servers is None:
|
|
91
|
-
raise ValueError(
|
|
92
|
-
"For protocol 'MCP', "
|
|
93
|
-
"'mcp_servers' in 'connections' must be provided."
|
|
94
|
-
)
|
|
95
|
-
if protocol == ProtocolConfig.A2A:
|
|
96
|
-
if self.configuration is None or self.configuration.agent_card is None:
|
|
97
|
-
raise ValueError(
|
|
98
|
-
"For protocol 'A2A', "
|
|
99
|
-
"'agent_card' in 'configuration' must be provided."
|
|
100
|
-
)
|
|
101
|
-
return self
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
class AvailableAgents(metaclass=Singleton):
|
|
105
|
-
"""Collection of configured agents."""
|
|
106
|
-
|
|
107
|
-
_instance = None
|
|
108
|
-
|
|
109
|
-
def __init__(self, agents: Optional[Dict[str, AgentConfig]] = None) -> None:
|
|
110
|
-
"""Create an `AvailableAgents` object."""
|
|
111
|
-
self.agents = agents or {}
|
|
112
|
-
|
|
113
|
-
@classmethod
|
|
114
|
-
def _read_agent_folder(cls, agent_folder: str) -> AvailableAgents:
|
|
115
|
-
"""Read the different agents from the given folder."""
|
|
116
|
-
agents: Dict[str, AgentConfig] = {}
|
|
117
|
-
|
|
118
|
-
if not os.path.isdir(agent_folder):
|
|
119
|
-
if agent_folder != DEFAULT_AGENTS_CONFIG_FOLDER:
|
|
120
|
-
# User explicitly specified a folder, it should exist
|
|
121
|
-
structlogger.error(
|
|
122
|
-
f"The specified agents config folder '{agent_folder}' does not "
|
|
123
|
-
f"exist or is not a directory."
|
|
124
|
-
)
|
|
125
|
-
raise ValueError(
|
|
126
|
-
f"The specified agents config folder '{agent_folder}' does not "
|
|
127
|
-
f"exist or is not a directory."
|
|
128
|
-
)
|
|
129
|
-
else:
|
|
130
|
-
# We are using the default folder, it may not be created yet
|
|
131
|
-
# Init with an empty agents in this case
|
|
132
|
-
structlogger.warning(
|
|
133
|
-
f"Default agents config folder '{agent_folder}' does not exist. "
|
|
134
|
-
f"Agent configurations won't be loaded."
|
|
135
|
-
)
|
|
136
|
-
return cls(agents)
|
|
137
|
-
|
|
138
|
-
for agent_name in os.listdir(agent_folder):
|
|
139
|
-
config_path = os.path.join(agent_folder, agent_name, "config.yml")
|
|
140
|
-
if not os.path.isfile(config_path):
|
|
141
|
-
continue
|
|
142
|
-
try:
|
|
143
|
-
agent_config = cls._read_agent_config(config_path)
|
|
144
|
-
if not isinstance(agent_config, AgentConfig):
|
|
145
|
-
raise ValueError(f"Invalid agent config type for {agent_name}")
|
|
146
|
-
agents[agent_config.agent.name] = agent_config
|
|
147
|
-
except Exception as e:
|
|
148
|
-
raise RuntimeError(f"Failed to load agent '{agent_name}': {e}")
|
|
149
|
-
|
|
150
|
-
return cls(agents)
|
|
151
|
-
|
|
152
|
-
@staticmethod
|
|
153
|
-
def _read_agent_config(config_path: str) -> AgentConfig:
|
|
154
|
-
"""Read the agent config from a yaml file."""
|
|
155
|
-
with open(config_path, "r") as f:
|
|
156
|
-
data = yaml.safe_load(f)
|
|
157
|
-
agent_config = AgentConfig(
|
|
158
|
-
agent=AgentInfo(**data.get("agent", {})),
|
|
159
|
-
configuration=AgentConfiguration(**data.get("configuration", {})),
|
|
160
|
-
connections=AgentConnections(**data.get("connections", {})),
|
|
161
|
-
)
|
|
162
|
-
return agent_config
|
|
163
|
-
|
|
164
|
-
@classmethod
|
|
165
|
-
def get_instance(
|
|
166
|
-
cls, agent_folder: Optional[str] = DEFAULT_AGENTS_CONFIG_FOLDER
|
|
167
|
-
) -> AvailableAgents:
|
|
168
|
-
"""Get the singleton instance of `AvailableAgents`."""
|
|
169
|
-
if cls._instance is None:
|
|
170
|
-
cls._instance = cls._read_agent_folder(agent_folder)
|
|
171
|
-
return cls._instance
|
|
172
|
-
|
|
173
|
-
@classmethod
|
|
174
|
-
def reset_instance(cls) -> None:
|
|
175
|
-
cls._instance = None
|
|
176
|
-
|
|
177
|
-
def as_json_list(self) -> List[Dict[str, Any]]:
|
|
178
|
-
"""Convert the available agents to a JSON-serializable list."""
|
|
179
|
-
return [
|
|
180
|
-
{
|
|
181
|
-
"name": agent_name,
|
|
182
|
-
"agent": agent_config.agent.model_dump(),
|
|
183
|
-
"configuration": agent_config.configuration.model_dump()
|
|
184
|
-
if agent_config.configuration
|
|
185
|
-
else None,
|
|
186
|
-
"connections": agent_config.connections.model_dump()
|
|
187
|
-
if agent_config.connections
|
|
188
|
-
else None,
|
|
189
|
-
}
|
|
190
|
-
for agent_name, agent_config in self.agents.items()
|
|
191
|
-
]
|
|
192
|
-
|
|
193
|
-
@classmethod
|
|
194
|
-
def get_agent_config(cls, agent_id: str) -> Optional[AgentConfig]:
|
|
195
|
-
instance = cls.get_instance()
|
|
196
|
-
return instance.agents.get(agent_id)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aI as o,aJ as r}from"./index-1bd9135e.js";const s=(a,n)=>o.lang.round(r.parse(a)[n]),e=s;export{e as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as r}from"./graph-3e19170f.js";var e=4;function a(o){return r(o,e)}export{a as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as e,f as o}from"./flowDb-956e92f1-e576fc02.js";import{f as t,g as a}from"./styles-c10674c1-d600174d.js";import{u as i}from"./index-1bd9135e.js";import"./graph-3e19170f.js";import"./layout-08436411.js";import"./index-3862675e-eb9c86de.js";import"./clone-50dd656b.js";import"./edges-e0da2a9e-b5256940.js";import"./createText-2e5e7dd3-a2a564ca.js";import"./line-683c4f3b.js";import"./array-9f3ba611.js";import"./path-53f90ab3.js";import"./channel-c436ca7c.js";const M={parser:e,db:o,renderer:t,styles:a,init:r=>{r.flowchart||(r.flowchart={}),r.flowchart.arrowMarkerAbsolute=r.arrowMarkerAbsolute,i({flowchart:{arrowMarkerAbsolute:r.arrowMarkerAbsolute}}),t.setConf(r.flowchart),o.clear(),o.setGen("gen-2")}};export{M as diagram};
|