waldiez 0.5.10__py3-none-any.whl → 0.6.1__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 +1 -1
- waldiez/_version.py +1 -1
- waldiez/cli.py +19 -7
- waldiez/cli_extras/jupyter.py +3 -0
- waldiez/cli_extras/runner.py +3 -1
- waldiez/cli_extras/studio.py +3 -1
- waldiez/exporter.py +9 -3
- waldiez/exporting/agent/exporter.py +15 -16
- waldiez/exporting/agent/extras/captain_agent_extras.py +6 -6
- waldiez/exporting/agent/extras/doc_agent_extras.py +6 -6
- waldiez/exporting/agent/extras/group_manager_agent_extas.py +40 -24
- waldiez/exporting/agent/extras/group_member_extras.py +6 -5
- waldiez/exporting/agent/extras/handoffs/after_work.py +2 -1
- waldiez/exporting/agent/extras/handoffs/available.py +2 -1
- waldiez/exporting/agent/extras/handoffs/condition.py +3 -2
- waldiez/exporting/agent/extras/handoffs/handoff.py +2 -1
- waldiez/exporting/agent/extras/handoffs/target.py +7 -4
- waldiez/exporting/agent/extras/rag/chroma_extras.py +27 -19
- waldiez/exporting/agent/extras/rag/mongo_extras.py +8 -8
- waldiez/exporting/agent/extras/rag/pgvector_extras.py +5 -5
- waldiez/exporting/agent/extras/rag/qdrant_extras.py +5 -4
- waldiez/exporting/agent/extras/rag/vector_db_extras.py +1 -1
- waldiez/exporting/agent/extras/rag_user_proxy_agent_extras.py +5 -7
- waldiez/exporting/agent/extras/reasoning_agent_extras.py +3 -5
- waldiez/exporting/agent/termination.py +1 -0
- waldiez/exporting/chats/exporter.py +4 -4
- waldiez/exporting/chats/processor.py +1 -2
- waldiez/exporting/chats/utils/common.py +89 -48
- waldiez/exporting/chats/utils/group.py +9 -9
- waldiez/exporting/chats/utils/nested.py +7 -7
- waldiez/exporting/chats/utils/sequential.py +1 -1
- waldiez/exporting/chats/utils/single.py +2 -2
- waldiez/exporting/core/constants.py +3 -1
- waldiez/exporting/core/content.py +7 -7
- waldiez/exporting/core/context.py +5 -3
- waldiez/exporting/core/exporter.py +5 -3
- waldiez/exporting/core/exporters.py +2 -2
- waldiez/exporting/core/extras/agent_extras/captain_extras.py +2 -2
- waldiez/exporting/core/extras/agent_extras/group_manager_extras.py +2 -2
- waldiez/exporting/core/extras/agent_extras/rag_user_extras.py +2 -2
- waldiez/exporting/core/extras/agent_extras/standard_extras.py +3 -8
- waldiez/exporting/core/extras/base.py +7 -5
- waldiez/exporting/core/extras/flow_extras.py +4 -5
- waldiez/exporting/core/extras/model_extras.py +2 -2
- waldiez/exporting/core/extras/path_resolver.py +1 -2
- waldiez/exporting/core/extras/serializer.py +13 -11
- waldiez/exporting/core/protocols.py +6 -5
- waldiez/exporting/core/result.py +25 -28
- waldiez/exporting/core/types.py +11 -10
- waldiez/exporting/core/utils/llm_config.py +4 -4
- waldiez/exporting/core/validation.py +10 -11
- waldiez/exporting/flow/execution_generator.py +99 -10
- waldiez/exporting/flow/exporter.py +2 -2
- waldiez/exporting/flow/factory.py +2 -2
- waldiez/exporting/flow/file_generator.py +4 -2
- waldiez/exporting/flow/merger.py +5 -3
- waldiez/exporting/flow/orchestrator.py +72 -2
- waldiez/exporting/flow/utils/common.py +6 -6
- waldiez/exporting/flow/utils/importing.py +7 -8
- waldiez/exporting/flow/utils/linting.py +25 -9
- waldiez/exporting/flow/utils/logging.py +5 -77
- waldiez/exporting/models/exporter.py +8 -8
- waldiez/exporting/models/processor.py +5 -5
- waldiez/exporting/tools/exporter.py +2 -2
- waldiez/exporting/tools/processor.py +7 -4
- waldiez/io/__init__.py +11 -5
- waldiez/io/_ws.py +12 -6
- waldiez/io/models/constants.py +10 -10
- waldiez/io/models/content/audio.py +1 -0
- waldiez/io/models/content/base.py +20 -18
- waldiez/io/models/content/file.py +1 -0
- waldiez/io/models/content/image.py +1 -0
- waldiez/io/models/content/text.py +1 -0
- waldiez/io/models/content/video.py +1 -0
- waldiez/io/models/user_input.py +10 -5
- waldiez/io/models/user_response.py +17 -16
- waldiez/io/mqtt.py +18 -31
- waldiez/io/redis.py +18 -22
- waldiez/io/structured.py +122 -70
- waldiez/io/utils.py +19 -10
- waldiez/io/ws.py +7 -3
- waldiez/logger.py +16 -3
- waldiez/models/agents/__init__.py +3 -0
- waldiez/models/agents/agent/agent.py +25 -17
- waldiez/models/agents/agent/agent_data.py +25 -22
- waldiez/models/agents/agent/code_execution.py +9 -11
- waldiez/models/agents/agent/termination_message.py +10 -12
- waldiez/models/agents/agent/update_system_message.py +2 -4
- waldiez/models/agents/agents.py +8 -8
- waldiez/models/agents/assistant/assistant.py +6 -3
- waldiez/models/agents/assistant/assistant_data.py +2 -2
- waldiez/models/agents/captain/captain_agent.py +7 -4
- waldiez/models/agents/captain/captain_agent_data.py +5 -7
- waldiez/models/agents/doc_agent/doc_agent.py +7 -4
- waldiez/models/agents/doc_agent/doc_agent_data.py +9 -10
- waldiez/models/agents/doc_agent/rag_query_engine.py +10 -12
- waldiez/models/agents/extra_requirements.py +3 -3
- waldiez/models/agents/group_manager/group_manager.py +12 -7
- waldiez/models/agents/group_manager/group_manager_data.py +13 -12
- waldiez/models/agents/group_manager/speakers.py +17 -19
- waldiez/models/agents/rag_user_proxy/rag_user_proxy.py +7 -4
- waldiez/models/agents/rag_user_proxy/rag_user_proxy_data.py +4 -1
- waldiez/models/agents/rag_user_proxy/retrieve_config.py +69 -63
- waldiez/models/agents/rag_user_proxy/vector_db_config.py +19 -19
- waldiez/models/agents/reasoning/reasoning_agent.py +7 -4
- waldiez/models/agents/reasoning/reasoning_agent_data.py +3 -2
- waldiez/models/agents/reasoning/reasoning_agent_reason_config.py +8 -8
- waldiez/models/agents/user_proxy/user_proxy.py +6 -3
- waldiez/models/agents/user_proxy/user_proxy_data.py +1 -1
- waldiez/models/chat/chat.py +28 -20
- waldiez/models/chat/chat_data.py +22 -21
- waldiez/models/chat/chat_message.py +9 -9
- waldiez/models/chat/chat_nested.py +9 -9
- waldiez/models/chat/chat_summary.py +6 -6
- waldiez/models/common/__init__.py +2 -0
- waldiez/models/common/ag2_version.py +2 -0
- waldiez/models/common/base.py +2 -0
- waldiez/models/common/dict_utils.py +8 -6
- waldiez/models/common/handoff.py +20 -17
- waldiez/models/common/method_utils.py +9 -7
- waldiez/models/common/naming.py +49 -0
- waldiez/models/flow/flow.py +11 -6
- waldiez/models/flow/flow_data.py +23 -17
- waldiez/models/flow/info.py +3 -3
- waldiez/models/flow/naming.py +2 -1
- waldiez/models/model/_aws.py +11 -13
- waldiez/models/model/_llm.py +8 -0
- waldiez/models/model/_price.py +2 -4
- waldiez/models/model/extra_requirements.py +1 -3
- waldiez/models/model/model.py +2 -2
- waldiez/models/model/model_data.py +21 -21
- waldiez/models/tool/extra_requirements.py +2 -4
- waldiez/models/tool/predefined/_duckduckgo.py +1 -0
- waldiez/models/tool/predefined/_email.py +4 -0
- waldiez/models/tool/predefined/_google.py +1 -0
- waldiez/models/tool/predefined/_perplexity.py +2 -1
- waldiez/models/tool/predefined/_searxng.py +2 -1
- waldiez/models/tool/predefined/_tavily.py +1 -0
- waldiez/models/tool/predefined/_wikipedia.py +2 -1
- waldiez/models/tool/predefined/_youtube.py +1 -0
- waldiez/models/tool/tool.py +8 -5
- waldiez/models/tool/tool_data.py +2 -2
- waldiez/models/waldiez.py +152 -4
- waldiez/runner.py +11 -5
- waldiez/running/async_utils.py +192 -0
- waldiez/running/base_runner.py +155 -241
- waldiez/running/dir_utils.py +52 -0
- waldiez/running/environment.py +10 -44
- waldiez/running/events_mixin.py +252 -0
- waldiez/running/exceptions.py +20 -0
- waldiez/running/gen_seq_diagram.py +18 -15
- waldiez/running/io_utils.py +216 -0
- waldiez/running/protocol.py +11 -5
- waldiez/running/requirements_mixin.py +65 -0
- waldiez/running/results_mixin.py +926 -0
- waldiez/running/standard_runner.py +24 -27
- waldiez/running/step_by_step/breakpoints_mixin.py +503 -47
- waldiez/running/step_by_step/command_handler.py +154 -0
- waldiez/running/step_by_step/events_processor.py +379 -0
- waldiez/running/step_by_step/step_by_step_models.py +425 -41
- waldiez/running/step_by_step/step_by_step_runner.py +437 -382
- waldiez/running/subprocess_runner/__base__.py +13 -8
- waldiez/running/subprocess_runner/_async_runner.py +6 -4
- waldiez/running/subprocess_runner/_sync_runner.py +11 -6
- waldiez/running/subprocess_runner/runner.py +48 -23
- waldiez/running/timeline_processor.py +1 -1
- waldiez/utils/__init__.py +2 -0
- waldiez/utils/conflict_checker.py +4 -4
- waldiez/utils/python_manager.py +415 -0
- waldiez/ws/__init__.py +8 -7
- waldiez/ws/_file_handler.py +18 -20
- waldiez/ws/_mock.py +75 -0
- waldiez/ws/cli.py +58 -10
- waldiez/ws/client_manager.py +77 -53
- waldiez/ws/errors.py +3 -0
- waldiez/ws/models.py +61 -53
- waldiez/ws/reloader.py +33 -4
- waldiez/ws/server.py +121 -52
- waldiez/ws/session_manager.py +8 -9
- waldiez/ws/session_stats.py +1 -1
- waldiez/ws/utils.py +33 -5
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/METADATA +107 -109
- waldiez-0.6.1.dist-info/RECORD +254 -0
- waldiez/running/post_run.py +0 -180
- waldiez/running/pre_run.py +0 -159
- waldiez/running/run_results.py +0 -14
- waldiez/running/utils.py +0 -511
- waldiez-0.5.10.dist-info/RECORD +0 -248
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/WHEEL +0 -0
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/entry_points.txt +0 -0
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {waldiez-0.5.10.dist-info → waldiez-0.6.1.dist-info}/licenses/NOTICE.md +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
3
4
|
# pylint: disable=too-many-public-methods
|
|
5
|
+
# pyright: reportArgumentType=false
|
|
4
6
|
"""Base agent class to be inherited by all agents."""
|
|
5
7
|
|
|
6
8
|
import warnings
|
|
@@ -21,10 +23,11 @@ from .code_execution import WaldiezAgentCodeExecutionConfig
|
|
|
21
23
|
from .nested_chat import WaldiezAgentNestedChat, WaldiezAgentNestedChatMessage
|
|
22
24
|
|
|
23
25
|
if TYPE_CHECKING:
|
|
26
|
+
# noinspection PyUnusedImports
|
|
24
27
|
from ...chat import WaldiezChat
|
|
25
28
|
|
|
26
29
|
|
|
27
|
-
# noinspection PyUnresolvedReferences
|
|
30
|
+
# noinspection PyUnresolvedReferences,PyNestedDecorators
|
|
28
31
|
class WaldiezAgent(WaldiezBase):
|
|
29
32
|
"""Waldiez Agent to be inherited by all other agents.
|
|
30
33
|
|
|
@@ -70,7 +73,7 @@ class WaldiezAgent(WaldiezBase):
|
|
|
70
73
|
title="Type",
|
|
71
74
|
description="The type of the 'node' in a graph.",
|
|
72
75
|
),
|
|
73
|
-
]
|
|
76
|
+
]
|
|
74
77
|
agent_type: Annotated[
|
|
75
78
|
WaldiezAgentType,
|
|
76
79
|
Field(
|
|
@@ -92,7 +95,7 @@ class WaldiezAgent(WaldiezBase):
|
|
|
92
95
|
title="Description",
|
|
93
96
|
description="The description of the agent",
|
|
94
97
|
),
|
|
95
|
-
]
|
|
98
|
+
]
|
|
96
99
|
tags: Annotated[
|
|
97
100
|
list[str],
|
|
98
101
|
Field(
|
|
@@ -100,7 +103,7 @@ class WaldiezAgent(WaldiezBase):
|
|
|
100
103
|
description="Tags of the agent",
|
|
101
104
|
default_factory=list,
|
|
102
105
|
),
|
|
103
|
-
]
|
|
106
|
+
]
|
|
104
107
|
requirements: Annotated[
|
|
105
108
|
list[str],
|
|
106
109
|
Field(
|
|
@@ -108,7 +111,7 @@ class WaldiezAgent(WaldiezBase):
|
|
|
108
111
|
description="Python requirements for the agent",
|
|
109
112
|
default_factory=list,
|
|
110
113
|
),
|
|
111
|
-
]
|
|
114
|
+
]
|
|
112
115
|
created_at: Annotated[
|
|
113
116
|
str,
|
|
114
117
|
Field(
|
|
@@ -130,7 +133,7 @@ class WaldiezAgent(WaldiezBase):
|
|
|
130
133
|
Field(
|
|
131
134
|
title="Data",
|
|
132
135
|
description="The data (properties) of the agent",
|
|
133
|
-
default_factory=WaldiezAgentData,
|
|
136
|
+
default_factory=WaldiezAgentData,
|
|
134
137
|
),
|
|
135
138
|
]
|
|
136
139
|
|
|
@@ -138,7 +141,7 @@ class WaldiezAgent(WaldiezBase):
|
|
|
138
141
|
list[WaldiezHandoff],
|
|
139
142
|
Field(
|
|
140
143
|
init=False, # this is not a field in the constructor
|
|
141
|
-
default_factory=list
|
|
144
|
+
default_factory=list,
|
|
142
145
|
title="Handoffs",
|
|
143
146
|
description=(
|
|
144
147
|
"A list of handoffs (target ids) to register. "
|
|
@@ -147,10 +150,10 @@ class WaldiezAgent(WaldiezBase):
|
|
|
147
150
|
),
|
|
148
151
|
] = []
|
|
149
152
|
|
|
150
|
-
_checked_nested_chats: Annotated[bool, Field(
|
|
153
|
+
_checked_nested_chats: Annotated[bool, Field(default=False, init=False)] = (
|
|
151
154
|
False
|
|
152
155
|
)
|
|
153
|
-
_checked_handoffs: Annotated[bool, Field(
|
|
156
|
+
_checked_handoffs: Annotated[bool, Field(default=False, init=False)] = False
|
|
154
157
|
|
|
155
158
|
@property
|
|
156
159
|
def args_to_skip(self) -> list[str]:
|
|
@@ -189,10 +192,11 @@ class WaldiezAgent(WaldiezBase):
|
|
|
189
192
|
If handoffs have not been gathered yet.
|
|
190
193
|
"""
|
|
191
194
|
if not self._checked_handoffs:
|
|
192
|
-
|
|
195
|
+
msg = (
|
|
193
196
|
"Handoffs have not been gathered yet. "
|
|
194
197
|
"Call gather_handoffs() first."
|
|
195
198
|
)
|
|
199
|
+
raise RuntimeError(msg)
|
|
196
200
|
return self._handoffs
|
|
197
201
|
|
|
198
202
|
@field_validator("agent_type")
|
|
@@ -391,7 +395,7 @@ class WaldiezAgent(WaldiezBase):
|
|
|
391
395
|
return class_name # pragma: no cover
|
|
392
396
|
|
|
393
397
|
@property
|
|
394
|
-
def ag2_imports(self) -> set[str]:
|
|
398
|
+
def ag2_imports(self) -> set[str]: # pylint: disable=too-complex
|
|
395
399
|
"""Return the AG2 imports of the agent.
|
|
396
400
|
|
|
397
401
|
Returns
|
|
@@ -412,25 +416,28 @@ class WaldiezAgent(WaldiezBase):
|
|
|
412
416
|
case "UserProxyAgent":
|
|
413
417
|
imports.add("from autogen import UserProxyAgent")
|
|
414
418
|
case "RetrieveUserProxyAgent":
|
|
415
|
-
|
|
419
|
+
_imp = (
|
|
416
420
|
"from autogen.agentchat.contrib.retrieve_user_proxy_agent "
|
|
417
421
|
"import RetrieveUserProxyAgent"
|
|
418
422
|
)
|
|
423
|
+
imports.add(_imp)
|
|
419
424
|
case "MultimodalConversableAgent":
|
|
420
|
-
|
|
425
|
+
_imp = (
|
|
421
426
|
"from "
|
|
422
427
|
"autogen.agentchat.contrib.multimodal_conversable_agent "
|
|
423
428
|
"import MultimodalConversableAgent"
|
|
424
429
|
)
|
|
430
|
+
imports.add(_imp)
|
|
425
431
|
case "ReasoningAgent":
|
|
426
432
|
imports.add(
|
|
427
433
|
"from autogen.agents.experimental import ReasoningAgent"
|
|
428
434
|
)
|
|
429
435
|
case "CaptainAgent":
|
|
430
|
-
|
|
436
|
+
_imp = (
|
|
431
437
|
"from autogen.agentchat.contrib.captainagent "
|
|
432
438
|
"import CaptainAgent"
|
|
433
439
|
)
|
|
440
|
+
imports.add(_imp)
|
|
434
441
|
case "GroupChatManager": # pragma: no branch
|
|
435
442
|
imports.add("from autogen import GroupChat")
|
|
436
443
|
imports.add("from autogen.agentchat import GroupChatManager")
|
|
@@ -442,10 +449,11 @@ class WaldiezAgent(WaldiezBase):
|
|
|
442
449
|
case "ConversableAgent":
|
|
443
450
|
imports.add("from autogen import ConversableAgent")
|
|
444
451
|
case _: # pragma: no cover
|
|
445
|
-
|
|
452
|
+
msg = (
|
|
446
453
|
f"Unknown agent class: {agent_class}. "
|
|
447
454
|
"Please implement the imports for this class."
|
|
448
455
|
)
|
|
456
|
+
raise ValueError(msg)
|
|
449
457
|
return imports
|
|
450
458
|
|
|
451
459
|
def validate_linked_tools(
|
|
@@ -677,8 +685,8 @@ class WaldiezAgent(WaldiezBase):
|
|
|
677
685
|
nested_chat = WaldiezAgentNestedChat(
|
|
678
686
|
triggered_by=triggered_by,
|
|
679
687
|
messages=messages,
|
|
680
|
-
condition=chat_with_condition.condition,
|
|
681
|
-
available=chat_with_condition.available,
|
|
688
|
+
condition=chat_with_condition.condition,
|
|
689
|
+
available=chat_with_condition.available,
|
|
682
690
|
)
|
|
683
691
|
self.data.nested_chats.append(nested_chat)
|
|
684
692
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
4
|
+
# pyright: reportArgumentType=false
|
|
5
|
+
|
|
3
6
|
"""Common data structures for agents."""
|
|
4
7
|
|
|
5
|
-
from typing import Any
|
|
8
|
+
from typing import Any
|
|
6
9
|
|
|
7
10
|
from pydantic import ConfigDict, Field, model_validator
|
|
8
11
|
from pydantic.alias_generators import to_camel
|
|
@@ -67,14 +70,14 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
67
70
|
)
|
|
68
71
|
|
|
69
72
|
system_message: Annotated[
|
|
70
|
-
|
|
73
|
+
str | None,
|
|
71
74
|
Field(
|
|
72
75
|
None,
|
|
73
76
|
title="System message",
|
|
74
77
|
description="The agent's system message.",
|
|
75
78
|
alias="systemMessage",
|
|
76
79
|
),
|
|
77
|
-
]
|
|
80
|
+
]
|
|
78
81
|
human_input_mode: Annotated[
|
|
79
82
|
WaldiezAgentHumanInputMode,
|
|
80
83
|
Field(
|
|
@@ -83,9 +86,9 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
83
86
|
description="The human input mode to use for the agent.",
|
|
84
87
|
alias="humanInputMode",
|
|
85
88
|
),
|
|
86
|
-
]
|
|
89
|
+
]
|
|
87
90
|
code_execution_config: Annotated[
|
|
88
|
-
|
|
91
|
+
WaldiezAgentCodeExecutionConfig | Literal[False],
|
|
89
92
|
Field(
|
|
90
93
|
False,
|
|
91
94
|
title="Code execution config",
|
|
@@ -95,9 +98,9 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
95
98
|
),
|
|
96
99
|
alias="codeExecutionConfig",
|
|
97
100
|
),
|
|
98
|
-
]
|
|
101
|
+
]
|
|
99
102
|
agent_default_auto_reply: Annotated[
|
|
100
|
-
|
|
103
|
+
str | None,
|
|
101
104
|
Field(
|
|
102
105
|
None,
|
|
103
106
|
title="Agent's default auto reply",
|
|
@@ -106,9 +109,9 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
106
109
|
),
|
|
107
110
|
alias="agentDefaultAutoReply",
|
|
108
111
|
),
|
|
109
|
-
]
|
|
112
|
+
]
|
|
110
113
|
max_consecutive_auto_reply: Annotated[
|
|
111
|
-
|
|
114
|
+
int | None,
|
|
112
115
|
Field(
|
|
113
116
|
None,
|
|
114
117
|
title="Max consecutive auto reply",
|
|
@@ -118,7 +121,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
118
121
|
),
|
|
119
122
|
alias="maxConsecutiveAutoReply",
|
|
120
123
|
),
|
|
121
|
-
]
|
|
124
|
+
]
|
|
122
125
|
termination: Annotated[
|
|
123
126
|
WaldiezAgentTerminationMessage,
|
|
124
127
|
Field(
|
|
@@ -140,7 +143,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
140
143
|
),
|
|
141
144
|
alias="modelIds",
|
|
142
145
|
),
|
|
143
|
-
]
|
|
146
|
+
]
|
|
144
147
|
tools: Annotated[
|
|
145
148
|
list[WaldiezAgentLinkedTool],
|
|
146
149
|
Field(
|
|
@@ -148,7 +151,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
148
151
|
title="Tools",
|
|
149
152
|
description="A list of tools (id and executor) to register.",
|
|
150
153
|
),
|
|
151
|
-
]
|
|
154
|
+
]
|
|
152
155
|
nested_chats: Annotated[
|
|
153
156
|
list[WaldiezAgentNestedChat],
|
|
154
157
|
Field(
|
|
@@ -158,11 +161,11 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
158
161
|
),
|
|
159
162
|
alias="nestedChats",
|
|
160
163
|
),
|
|
161
|
-
]
|
|
164
|
+
]
|
|
162
165
|
context_variables: Annotated[
|
|
163
166
|
dict[str, Any],
|
|
164
167
|
Field(
|
|
165
|
-
default_factory=dict,
|
|
168
|
+
default_factory=dict,
|
|
166
169
|
title="Context variables",
|
|
167
170
|
description=(
|
|
168
171
|
"Context variables that provide a persistent context "
|
|
@@ -172,10 +175,10 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
172
175
|
),
|
|
173
176
|
alias="contextVariables",
|
|
174
177
|
),
|
|
175
|
-
]
|
|
178
|
+
]
|
|
176
179
|
|
|
177
180
|
update_agent_state_before_reply: Annotated[
|
|
178
|
-
list[
|
|
181
|
+
list[str | WaldiezAgentUpdateSystemMessage],
|
|
179
182
|
Field(
|
|
180
183
|
title="Update Agent State Before Reply",
|
|
181
184
|
alias="updateAgentStateBeforeReply",
|
|
@@ -188,7 +191,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
188
191
|
),
|
|
189
192
|
default_factory=list,
|
|
190
193
|
),
|
|
191
|
-
]
|
|
194
|
+
]
|
|
192
195
|
handoffs: Annotated[
|
|
193
196
|
list[str],
|
|
194
197
|
Field(
|
|
@@ -196,9 +199,9 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
196
199
|
title="Handoffs",
|
|
197
200
|
description="A list of handoffs (target ids) to register.",
|
|
198
201
|
),
|
|
199
|
-
]
|
|
202
|
+
]
|
|
200
203
|
after_work: Annotated[
|
|
201
|
-
|
|
204
|
+
WaldiezTransitionTarget | None,
|
|
202
205
|
Field(
|
|
203
206
|
None,
|
|
204
207
|
title="After work",
|
|
@@ -208,10 +211,10 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
208
211
|
),
|
|
209
212
|
alias="afterWork",
|
|
210
213
|
),
|
|
211
|
-
]
|
|
214
|
+
]
|
|
212
215
|
|
|
213
216
|
parent_id: Annotated[
|
|
214
|
-
|
|
217
|
+
str | None,
|
|
215
218
|
Field(
|
|
216
219
|
None,
|
|
217
220
|
title="Parent ID",
|
|
@@ -220,7 +223,7 @@ class WaldiezAgentData(WaldiezBase):
|
|
|
220
223
|
),
|
|
221
224
|
alias="parentId",
|
|
222
225
|
),
|
|
223
|
-
]
|
|
226
|
+
]
|
|
224
227
|
|
|
225
228
|
@model_validator(mode="after")
|
|
226
229
|
def update_context_variables(self) -> Self:
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez Agent Code Execution Configuration."""
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
6
|
-
|
|
7
5
|
from pydantic import Field
|
|
8
6
|
from typing_extensions import Annotated
|
|
9
7
|
|
|
@@ -28,25 +26,25 @@ class WaldiezAgentCodeExecutionConfig(WaldiezBase):
|
|
|
28
26
|
"""
|
|
29
27
|
|
|
30
28
|
work_dir: Annotated[
|
|
31
|
-
|
|
29
|
+
str | None,
|
|
32
30
|
Field(
|
|
33
31
|
default=None,
|
|
34
32
|
title="Working directory",
|
|
35
33
|
description="The working directory for the code execution.",
|
|
36
34
|
alias="workDir",
|
|
37
35
|
),
|
|
38
|
-
]
|
|
36
|
+
]
|
|
39
37
|
use_docker: Annotated[
|
|
40
|
-
|
|
38
|
+
bool | None,
|
|
41
39
|
Field(
|
|
42
40
|
default=None,
|
|
43
41
|
title="Use docker",
|
|
44
42
|
description="Run the code in a docker container.",
|
|
45
43
|
alias="useDocker",
|
|
46
44
|
),
|
|
47
|
-
]
|
|
45
|
+
]
|
|
48
46
|
timeout: Annotated[
|
|
49
|
-
|
|
47
|
+
float | None,
|
|
50
48
|
Field(
|
|
51
49
|
default=None,
|
|
52
50
|
title="Timeout",
|
|
@@ -54,15 +52,15 @@ class WaldiezAgentCodeExecutionConfig(WaldiezBase):
|
|
|
54
52
|
"The timeout for the code execution.Default: No timeout"
|
|
55
53
|
),
|
|
56
54
|
),
|
|
57
|
-
]
|
|
55
|
+
]
|
|
58
56
|
last_n_messages: Annotated[
|
|
59
|
-
|
|
57
|
+
int | None,
|
|
60
58
|
Field(
|
|
61
59
|
default=None,
|
|
62
60
|
title="Last N Messages",
|
|
63
61
|
description="The number of previous messages in the chat to use.",
|
|
64
62
|
),
|
|
65
|
-
]
|
|
63
|
+
]
|
|
66
64
|
functions: Annotated[
|
|
67
65
|
list[str],
|
|
68
66
|
Field(
|
|
@@ -70,4 +68,4 @@ class WaldiezAgentCodeExecutionConfig(WaldiezBase):
|
|
|
70
68
|
title="Functions",
|
|
71
69
|
description="If not using docker, the function ids to use",
|
|
72
70
|
),
|
|
73
|
-
]
|
|
71
|
+
]
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez Agent Termination Message Check."""
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
6
|
-
|
|
7
5
|
from pydantic import Field, model_validator
|
|
8
6
|
from typing_extensions import Annotated, Literal, Self
|
|
9
7
|
|
|
@@ -45,7 +43,7 @@ class WaldiezAgentTerminationMessage(WaldiezBase):
|
|
|
45
43
|
"none, keyword, method"
|
|
46
44
|
),
|
|
47
45
|
),
|
|
48
|
-
]
|
|
46
|
+
]
|
|
49
47
|
keywords: Annotated[
|
|
50
48
|
list[str],
|
|
51
49
|
Field(
|
|
@@ -56,9 +54,9 @@ class WaldiezAgentTerminationMessage(WaldiezBase):
|
|
|
56
54
|
" the keywords to search in the message."
|
|
57
55
|
),
|
|
58
56
|
),
|
|
59
|
-
]
|
|
57
|
+
]
|
|
60
58
|
criterion: Annotated[
|
|
61
|
-
|
|
59
|
+
Literal["found", "ending", "starting", "exact"] | None,
|
|
62
60
|
Field(
|
|
63
61
|
"exact",
|
|
64
62
|
title="Criterion",
|
|
@@ -67,9 +65,9 @@ class WaldiezAgentTerminationMessage(WaldiezBase):
|
|
|
67
65
|
"the criterion to use (e.g.: in, endswith, ==)"
|
|
68
66
|
),
|
|
69
67
|
),
|
|
70
|
-
]
|
|
68
|
+
]
|
|
71
69
|
method_content: Annotated[
|
|
72
|
-
|
|
70
|
+
str | None,
|
|
73
71
|
Field(
|
|
74
72
|
None,
|
|
75
73
|
title="Method content",
|
|
@@ -80,22 +78,22 @@ class WaldiezAgentTerminationMessage(WaldiezBase):
|
|
|
80
78
|
"bool (whether the message is a termination message or not.)"
|
|
81
79
|
),
|
|
82
80
|
),
|
|
83
|
-
]
|
|
81
|
+
]
|
|
84
82
|
|
|
85
83
|
_string: str = "None"
|
|
86
84
|
|
|
87
85
|
def get_termination_function(
|
|
88
86
|
self,
|
|
89
|
-
name_prefix:
|
|
90
|
-
name_suffix:
|
|
87
|
+
name_prefix: str | None = None,
|
|
88
|
+
name_suffix: str | None = None,
|
|
91
89
|
) -> tuple[str, str]:
|
|
92
90
|
"""Get the termination function.
|
|
93
91
|
|
|
94
92
|
Parameters
|
|
95
93
|
----------
|
|
96
|
-
name_prefix : str
|
|
94
|
+
name_prefix : str | None
|
|
97
95
|
The function name prefix.
|
|
98
|
-
name_suffix : str
|
|
96
|
+
name_suffix : str | None
|
|
99
97
|
The function name suffix.
|
|
100
98
|
|
|
101
99
|
Returns
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Update the agent's system message before they reply."""
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
6
|
-
|
|
7
5
|
from pydantic import Field, model_validator
|
|
8
6
|
from typing_extensions import Annotated, Literal, Self
|
|
9
7
|
|
|
@@ -78,8 +76,8 @@ class WaldiezAgentUpdateSystemMessage(WaldiezBase):
|
|
|
78
76
|
|
|
79
77
|
def get_content(
|
|
80
78
|
self,
|
|
81
|
-
name_prefix:
|
|
82
|
-
name_suffix:
|
|
79
|
+
name_prefix: str | None = None,
|
|
80
|
+
name_suffix: str | None = None,
|
|
83
81
|
) -> tuple[str, str]:
|
|
84
82
|
"""Get the update function content.
|
|
85
83
|
|
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
|
|
5
|
+
from collections.abc import Iterator
|
|
6
6
|
|
|
7
7
|
from pydantic import Field, model_validator
|
|
8
8
|
from typing_extensions import Annotated, Self
|
|
@@ -44,7 +44,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
44
44
|
description="The User proxy agents in the flow.",
|
|
45
45
|
default_factory=list,
|
|
46
46
|
),
|
|
47
|
-
]
|
|
47
|
+
]
|
|
48
48
|
assistantAgents: Annotated[
|
|
49
49
|
list[WaldiezAssistant],
|
|
50
50
|
Field(
|
|
@@ -52,7 +52,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
52
52
|
description="The assistant agents in the flow.",
|
|
53
53
|
default_factory=list,
|
|
54
54
|
),
|
|
55
|
-
]
|
|
55
|
+
]
|
|
56
56
|
ragUserProxyAgents: Annotated[
|
|
57
57
|
list[WaldiezRagUserProxy],
|
|
58
58
|
Field(
|
|
@@ -60,7 +60,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
60
60
|
description="The RAG user proxy agents in the flow.",
|
|
61
61
|
default_factory=list,
|
|
62
62
|
),
|
|
63
|
-
]
|
|
63
|
+
]
|
|
64
64
|
reasoningAgents: Annotated[
|
|
65
65
|
list[WaldiezReasoningAgent],
|
|
66
66
|
Field(
|
|
@@ -68,7 +68,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
68
68
|
description="The Reasoning agents in the flow.",
|
|
69
69
|
default_factory=list,
|
|
70
70
|
),
|
|
71
|
-
]
|
|
71
|
+
]
|
|
72
72
|
captainAgents: Annotated[
|
|
73
73
|
list[WaldiezCaptainAgent],
|
|
74
74
|
Field(
|
|
@@ -76,7 +76,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
76
76
|
description="The Captain agents in the flow.",
|
|
77
77
|
default_factory=list,
|
|
78
78
|
),
|
|
79
|
-
]
|
|
79
|
+
]
|
|
80
80
|
groupManagerAgents: Annotated[
|
|
81
81
|
list[WaldiezGroupManager],
|
|
82
82
|
Field(
|
|
@@ -84,7 +84,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
84
84
|
description="The Group manager agents in the flow.",
|
|
85
85
|
default_factory=list,
|
|
86
86
|
),
|
|
87
|
-
]
|
|
87
|
+
]
|
|
88
88
|
docAgents: Annotated[
|
|
89
89
|
list[WaldiezDocAgent],
|
|
90
90
|
Field(
|
|
@@ -92,7 +92,7 @@ class WaldiezAgents(WaldiezBase):
|
|
|
92
92
|
description="The Document agents in the flow.",
|
|
93
93
|
default_factory=list,
|
|
94
94
|
),
|
|
95
|
-
]
|
|
95
|
+
]
|
|
96
96
|
|
|
97
97
|
@property
|
|
98
98
|
def members(self) -> Iterator[WaldiezAgent]:
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
4
|
+
# pyright: reportArgumentType=false,reportIncompatibleVariableOverride=false
|
|
5
|
+
|
|
3
6
|
"""Assistant agent model."""
|
|
4
7
|
|
|
5
8
|
from pydantic import Field
|
|
@@ -24,7 +27,7 @@ class WaldiezAssistant(WaldiezAgent):
|
|
|
24
27
|
The assistant agent's data
|
|
25
28
|
"""
|
|
26
29
|
|
|
27
|
-
agent_type: Annotated[
|
|
30
|
+
agent_type: Annotated[
|
|
28
31
|
Literal["assistant"],
|
|
29
32
|
Field(
|
|
30
33
|
"assistant",
|
|
@@ -33,11 +36,11 @@ class WaldiezAssistant(WaldiezAgent):
|
|
|
33
36
|
alias="agentType",
|
|
34
37
|
),
|
|
35
38
|
] = "assistant"
|
|
36
|
-
data: Annotated[
|
|
39
|
+
data: Annotated[
|
|
37
40
|
WaldiezAssistantData,
|
|
38
41
|
Field(
|
|
39
42
|
title="Data",
|
|
40
43
|
description="The assistant agent's data",
|
|
41
|
-
default_factory=WaldiezAssistantData,
|
|
44
|
+
default_factory=WaldiezAssistantData,
|
|
42
45
|
),
|
|
43
46
|
]
|
|
@@ -31,7 +31,7 @@ class WaldiezAssistantData(WaldiezAgentData):
|
|
|
31
31
|
description="The human input mode, Defaults to `NEVER`",
|
|
32
32
|
alias="humanInputMode",
|
|
33
33
|
),
|
|
34
|
-
]
|
|
34
|
+
]
|
|
35
35
|
is_multimodal: Annotated[
|
|
36
36
|
bool,
|
|
37
37
|
Field(
|
|
@@ -40,4 +40,4 @@ class WaldiezAssistantData(WaldiezAgentData):
|
|
|
40
40
|
description="A flag to indicate if the agent is multimodal.",
|
|
41
41
|
alias="isMultimodal",
|
|
42
42
|
),
|
|
43
|
-
]
|
|
43
|
+
]
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0.
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
|
+
|
|
4
|
+
# pyright: reportArgumentType=false,reportIncompatibleVariableOverride=false
|
|
5
|
+
|
|
3
6
|
"""Waldiez captain agent model."""
|
|
4
7
|
|
|
5
8
|
from typing import Literal
|
|
@@ -26,7 +29,7 @@ class WaldiezCaptainAgent(WaldiezAgent):
|
|
|
26
29
|
The captain agent's data.
|
|
27
30
|
"""
|
|
28
31
|
|
|
29
|
-
agent_type: Annotated[
|
|
32
|
+
agent_type: Annotated[
|
|
30
33
|
Literal["captain"],
|
|
31
34
|
Field(
|
|
32
35
|
default="captain",
|
|
@@ -34,12 +37,12 @@ class WaldiezCaptainAgent(WaldiezAgent):
|
|
|
34
37
|
description="The agent type: 'captain' for a captain agent",
|
|
35
38
|
alias="agentType",
|
|
36
39
|
),
|
|
37
|
-
]
|
|
38
|
-
data: Annotated[
|
|
40
|
+
]
|
|
41
|
+
data: Annotated[
|
|
39
42
|
WaldiezCaptainAgentData,
|
|
40
43
|
Field(
|
|
41
44
|
title="Data",
|
|
42
45
|
description="The captain agent's data",
|
|
43
|
-
default_factory=WaldiezCaptainAgentData,
|
|
46
|
+
default_factory=WaldiezCaptainAgentData,
|
|
44
47
|
),
|
|
45
48
|
]
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# Copyright (c) 2024 - 2025 Waldiez and contributors.
|
|
3
3
|
"""Waldiez captain agent data."""
|
|
4
4
|
|
|
5
|
-
from typing import Optional
|
|
6
|
-
|
|
7
5
|
from pydantic import Field
|
|
8
6
|
from typing_extensions import Annotated, Literal
|
|
9
7
|
|
|
@@ -32,16 +30,16 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
32
30
|
description="The agent lib",
|
|
33
31
|
alias="agentLib",
|
|
34
32
|
),
|
|
35
|
-
]
|
|
33
|
+
]
|
|
36
34
|
tool_lib: Annotated[
|
|
37
|
-
|
|
35
|
+
Literal["default"] | None,
|
|
38
36
|
Field(
|
|
39
37
|
default=None,
|
|
40
38
|
title="Tool lib",
|
|
41
39
|
description="Whether to use the default tool lib",
|
|
42
40
|
alias="toolLib",
|
|
43
41
|
),
|
|
44
|
-
]
|
|
42
|
+
]
|
|
45
43
|
max_round: Annotated[
|
|
46
44
|
int,
|
|
47
45
|
Field(
|
|
@@ -50,7 +48,7 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
50
48
|
description="The maximum number of rounds in a group chat",
|
|
51
49
|
alias="maxRound",
|
|
52
50
|
),
|
|
53
|
-
]
|
|
51
|
+
]
|
|
54
52
|
max_turns: Annotated[
|
|
55
53
|
int,
|
|
56
54
|
Field(
|
|
@@ -59,4 +57,4 @@ class WaldiezCaptainAgentData(WaldiezAgentData):
|
|
|
59
57
|
description="The maximum number of turns for a chat",
|
|
60
58
|
alias="maxTurns",
|
|
61
59
|
),
|
|
62
|
-
]
|
|
60
|
+
]
|