waldiez 0.4.7__py3-none-any.whl → 0.4.9__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 waldiez might be problematic. Click here for more details.
- waldiez/__init__.py +5 -5
- waldiez/_version.py +1 -1
- waldiez/cli.py +97 -102
- waldiez/exporter.py +61 -19
- waldiez/exporting/__init__.py +25 -6
- waldiez/exporting/agent/__init__.py +7 -3
- waldiez/exporting/agent/code_execution.py +114 -0
- waldiez/exporting/agent/exporter.py +354 -0
- waldiez/exporting/agent/extras/__init__.py +15 -0
- waldiez/exporting/agent/extras/captain_agent_extras.py +315 -0
- waldiez/exporting/agent/extras/group/target.py +178 -0
- waldiez/exporting/agent/extras/group_manager_agent_extas.py +500 -0
- waldiez/exporting/agent/extras/group_member_extras.py +181 -0
- waldiez/exporting/agent/extras/handoffs/__init__.py +19 -0
- waldiez/exporting/agent/extras/handoffs/after_work.py +78 -0
- waldiez/exporting/agent/extras/handoffs/available.py +74 -0
- waldiez/exporting/agent/extras/handoffs/condition.py +158 -0
- waldiez/exporting/agent/extras/handoffs/handoff.py +171 -0
- waldiez/exporting/agent/extras/handoffs/target.py +189 -0
- waldiez/exporting/agent/extras/rag/__init__.py +10 -0
- waldiez/exporting/agent/{utils/rag_user/chroma_utils.py → extras/rag/chroma_extras.py} +37 -24
- waldiez/exporting/agent/{utils/rag_user/mongo_utils.py → extras/rag/mongo_extras.py} +10 -10
- waldiez/exporting/agent/{utils/rag_user/pgvector_utils.py → extras/rag/pgvector_extras.py} +13 -13
- waldiez/exporting/agent/{utils/rag_user/qdrant_utils.py → extras/rag/qdrant_extras.py} +13 -13
- waldiez/exporting/agent/{utils/rag_user/vector_db.py → extras/rag/vector_db_extras.py} +59 -46
- waldiez/exporting/agent/extras/rag_user_proxy_agent_extras.py +245 -0
- waldiez/exporting/agent/extras/reasoning_agent_extras.py +88 -0
- waldiez/exporting/agent/factory.py +95 -0
- waldiez/exporting/agent/processor.py +150 -0
- waldiez/exporting/agent/system_message.py +36 -0
- waldiez/exporting/agent/termination.py +50 -0
- waldiez/exporting/chats/__init__.py +7 -3
- waldiez/exporting/chats/exporter.py +97 -0
- waldiez/exporting/chats/factory.py +65 -0
- waldiez/exporting/chats/processor.py +226 -0
- waldiez/exporting/chats/utils/__init__.py +6 -5
- waldiez/exporting/chats/utils/common.py +11 -45
- waldiez/exporting/chats/utils/group.py +55 -0
- waldiez/exporting/chats/utils/nested.py +37 -52
- waldiez/exporting/chats/utils/sequential.py +72 -61
- waldiez/exporting/chats/utils/{single_chat.py → single.py} +48 -50
- waldiez/exporting/core/__init__.py +196 -0
- waldiez/exporting/core/constants.py +17 -0
- waldiez/exporting/core/content.py +69 -0
- waldiez/exporting/core/context.py +244 -0
- waldiez/exporting/core/enums.py +89 -0
- waldiez/exporting/core/errors.py +19 -0
- waldiez/exporting/core/exporter.py +390 -0
- waldiez/exporting/core/exporters.py +67 -0
- waldiez/exporting/core/extras/__init__.py +39 -0
- waldiez/exporting/core/extras/agent_extras/__init__.py +27 -0
- waldiez/exporting/core/extras/agent_extras/captain_extras.py +57 -0
- waldiez/exporting/core/extras/agent_extras/group_manager_extras.py +102 -0
- waldiez/exporting/core/extras/agent_extras/rag_user_extras.py +53 -0
- waldiez/exporting/core/extras/agent_extras/reasoning_extras.py +68 -0
- waldiez/exporting/core/extras/agent_extras/standard_extras.py +263 -0
- waldiez/exporting/core/extras/base.py +241 -0
- waldiez/exporting/core/extras/chat_extras.py +118 -0
- waldiez/exporting/core/extras/flow_extras.py +70 -0
- waldiez/exporting/core/extras/model_extras.py +73 -0
- waldiez/exporting/core/extras/path_resolver.py +93 -0
- waldiez/exporting/core/extras/serializer.py +138 -0
- waldiez/exporting/core/extras/tool_extras.py +82 -0
- waldiez/exporting/core/protocols.py +259 -0
- waldiez/exporting/core/result.py +705 -0
- waldiez/exporting/core/types.py +329 -0
- waldiez/exporting/core/utils/__init__.py +11 -0
- waldiez/exporting/core/utils/comment.py +33 -0
- waldiez/exporting/core/utils/llm_config.py +117 -0
- waldiez/exporting/core/validation.py +96 -0
- waldiez/exporting/flow/__init__.py +6 -2
- waldiez/exporting/flow/execution_generator.py +193 -0
- waldiez/exporting/flow/exporter.py +107 -0
- waldiez/exporting/flow/factory.py +94 -0
- waldiez/exporting/flow/file_generator.py +214 -0
- waldiez/exporting/flow/merger.py +387 -0
- waldiez/exporting/flow/orchestrator.py +411 -0
- waldiez/exporting/flow/utils/__init__.py +9 -36
- waldiez/exporting/flow/utils/common.py +206 -0
- waldiez/exporting/flow/utils/importing.py +373 -0
- waldiez/exporting/flow/utils/linting.py +200 -0
- waldiez/exporting/flow/utils/{logging_utils.py → logging.py} +23 -9
- waldiez/exporting/models/__init__.py +3 -1
- waldiez/exporting/models/exporter.py +233 -0
- waldiez/exporting/models/factory.py +66 -0
- waldiez/exporting/models/processor.py +139 -0
- waldiez/exporting/tools/__init__.py +11 -0
- waldiez/exporting/tools/exporter.py +207 -0
- waldiez/exporting/tools/factory.py +57 -0
- waldiez/exporting/tools/processor.py +248 -0
- waldiez/exporting/tools/registration.py +133 -0
- waldiez/io/__init__.py +128 -0
- waldiez/io/_ws.py +199 -0
- waldiez/io/models/__init__.py +60 -0
- waldiez/io/models/base.py +66 -0
- waldiez/io/models/constants.py +78 -0
- waldiez/io/models/content/__init__.py +23 -0
- waldiez/io/models/content/audio.py +43 -0
- waldiez/io/models/content/base.py +45 -0
- waldiez/io/models/content/file.py +43 -0
- waldiez/io/models/content/image.py +96 -0
- waldiez/io/models/content/text.py +37 -0
- waldiez/io/models/content/video.py +43 -0
- waldiez/io/models/user_input.py +269 -0
- waldiez/io/models/user_response.py +215 -0
- waldiez/io/mqtt.py +681 -0
- waldiez/io/redis.py +782 -0
- waldiez/io/structured.py +439 -0
- waldiez/io/utils.py +184 -0
- waldiez/io/ws.py +298 -0
- waldiez/logger.py +481 -0
- waldiez/models/__init__.py +108 -51
- waldiez/models/agents/__init__.py +34 -70
- waldiez/models/agents/agent/__init__.py +10 -4
- waldiez/models/agents/agent/agent.py +466 -65
- waldiez/models/agents/agent/agent_data.py +119 -47
- waldiez/models/agents/agent/agent_type.py +13 -2
- waldiez/models/agents/agent/code_execution.py +12 -12
- waldiez/models/agents/agent/human_input_mode.py +8 -0
- waldiez/models/agents/agent/{linked_skill.py → linked_tool.py} +7 -7
- waldiez/models/agents/agent/nested_chat.py +35 -7
- waldiez/models/agents/agent/termination_message.py +30 -22
- waldiez/models/agents/{swarm_agent → agent}/update_system_message.py +22 -22
- waldiez/models/agents/agents.py +58 -63
- waldiez/models/agents/assistant/assistant.py +4 -4
- waldiez/models/agents/assistant/assistant_data.py +13 -1
- waldiez/models/agents/{captain_agent → captain}/captain_agent.py +5 -5
- waldiez/models/agents/{captain_agent → captain}/captain_agent_data.py +5 -5
- waldiez/models/agents/extra_requirements.py +11 -16
- waldiez/models/agents/group_manager/group_manager.py +103 -13
- waldiez/models/agents/group_manager/group_manager_data.py +36 -14
- waldiez/models/agents/group_manager/speakers.py +77 -24
- waldiez/models/agents/{rag_user → rag_user_proxy}/__init__.py +16 -16
- waldiez/models/agents/rag_user_proxy/rag_user_proxy.py +64 -0
- waldiez/models/agents/{rag_user/rag_user_data.py → rag_user_proxy/rag_user_proxy_data.py} +6 -5
- waldiez/models/agents/{rag_user → rag_user_proxy}/retrieve_config.py +182 -114
- waldiez/models/agents/{rag_user → rag_user_proxy}/vector_db_config.py +13 -13
- waldiez/models/agents/reasoning/reasoning_agent.py +6 -6
- waldiez/models/agents/reasoning/reasoning_agent_data.py +110 -63
- waldiez/models/agents/reasoning/reasoning_agent_reason_config.py +38 -10
- waldiez/models/agents/user_proxy/user_proxy.py +11 -7
- waldiez/models/agents/user_proxy/user_proxy_data.py +2 -2
- waldiez/models/chat/__init__.py +2 -1
- waldiez/models/chat/chat.py +166 -87
- waldiez/models/chat/chat_data.py +99 -136
- waldiez/models/chat/chat_message.py +33 -23
- waldiez/models/chat/chat_nested.py +31 -30
- waldiez/models/chat/chat_summary.py +10 -8
- waldiez/models/common/__init__.py +52 -2
- waldiez/models/common/ag2_version.py +1 -1
- waldiez/models/common/base.py +38 -7
- waldiez/models/common/dict_utils.py +42 -17
- waldiez/models/common/handoff.py +459 -0
- waldiez/models/common/id_generator.py +19 -0
- waldiez/models/common/method_utils.py +130 -68
- waldiez/{exporting/base/utils → models/common}/naming.py +38 -61
- waldiez/models/common/waldiez_version.py +37 -0
- waldiez/models/flow/__init__.py +9 -2
- waldiez/models/flow/connection.py +18 -0
- waldiez/models/flow/flow.py +311 -215
- waldiez/models/flow/flow_data.py +207 -40
- waldiez/models/flow/info.py +85 -0
- waldiez/models/flow/naming.py +131 -0
- waldiez/models/model/__init__.py +7 -1
- waldiez/models/model/extra_requirements.py +3 -12
- waldiez/models/model/model.py +76 -21
- waldiez/models/model/model_data.py +108 -20
- waldiez/models/tool/__init__.py +16 -0
- waldiez/models/tool/extra_requirements.py +36 -0
- waldiez/models/{skill/skill.py → tool/tool.py} +88 -88
- waldiez/models/tool/tool_data.py +51 -0
- waldiez/models/tool/tool_type.py +8 -0
- waldiez/models/waldiez.py +97 -80
- waldiez/runner.py +115 -61
- waldiez/running/__init__.py +13 -7
- waldiez/running/environment.py +49 -68
- waldiez/running/gen_seq_diagram.py +16 -14
- waldiez/running/post_run.py +119 -0
- waldiez/running/pre_run.py +149 -0
- waldiez/running/util.py +134 -0
- waldiez/utils/__init__.py +2 -4
- waldiez/utils/cli_extras/jupyter.py +5 -3
- waldiez/utils/cli_extras/runner.py +6 -4
- waldiez/utils/cli_extras/studio.py +6 -4
- waldiez/utils/conflict_checker.py +15 -9
- waldiez/utils/flaml_warnings.py +5 -5
- waldiez/utils/version.py +47 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/METADATA +235 -91
- waldiez-0.4.9.dist-info/RECORD +203 -0
- waldiez/exporting/agent/agent_exporter.py +0 -297
- waldiez/exporting/agent/utils/__init__.py +0 -23
- waldiez/exporting/agent/utils/captain_agent.py +0 -263
- waldiez/exporting/agent/utils/code_execution.py +0 -65
- waldiez/exporting/agent/utils/group_manager.py +0 -220
- waldiez/exporting/agent/utils/rag_user/__init__.py +0 -7
- waldiez/exporting/agent/utils/rag_user/rag_user.py +0 -209
- waldiez/exporting/agent/utils/reasoning.py +0 -36
- waldiez/exporting/agent/utils/swarm_agent.py +0 -469
- waldiez/exporting/agent/utils/teachability.py +0 -41
- waldiez/exporting/agent/utils/termination_message.py +0 -44
- waldiez/exporting/base/__init__.py +0 -25
- waldiez/exporting/base/agent_position.py +0 -75
- waldiez/exporting/base/base_exporter.py +0 -118
- waldiez/exporting/base/export_position.py +0 -48
- waldiez/exporting/base/import_position.py +0 -23
- waldiez/exporting/base/mixin.py +0 -137
- waldiez/exporting/base/utils/__init__.py +0 -18
- waldiez/exporting/base/utils/comments.py +0 -96
- waldiez/exporting/base/utils/path_check.py +0 -68
- waldiez/exporting/base/utils/to_string.py +0 -84
- waldiez/exporting/chats/chats_exporter.py +0 -240
- waldiez/exporting/chats/utils/swarm.py +0 -210
- waldiez/exporting/flow/flow_exporter.py +0 -528
- waldiez/exporting/flow/utils/agent_utils.py +0 -204
- waldiez/exporting/flow/utils/chat_utils.py +0 -71
- waldiez/exporting/flow/utils/def_main.py +0 -77
- waldiez/exporting/flow/utils/flow_content.py +0 -202
- waldiez/exporting/flow/utils/flow_names.py +0 -116
- waldiez/exporting/flow/utils/importing_utils.py +0 -227
- waldiez/exporting/models/models_exporter.py +0 -199
- waldiez/exporting/models/utils.py +0 -174
- waldiez/exporting/skills/__init__.py +0 -9
- waldiez/exporting/skills/skills_exporter.py +0 -176
- waldiez/exporting/skills/utils.py +0 -369
- waldiez/models/agents/agent/teachability.py +0 -70
- waldiez/models/agents/rag_user/rag_user.py +0 -60
- waldiez/models/agents/swarm_agent/__init__.py +0 -50
- waldiez/models/agents/swarm_agent/after_work.py +0 -179
- waldiez/models/agents/swarm_agent/on_condition.py +0 -105
- waldiez/models/agents/swarm_agent/on_condition_available.py +0 -142
- waldiez/models/agents/swarm_agent/on_condition_target.py +0 -40
- waldiez/models/agents/swarm_agent/swarm_agent.py +0 -107
- waldiez/models/agents/swarm_agent/swarm_agent_data.py +0 -124
- waldiez/models/flow/utils.py +0 -232
- waldiez/models/skill/__init__.py +0 -16
- waldiez/models/skill/extra_requirements.py +0 -36
- waldiez/models/skill/skill_data.py +0 -53
- waldiez/models/skill/skill_type.py +0 -8
- waldiez/running/running.py +0 -369
- waldiez/utils/pysqlite3_checker.py +0 -308
- waldiez/utils/rdps_checker.py +0 -122
- waldiez-0.4.7.dist-info/RECORD +0 -149
- /waldiez/models/agents/{captain_agent → captain}/__init__.py +0 -0
- /waldiez/models/agents/{captain_agent → captain}/captain_agent_lib_entry.py +0 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/WHEEL +0 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/entry_points.txt +0 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/licenses/LICENSE +0 -0
- {waldiez-0.4.7.dist-info → waldiez-0.4.9.dist-info}/licenses/NOTICE.md +0 -0
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0.
|
|
4
|
+
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
5
|
"""Update the agent's system message before they reply."""
|
|
4
6
|
|
|
5
|
-
from typing import Optional
|
|
7
|
+
from typing import Optional
|
|
6
8
|
|
|
7
9
|
from pydantic import Field, model_validator
|
|
8
10
|
from typing_extensions import Annotated, Literal, Self
|
|
9
11
|
|
|
10
12
|
from ...common import WaldiezBase, check_function, generate_function
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
WaldiezAgentUpdateFunctionType = Literal["string", "callable"]
|
|
13
15
|
"""Possible types for the update function."""
|
|
14
16
|
|
|
15
17
|
CUSTOM_UPDATE_SYSTEM_MESSAGE = "custom_update_system_message"
|
|
16
18
|
CUSTOM_UPDATE_SYSTEM_MESSAGE_ARGS = ["agent", "messages"]
|
|
17
19
|
CUSTOM_UPDATE_SYSTEM_MESSAGE_TYPES = (
|
|
18
|
-
["ConversableAgent", "
|
|
20
|
+
["ConversableAgent", "list[dict[str, Any]]"],
|
|
19
21
|
"str",
|
|
20
22
|
)
|
|
21
23
|
|
|
22
24
|
|
|
23
|
-
class
|
|
25
|
+
class WaldiezAgentUpdateSystemMessage(WaldiezBase):
|
|
24
26
|
"""Update the agent's system message before they reply.
|
|
25
27
|
|
|
26
28
|
Attributes
|
|
@@ -36,18 +38,17 @@ class WaldiezSwarmUpdateSystemMessage(WaldiezBase):
|
|
|
36
38
|
```
|
|
37
39
|
def custom_update_system_message(
|
|
38
40
|
agent: ConversableAgent,
|
|
39
|
-
messages:
|
|
41
|
+
messages: list[dict[str, Any]]
|
|
40
42
|
) -> str:
|
|
41
43
|
|
|
42
44
|
```
|
|
43
45
|
"""
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
type: Annotated[
|
|
48
|
+
WaldiezAgentUpdateFunctionType,
|
|
47
49
|
Field(
|
|
48
50
|
"string",
|
|
49
51
|
title="Function Type",
|
|
50
|
-
alias="updateFunctionType",
|
|
51
52
|
description=(
|
|
52
53
|
"The type of the update function. "
|
|
53
54
|
"Can be either 'string' or 'callable'."
|
|
@@ -55,12 +56,11 @@ class WaldiezSwarmUpdateSystemMessage(WaldiezBase):
|
|
|
55
56
|
),
|
|
56
57
|
]
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
content: Annotated[
|
|
59
60
|
str,
|
|
60
61
|
Field(
|
|
61
62
|
...,
|
|
62
|
-
title="
|
|
63
|
-
alias="updateFunction",
|
|
63
|
+
title="Function Content",
|
|
64
64
|
description=(
|
|
65
65
|
"The string template or function definition to update "
|
|
66
66
|
"the agent's system message. Can be a string or a Callable. "
|
|
@@ -70,20 +70,20 @@ class WaldiezSwarmUpdateSystemMessage(WaldiezBase):
|
|
|
70
70
|
"is 'callable', it should have signature: "
|
|
71
71
|
"def custom_update_system_message("
|
|
72
72
|
" agent: ConversableAgent, "
|
|
73
|
-
" messages:
|
|
73
|
+
" messages: list[dict[str, Any]] "
|
|
74
74
|
") -> str"
|
|
75
75
|
),
|
|
76
76
|
),
|
|
77
77
|
]
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
_content: str = ""
|
|
80
80
|
|
|
81
|
-
def
|
|
81
|
+
def get_content(
|
|
82
82
|
self,
|
|
83
83
|
name_prefix: Optional[str] = None,
|
|
84
84
|
name_suffix: Optional[str] = None,
|
|
85
|
-
) ->
|
|
86
|
-
"""Get the update function.
|
|
85
|
+
) -> tuple[str, str]:
|
|
86
|
+
"""Get the update function content.
|
|
87
87
|
|
|
88
88
|
Parameters
|
|
89
89
|
----------
|
|
@@ -94,7 +94,7 @@ class WaldiezSwarmUpdateSystemMessage(WaldiezBase):
|
|
|
94
94
|
|
|
95
95
|
Returns
|
|
96
96
|
-------
|
|
97
|
-
|
|
97
|
+
tuple[str, str]
|
|
98
98
|
The update function and the function name.
|
|
99
99
|
|
|
100
100
|
"""
|
|
@@ -108,7 +108,7 @@ class WaldiezSwarmUpdateSystemMessage(WaldiezBase):
|
|
|
108
108
|
function_name=function_name,
|
|
109
109
|
function_args=CUSTOM_UPDATE_SYSTEM_MESSAGE_ARGS,
|
|
110
110
|
function_types=CUSTOM_UPDATE_SYSTEM_MESSAGE_TYPES,
|
|
111
|
-
function_body=self.
|
|
111
|
+
function_body=self._content,
|
|
112
112
|
),
|
|
113
113
|
function_name,
|
|
114
114
|
)
|
|
@@ -129,10 +129,10 @@ class WaldiezSwarmUpdateSystemMessage(WaldiezBase):
|
|
|
129
129
|
or if the function type is not 'string' or 'callable'.
|
|
130
130
|
|
|
131
131
|
"""
|
|
132
|
-
self.
|
|
133
|
-
if self.
|
|
132
|
+
self._content = self.content
|
|
133
|
+
if self.type == "callable":
|
|
134
134
|
valid, error_or_body = check_function(
|
|
135
|
-
code_string=self.
|
|
135
|
+
code_string=self._content,
|
|
136
136
|
function_name=CUSTOM_UPDATE_SYSTEM_MESSAGE,
|
|
137
137
|
function_args=CUSTOM_UPDATE_SYSTEM_MESSAGE_ARGS,
|
|
138
138
|
)
|
|
@@ -141,5 +141,5 @@ class WaldiezSwarmUpdateSystemMessage(WaldiezBase):
|
|
|
141
141
|
raise ValueError(
|
|
142
142
|
f"Invalid custom method: {error_or_body or 'no content'}"
|
|
143
143
|
)
|
|
144
|
-
self.
|
|
144
|
+
self._content = error_or_body
|
|
145
145
|
return self
|
waldiez/models/agents/agents.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez agents model."""
|
|
4
4
|
|
|
5
|
-
from typing import Iterator
|
|
5
|
+
from typing import Iterator
|
|
6
6
|
|
|
7
7
|
from pydantic import Field, model_validator
|
|
8
8
|
from typing_extensions import Annotated, Self
|
|
@@ -10,11 +10,10 @@ from typing_extensions import Annotated, Self
|
|
|
10
10
|
from ..common import WaldiezBase
|
|
11
11
|
from .agent import WaldiezAgent
|
|
12
12
|
from .assistant import WaldiezAssistant
|
|
13
|
-
from .
|
|
13
|
+
from .captain import WaldiezCaptainAgent
|
|
14
14
|
from .group_manager import WaldiezGroupManager
|
|
15
|
-
from .
|
|
15
|
+
from .rag_user_proxy import WaldiezRagUserProxy
|
|
16
16
|
from .reasoning import WaldiezReasoningAgent
|
|
17
|
-
from .swarm_agent import WaldiezSwarmAgent
|
|
18
17
|
from .user_proxy import WaldiezUserProxy
|
|
19
18
|
|
|
20
19
|
|
|
@@ -23,72 +22,68 @@ class WaldiezAgents(WaldiezBase):
|
|
|
23
22
|
|
|
24
23
|
Attributes
|
|
25
24
|
----------
|
|
26
|
-
|
|
25
|
+
userProxyAgents : list[WaldiezUserProxy]
|
|
27
26
|
User proxy agents.
|
|
28
|
-
|
|
27
|
+
assistantAgents : list[WaldiezAssistant]
|
|
29
28
|
Assistant agents.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
ragUserProxyAgents : list[WaldiezRagUserProxy]
|
|
30
|
+
RAG user proxy agents.
|
|
31
|
+
reasoningAgents : list[WaldiezReasoningAgent]
|
|
32
|
+
Reasoning agents.
|
|
33
|
+
captainAgents : list[WaldiezCaptainAgent]
|
|
34
|
+
Captain agents.
|
|
35
|
+
groupManagerAgents : list[WaldiezGroupManager]
|
|
36
|
+
Group manager agents.
|
|
34
37
|
"""
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
userProxyAgents: Annotated[
|
|
40
|
+
list[WaldiezUserProxy],
|
|
38
41
|
Field(
|
|
39
|
-
title="
|
|
40
|
-
description="User proxy agents",
|
|
42
|
+
title="User Proxy Agents.",
|
|
43
|
+
description="The User proxy agents in the flow.",
|
|
41
44
|
default_factory=list,
|
|
42
45
|
),
|
|
43
|
-
]
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
] = []
|
|
47
|
+
assistantAgents: Annotated[
|
|
48
|
+
list[WaldiezAssistant],
|
|
46
49
|
Field(
|
|
47
|
-
title="
|
|
48
|
-
description="
|
|
50
|
+
title="Assistant Agents.",
|
|
51
|
+
description="The assistant agents in the flow.",
|
|
49
52
|
default_factory=list,
|
|
50
53
|
),
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
] = []
|
|
55
|
+
ragUserProxyAgents: Annotated[
|
|
56
|
+
list[WaldiezRagUserProxy],
|
|
54
57
|
Field(
|
|
55
|
-
title="
|
|
56
|
-
description="
|
|
58
|
+
title="RAG Users Proxy agents.",
|
|
59
|
+
description="The RAG user proxy agents in the flow.",
|
|
57
60
|
default_factory=list,
|
|
58
61
|
),
|
|
59
|
-
]
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
] = []
|
|
63
|
+
reasoningAgents: Annotated[
|
|
64
|
+
list[WaldiezReasoningAgent],
|
|
62
65
|
Field(
|
|
63
|
-
title="
|
|
64
|
-
description="
|
|
65
|
-
default_factory=list,
|
|
66
|
-
),
|
|
67
|
-
]
|
|
68
|
-
swarm_agents: Annotated[
|
|
69
|
-
List[WaldiezSwarmAgent],
|
|
70
|
-
Field(
|
|
71
|
-
title="Swarm Agents.",
|
|
72
|
-
description="Swarm agents",
|
|
66
|
+
title="Reasoning Agents.",
|
|
67
|
+
description="The Reasoning agents in the flow.",
|
|
73
68
|
default_factory=list,
|
|
74
69
|
),
|
|
75
|
-
]
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
] = []
|
|
71
|
+
captainAgents: Annotated[
|
|
72
|
+
list[WaldiezCaptainAgent],
|
|
78
73
|
Field(
|
|
79
|
-
title="
|
|
80
|
-
description="
|
|
74
|
+
title="Captain Agents.",
|
|
75
|
+
description="The Captain agents in the flow.",
|
|
81
76
|
default_factory=list,
|
|
82
77
|
),
|
|
83
|
-
]
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
] = []
|
|
79
|
+
groupManagerAgents: Annotated[
|
|
80
|
+
list[WaldiezGroupManager],
|
|
86
81
|
Field(
|
|
87
|
-
title="
|
|
88
|
-
description="
|
|
82
|
+
title="Group Manager Agents.",
|
|
83
|
+
description="The Group manager agents in the flow.",
|
|
89
84
|
default_factory=list,
|
|
90
85
|
),
|
|
91
|
-
]
|
|
86
|
+
] = []
|
|
92
87
|
|
|
93
88
|
@property
|
|
94
89
|
def members(self) -> Iterator[WaldiezAgent]:
|
|
@@ -99,13 +94,12 @@ class WaldiezAgents(WaldiezBase):
|
|
|
99
94
|
WaldiezAgent
|
|
100
95
|
The agents.
|
|
101
96
|
"""
|
|
102
|
-
yield from self.
|
|
103
|
-
yield from self.
|
|
104
|
-
yield from self.
|
|
105
|
-
yield from self.
|
|
106
|
-
yield from self.
|
|
107
|
-
yield from self.
|
|
108
|
-
yield from self.captain_agents
|
|
97
|
+
yield from self.userProxyAgents
|
|
98
|
+
yield from self.assistantAgents
|
|
99
|
+
yield from self.ragUserProxyAgents
|
|
100
|
+
yield from self.reasoningAgents
|
|
101
|
+
yield from self.captainAgents
|
|
102
|
+
yield from self.groupManagerAgents
|
|
109
103
|
|
|
110
104
|
@model_validator(mode="after")
|
|
111
105
|
def validate_agents(self) -> Self:
|
|
@@ -131,19 +125,19 @@ class WaldiezAgents(WaldiezBase):
|
|
|
131
125
|
raise ValueError("Agent IDs must be unique.")
|
|
132
126
|
return self
|
|
133
127
|
|
|
134
|
-
def validate_flow(self, model_ids:
|
|
128
|
+
def validate_flow(self, model_ids: list[str], tool_ids: list[str]) -> None:
|
|
135
129
|
"""Validate the flow of the agents.
|
|
136
130
|
|
|
137
131
|
- Validate the linked models (the referenced model ids must exist).
|
|
138
|
-
- Validate the linked
|
|
132
|
+
- Validate the linked tools (the referenced tool ids must exist).
|
|
139
133
|
- Validate the code execution (the referenced functions must exist).
|
|
140
134
|
|
|
141
135
|
Parameters
|
|
142
136
|
----------
|
|
143
|
-
model_ids :
|
|
137
|
+
model_ids : list[str]
|
|
144
138
|
The list of model IDs.
|
|
145
|
-
|
|
146
|
-
The list of
|
|
139
|
+
tool_ids : list[str]
|
|
140
|
+
The list of tool IDs.
|
|
147
141
|
|
|
148
142
|
Raises
|
|
149
143
|
------
|
|
@@ -153,9 +147,10 @@ class WaldiezAgents(WaldiezBase):
|
|
|
153
147
|
all_agent_ids = [agent.id for agent in self.members]
|
|
154
148
|
for agent in self.members:
|
|
155
149
|
agent.validate_linked_models(model_ids)
|
|
156
|
-
agent.
|
|
157
|
-
agent.validate_code_execution(
|
|
158
|
-
if agent.
|
|
150
|
+
agent.validate_linked_tools(tool_ids, agent_ids=all_agent_ids)
|
|
151
|
+
agent.validate_code_execution(tool_ids=tool_ids)
|
|
152
|
+
if agent.is_group_manager and isinstance(
|
|
159
153
|
agent, WaldiezGroupManager
|
|
160
154
|
):
|
|
155
|
+
agent.validate_initial_agent_id(all_agent_ids)
|
|
161
156
|
agent.validate_transitions(agent_ids=all_agent_ids)
|
|
@@ -24,7 +24,7 @@ class WaldiezAssistant(WaldiezAgent):
|
|
|
24
24
|
The assistant agent's data
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
|
-
agent_type: Annotated[
|
|
27
|
+
agent_type: Annotated[ # pyright: ignore
|
|
28
28
|
Literal["assistant"],
|
|
29
29
|
Field(
|
|
30
30
|
"assistant",
|
|
@@ -32,12 +32,12 @@ class WaldiezAssistant(WaldiezAgent):
|
|
|
32
32
|
description="The agent type in a graph: 'assistant'",
|
|
33
33
|
alias="agentType",
|
|
34
34
|
),
|
|
35
|
-
]
|
|
36
|
-
data: Annotated[
|
|
35
|
+
] = "assistant"
|
|
36
|
+
data: Annotated[ # pyright: ignore
|
|
37
37
|
WaldiezAssistantData,
|
|
38
38
|
Field(
|
|
39
39
|
title="Data",
|
|
40
40
|
description="The assistant agent's data",
|
|
41
|
-
default_factory=WaldiezAssistantData,
|
|
41
|
+
default_factory=WaldiezAssistantData, # pyright: ignore
|
|
42
42
|
),
|
|
43
43
|
]
|
|
@@ -18,6 +18,9 @@ class WaldiezAssistantData(WaldiezAgentData):
|
|
|
18
18
|
----------
|
|
19
19
|
human_input_mode : Literal["ALWAYS", "NEVER", "TERMINATE"]
|
|
20
20
|
The human input mode, Defaults to `NEVER`
|
|
21
|
+
is_multimodal : bool
|
|
22
|
+
A flag to indicate if the agent is multimodal.
|
|
23
|
+
Defaults to `False`.
|
|
21
24
|
"""
|
|
22
25
|
|
|
23
26
|
human_input_mode: Annotated[
|
|
@@ -28,4 +31,13 @@ class WaldiezAssistantData(WaldiezAgentData):
|
|
|
28
31
|
description="The human input mode, Defaults to `NEVER`",
|
|
29
32
|
alias="humanInputMode",
|
|
30
33
|
),
|
|
31
|
-
]
|
|
34
|
+
] = "NEVER"
|
|
35
|
+
is_multimodal: Annotated[
|
|
36
|
+
bool,
|
|
37
|
+
Field(
|
|
38
|
+
False,
|
|
39
|
+
title="Is multimodal",
|
|
40
|
+
description="A flag to indicate if the agent is multimodal.",
|
|
41
|
+
alias="isMultimodal",
|
|
42
|
+
),
|
|
43
|
+
] = False
|
|
@@ -26,20 +26,20 @@ class WaldiezCaptainAgent(WaldiezAgent):
|
|
|
26
26
|
The captain agent's data.
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
|
-
agent_type: Annotated[
|
|
29
|
+
agent_type: Annotated[ # pyright: ignore
|
|
30
30
|
Literal["captain"],
|
|
31
31
|
Field(
|
|
32
|
-
"captain",
|
|
32
|
+
default="captain",
|
|
33
33
|
title="Agent type",
|
|
34
34
|
description="The agent type: 'captain' for a captain agent",
|
|
35
35
|
alias="agentType",
|
|
36
36
|
),
|
|
37
|
-
]
|
|
38
|
-
data: Annotated[
|
|
37
|
+
] = "captain"
|
|
38
|
+
data: Annotated[ # pyright: ignore
|
|
39
39
|
WaldiezCaptainAgentData,
|
|
40
40
|
Field(
|
|
41
41
|
title="Data",
|
|
42
42
|
description="The captain agent's data",
|
|
43
|
-
default_factory=WaldiezCaptainAgentData,
|
|
43
|
+
default_factory=WaldiezCaptainAgentData, # pyright: ignore
|
|
44
44
|
),
|
|
45
45
|
]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez captain agent data."""
|
|
4
4
|
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Optional
|
|
6
6
|
|
|
7
7
|
from pydantic import Field
|
|
8
8
|
from typing_extensions import Annotated, Literal
|
|
@@ -25,7 +25,7 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
agent_lib: Annotated[
|
|
28
|
-
|
|
28
|
+
list[WaldiezCaptainAgentLibEntry],
|
|
29
29
|
Field(
|
|
30
30
|
default_factory=list,
|
|
31
31
|
title="Agent lib",
|
|
@@ -36,7 +36,7 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
36
36
|
tool_lib: Annotated[
|
|
37
37
|
Optional[Literal["default"]],
|
|
38
38
|
Field(
|
|
39
|
-
None,
|
|
39
|
+
default=None,
|
|
40
40
|
title="Tool lib",
|
|
41
41
|
description="Whether to use the default tool lib",
|
|
42
42
|
alias="toolLib",
|
|
@@ -45,7 +45,7 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
45
45
|
max_round: Annotated[
|
|
46
46
|
int,
|
|
47
47
|
Field(
|
|
48
|
-
10,
|
|
48
|
+
default=10,
|
|
49
49
|
title="Max round",
|
|
50
50
|
description="The maximum number of rounds in a group chat",
|
|
51
51
|
alias="maxRound",
|
|
@@ -54,7 +54,7 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
54
54
|
max_turns: Annotated[
|
|
55
55
|
int,
|
|
56
56
|
Field(
|
|
57
|
-
5,
|
|
57
|
+
default=5,
|
|
58
58
|
title="Max turns",
|
|
59
59
|
description="The maximum number of turns for a chat",
|
|
60
60
|
alias="maxTurns",
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
"""Extra requirements for agents."""
|
|
4
4
|
|
|
5
5
|
# pylint: disable=line-too-long
|
|
6
|
-
import
|
|
7
|
-
from typing import Iterator, List, Set
|
|
6
|
+
from typing import Iterator, Set
|
|
8
7
|
|
|
9
8
|
from .agent import WaldiezAgent
|
|
10
|
-
from .
|
|
9
|
+
from .rag_user_proxy import WaldiezRagUserProxy
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
def get_retrievechat_extra_requirements(
|
|
@@ -17,7 +16,7 @@ def get_retrievechat_extra_requirements(
|
|
|
17
16
|
|
|
18
17
|
Parameters
|
|
19
18
|
----------
|
|
20
|
-
agents :
|
|
19
|
+
agents : list[WaldiezAgent]
|
|
21
20
|
The flow agents.
|
|
22
21
|
|
|
23
22
|
Returns
|
|
@@ -26,10 +25,9 @@ def get_retrievechat_extra_requirements(
|
|
|
26
25
|
The retrievechat extra requirements.
|
|
27
26
|
"""
|
|
28
27
|
# https://github.com/ag2ai/ag2/blob/main/pyproject.toml
|
|
29
|
-
# with chromadb relaxed
|
|
30
|
-
# to avoid conflicts with other extras and (later) allow py3.13
|
|
28
|
+
# with chromadb and sentence_transdormers relaxed
|
|
31
29
|
rag_requirements: Set[str] = {
|
|
32
|
-
"protobuf==
|
|
30
|
+
"protobuf==5.29.3",
|
|
33
31
|
"chromadb>=0.5.23",
|
|
34
32
|
"sentence_transformers",
|
|
35
33
|
"pypdf",
|
|
@@ -38,7 +36,7 @@ def get_retrievechat_extra_requirements(
|
|
|
38
36
|
"markdownify",
|
|
39
37
|
}
|
|
40
38
|
for agent in agents:
|
|
41
|
-
if agent.
|
|
39
|
+
if agent.is_rag_user and isinstance(agent, WaldiezRagUserProxy):
|
|
42
40
|
# if not chroma, get the relevant db requirements
|
|
43
41
|
db_type = agent.data.retrieve_config.vector_db
|
|
44
42
|
if db_type == "pgvector":
|
|
@@ -55,12 +53,12 @@ def get_retrievechat_extra_requirements(
|
|
|
55
53
|
return rag_requirements
|
|
56
54
|
|
|
57
55
|
|
|
58
|
-
def get_captain_agent_extra_requirements() ->
|
|
56
|
+
def get_captain_agent_extra_requirements() -> list[str]:
|
|
59
57
|
"""Get the captain agent extra requirements.
|
|
60
58
|
|
|
61
59
|
Returns
|
|
62
60
|
-------
|
|
63
|
-
|
|
61
|
+
list[str]
|
|
64
62
|
The captain agent extra requirements.
|
|
65
63
|
"""
|
|
66
64
|
# https://github.com/ag2ai/ag2/blob/main/autogen/agentchat/contrib/captainagent/tools/requirements.txt # noqa: E501
|
|
@@ -72,17 +70,14 @@ def get_captain_agent_extra_requirements() -> List[str]:
|
|
|
72
70
|
"easyocr",
|
|
73
71
|
"python-pptx",
|
|
74
72
|
"openai-whisper",
|
|
75
|
-
"pandas",
|
|
76
73
|
"scipy",
|
|
77
|
-
# "
|
|
74
|
+
# "pandas", also in agent_requirements below
|
|
75
|
+
# "sentence-transformers", also in agent_requirements below
|
|
78
76
|
]
|
|
79
77
|
agent_requirements = [
|
|
78
|
+
"pandas",
|
|
80
79
|
"chromadb",
|
|
81
80
|
"sentence-transformers",
|
|
82
81
|
"huggingface-hub",
|
|
83
82
|
]
|
|
84
|
-
if platform.system() == "Linux":
|
|
85
|
-
agent_requirements.append("pysqlite3-binary")
|
|
86
|
-
# on windows and OSX, installing pysqlite3-binary seem to fail in some cases
|
|
87
|
-
# we can handle/install if needed in waldiez.utils.pysqlite3_checker
|
|
88
83
|
return tool_requirements + agent_requirements
|