quantalogic 0.61.3__py3-none-any.whl → 0.80__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.
- quantalogic/agent.py +0 -1
- quantalogic/codeact/TODO.md +14 -0
- quantalogic/codeact/agent.py +400 -421
- quantalogic/codeact/cli.py +42 -224
- quantalogic/codeact/cli_commands/__init__.py +0 -0
- quantalogic/codeact/cli_commands/create_toolbox.py +45 -0
- quantalogic/codeact/cli_commands/install_toolbox.py +20 -0
- quantalogic/codeact/cli_commands/list_executor.py +15 -0
- quantalogic/codeact/cli_commands/list_reasoners.py +15 -0
- quantalogic/codeact/cli_commands/list_toolboxes.py +47 -0
- quantalogic/codeact/cli_commands/task.py +215 -0
- quantalogic/codeact/cli_commands/tool_info.py +24 -0
- quantalogic/codeact/cli_commands/uninstall_toolbox.py +43 -0
- quantalogic/codeact/config.yaml +21 -0
- quantalogic/codeact/constants.py +1 -1
- quantalogic/codeact/events.py +12 -5
- quantalogic/codeact/examples/README.md +342 -0
- quantalogic/codeact/examples/agent_sample.yaml +29 -0
- quantalogic/codeact/executor.py +186 -0
- quantalogic/codeact/history_manager.py +94 -0
- quantalogic/codeact/llm_util.py +3 -22
- quantalogic/codeact/plugin_manager.py +92 -0
- quantalogic/codeact/prompts/generate_action.j2 +65 -14
- quantalogic/codeact/prompts/generate_program.j2 +32 -19
- quantalogic/codeact/react_agent.py +318 -0
- quantalogic/codeact/reasoner.py +185 -0
- quantalogic/codeact/templates/toolbox/README.md.j2 +10 -0
- quantalogic/codeact/templates/toolbox/pyproject.toml.j2 +16 -0
- quantalogic/codeact/templates/toolbox/tools.py.j2 +6 -0
- quantalogic/codeact/templates.py +7 -0
- quantalogic/codeact/tools_manager.py +242 -119
- quantalogic/codeact/utils.py +16 -89
- quantalogic/codeact/xml_utils.py +126 -0
- quantalogic/flow/flow.py +151 -41
- quantalogic/flow/flow_extractor.py +61 -1
- quantalogic/flow/flow_generator.py +34 -6
- quantalogic/flow/flow_manager.py +64 -25
- quantalogic/flow/flow_manager_schema.py +32 -0
- quantalogic/tools/action_gen.py +1 -1
- quantalogic/tools/tool.py +531 -109
- {quantalogic-0.61.3.dist-info → quantalogic-0.80.dist-info}/METADATA +3 -3
- {quantalogic-0.61.3.dist-info → quantalogic-0.80.dist-info}/RECORD +45 -22
- {quantalogic-0.61.3.dist-info → quantalogic-0.80.dist-info}/WHEEL +1 -1
- quantalogic-0.80.dist-info/entry_points.txt +3 -0
- quantalogic-0.61.3.dist-info/entry_points.txt +0 -6
- {quantalogic-0.61.3.dist-info → quantalogic-0.80.dist-info}/LICENSE +0 -0
@@ -223,16 +223,48 @@ class TransitionDefinition(BaseModel):
|
|
223
223
|
)
|
224
224
|
|
225
225
|
|
226
|
+
class LoopDefinition(BaseModel):
|
227
|
+
"""Definition of a loop within the workflow."""
|
228
|
+
nodes: List[str] = Field(..., description="List of node names in the loop.")
|
229
|
+
condition: str = Field(..., description="Python expression using 'ctx' for the loop condition.")
|
230
|
+
exit_node: str = Field(..., description="Node to transition to when the loop ends.")
|
231
|
+
|
232
|
+
|
226
233
|
class WorkflowStructure(BaseModel):
|
227
234
|
"""Structure defining the workflow's execution flow."""
|
228
235
|
start: Optional[str] = Field(None, description="Name of the starting node.")
|
229
236
|
transitions: List[TransitionDefinition] = Field(
|
230
237
|
default_factory=list, description="List of transitions between nodes."
|
231
238
|
)
|
239
|
+
loops: List[LoopDefinition] = Field(
|
240
|
+
default_factory=list, description="List of loop definitions (optional, for explicit loop support)."
|
241
|
+
)
|
232
242
|
convergence_nodes: List[str] = Field(
|
233
243
|
default_factory=list, description="List of nodes where branches converge."
|
234
244
|
)
|
235
245
|
|
246
|
+
@model_validator(mode="before")
|
247
|
+
@classmethod
|
248
|
+
def check_loop_nodes(cls, data: Any) -> Any:
|
249
|
+
"""Ensure all nodes in loops exist in the workflow.
|
250
|
+
|
251
|
+
Args:
|
252
|
+
data: Raw data to validate.
|
253
|
+
|
254
|
+
Returns:
|
255
|
+
Validated data.
|
256
|
+
|
257
|
+
Raises:
|
258
|
+
ValueError: If loop nodes are not defined.
|
259
|
+
"""
|
260
|
+
loops = data.get("loops", [])
|
261
|
+
nodes = set(data.get("nodes", {}).keys())
|
262
|
+
for loop in loops:
|
263
|
+
for node in loop["nodes"] + [loop["exit_node"]]:
|
264
|
+
if node not in nodes:
|
265
|
+
raise ValueError(f"Loop node '{node}' not defined in nodes")
|
266
|
+
return data
|
267
|
+
|
236
268
|
|
237
269
|
class WorkflowDefinition(BaseModel):
|
238
270
|
"""Top-level definition of the workflow."""
|
quantalogic/tools/action_gen.py
CHANGED
@@ -8,8 +8,8 @@ from typing import Callable, Dict, List
|
|
8
8
|
import litellm
|
9
9
|
import typer
|
10
10
|
from loguru import logger
|
11
|
+
from quantalogic_pythonbox.python_interpreter import execute_async
|
11
12
|
|
12
|
-
from quantalogic.python_interpreter import execute_async
|
13
13
|
from quantalogic.tools.tool import Tool, ToolArgument
|
14
14
|
|
15
15
|
# Configure loguru to log to a file with rotation, matching original
|