fix: correct task scheduling and simplify agent internals
Fix queue cancellation, concurrency limits and worker status updates. Use direct Explorer imports, split the Diagnoser loop into helpers and remove unused tool registration and prompt-builder code. Correct model caching, endpoint selection and retry handling.
This commit is contained in:
1 parent
67248c887e
commit
12d7902a82
92 files changed
+1085
-1763
No files matched your search
@@ -16,7 +16,7 @@ from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
AppendNoteArgs,
|
||||
AppendNotePure,
|
||||
@@ -35,8 +35,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_append_note_pure_tool_subclass_and_registry():
|
||||
"""Verify AppendNotePureTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_append_note_pure_tool_subclass():
|
||||
"""Verify AppendNotePureTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(AppendNotePureTool, ArtemisTool)
|
||||
assert issubclass(AppendNotePure, ArtemisTool)
|
||||
assert isinstance(append_note_pure, ArtemisTool)
|
||||
@@ -46,11 +46,6 @@ def test_append_note_pure_tool_subclass_and_registry():
|
||||
assert append_note_pure.category == "memory"
|
||||
assert append_note_pure.args_schema == AppendNoteArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("append_note_pure")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, AppendNotePureTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = append_note_pure.to_genai_declaration()
|
||||
assert declaration.name == "append_note_pure"
|
||||
|
||||
@@ -17,7 +17,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
AppendNote,
|
||||
AppendNoteArgs,
|
||||
@@ -39,8 +39,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_append_note_tool_subclass_and_registry():
|
||||
"""Verify AppendNoteTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_append_note_tool_subclass():
|
||||
"""Verify AppendNoteTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(AppendNoteTool, ArtemisTool)
|
||||
assert issubclass(AppendNote, ArtemisTool)
|
||||
assert isinstance(append_note, ArtemisTool)
|
||||
@@ -50,11 +50,6 @@ def test_append_note_tool_subclass_and_registry():
|
||||
assert append_note.category == "memory"
|
||||
assert append_note.args_schema == AppendNoteArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("append_note")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, AppendNoteTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = append_note.to_genai_declaration()
|
||||
assert declaration.name == "append_note"
|
||||
|
||||
@@ -373,9 +373,9 @@ async def test_analyze_task_output_tool(mock_get_llm, mock_ctx):
|
||||
del _FINISHED_TASKS_LOGS[task_id]
|
||||
|
||||
|
||||
def test_run_adb_command_tool_subclass_and_registry():
|
||||
"""Verify RunAdbCommandTool is a subclass of ArtemisTool and properly registered."""
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
def test_run_adb_command_tool_subclass():
|
||||
"""Verify RunAdbCommandTool is a subclass of ArtemisTool."""
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.command_tool import (
|
||||
RunAdbCommand,
|
||||
RunAdbCommandArgs,
|
||||
@@ -392,11 +392,6 @@ def test_run_adb_command_tool_subclass_and_registry():
|
||||
assert run_adb_command.category == "system"
|
||||
assert run_adb_command.args_schema == RunAdbCommandArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("run_adb_command")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, RunAdbCommandTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = run_adb_command.to_genai_declaration()
|
||||
assert declaration.name == "run_adb_command"
|
||||
@@ -421,9 +416,9 @@ async def test_run_adb_command_tool_mock_driver_execute():
|
||||
assert "pm list packages" in driver.action_history[-1]["command"]
|
||||
|
||||
|
||||
def test_manage_task_tool_subclass_and_registry():
|
||||
"""Verify ManageTaskTool is a subclass of ArtemisTool and properly registered."""
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
def test_manage_task_tool_subclass():
|
||||
"""Verify ManageTaskTool is a subclass of ArtemisTool."""
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.command_tool import (
|
||||
ManageTask,
|
||||
ManageTaskArgs,
|
||||
@@ -440,11 +435,6 @@ def test_manage_task_tool_subclass_and_registry():
|
||||
assert manage_task.category == "system"
|
||||
assert manage_task.args_schema == ManageTaskArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("manage_task")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, ManageTaskTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = manage_task.to_genai_declaration()
|
||||
assert declaration.name == "manage_task"
|
||||
@@ -488,9 +478,9 @@ async def test_manage_task_tool_direct_execute(mock_ctx):
|
||||
registry.background.clear()
|
||||
|
||||
|
||||
def test_analyze_task_output_tool_subclass_and_registry():
|
||||
"""Verify AnalyzeTaskOutputTool is a subclass of ArtemisTool and properly registered."""
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
def test_analyze_task_output_tool_subclass():
|
||||
"""Verify AnalyzeTaskOutputTool is a subclass of ArtemisTool."""
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.command_tool import (
|
||||
AnalyzeTaskOutput,
|
||||
AnalyzeTaskOutputArgs,
|
||||
@@ -507,11 +497,6 @@ def test_analyze_task_output_tool_subclass_and_registry():
|
||||
assert analyze_task_output.category == "system"
|
||||
assert analyze_task_output.args_schema == AnalyzeTaskOutputArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("analyze_task_output")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, AnalyzeTaskOutputTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = analyze_task_output.to_genai_declaration()
|
||||
assert declaration.name == "analyze_task_output"
|
||||
@@ -558,9 +543,9 @@ async def test_analyze_task_output_tool_direct_execute(mock_get_llm, mock_ctx):
|
||||
del _FINISHED_TASKS_LOGS[task_id]
|
||||
|
||||
|
||||
def test_run_short_adb_command_tool_subclass_and_registry():
|
||||
"""Verify RunShortAdbCommandTool is a subclass of ArtemisTool and properly registered."""
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
def test_run_short_adb_command_tool_subclass():
|
||||
"""Verify RunShortAdbCommandTool is a subclass of ArtemisTool."""
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.command_tool import (
|
||||
RunShortAdbCommand,
|
||||
RunShortAdbCommandArgs,
|
||||
@@ -577,11 +562,6 @@ def test_run_short_adb_command_tool_subclass_and_registry():
|
||||
assert run_short_adb_command.category == "system"
|
||||
assert run_short_adb_command.args_schema == RunShortAdbCommandArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("run_short_adb_command")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, RunShortAdbCommandTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = run_short_adb_command.to_genai_declaration()
|
||||
assert declaration.name == "run_short_adb_command"
|
||||
|
||||
@@ -168,9 +168,9 @@ class TestCommitteeTool(unittest.IsolatedAsyncioTestCase):
|
||||
# Clean up temp directory
|
||||
shutil.rmtree(temp_dir)
|
||||
|
||||
def test_ask_committee_tool_subclass_and_registry(self):
|
||||
"""Verify AskCommitteeTool is a subclass of ArtemisTool and properly registered."""
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
def test_ask_committee_tool_subclass(self):
|
||||
"""Verify AskCommitteeTool is a subclass of ArtemisTool."""
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.committee_tool import (
|
||||
AskCommittee,
|
||||
AskCommitteeArgs,
|
||||
@@ -191,11 +191,6 @@ class TestCommitteeTool(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(ask_committee.category, "custom")
|
||||
self.assertEqual(ask_committee.args_schema, AskCommitteeArgs)
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("ask_committee")
|
||||
self.assertIsNotNone(reg_tool)
|
||||
self.assertIsInstance(reg_tool, AskCommitteeTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = ask_committee.to_genai_declaration()
|
||||
self.assertEqual(declaration.name, "ask_committee")
|
||||
|
||||
@@ -27,7 +27,7 @@ from artemis.agents.explorer.constants import (
|
||||
)
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.explorer_tool import (
|
||||
AskExplorerArgs,
|
||||
AskExplorerTool,
|
||||
@@ -122,9 +122,7 @@ def test_description_does_not_depend_on_the_tier(version):
|
||||
assert tool.version == version
|
||||
|
||||
|
||||
def test_registry_and_wrapper_export():
|
||||
reg_tool = ToolRegistry.get("ask_explorer")
|
||||
assert isinstance(reg_tool, AskExplorerTool)
|
||||
def test_wrapper_export():
|
||||
assert ask_explorer_wrapper.tool_fn_getter is get_ask_explorer_tool
|
||||
assert ask_explorer_wrapper.on_success_fn("x") == "x"
|
||||
assert "boom" in ask_explorer_wrapper.on_failure_fn("boom")
|
||||
|
||||
@@ -64,9 +64,9 @@ async def test_ask_vision_coder_success():
|
||||
assert result == vision_coder_outcome
|
||||
|
||||
|
||||
def test_ask_image_processor_tool_subclass_and_registry():
|
||||
"""Verify AskImageProcessorTool is an ArtemisTool subclass and registered in ToolRegistry."""
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
def test_ask_image_processor_tool_subclass():
|
||||
"""Verify AskImageProcessorTool is an ArtemisTool subclass."""
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.image_processor_tool import (
|
||||
AskImageProcessor,
|
||||
AskImageProcessorTool,
|
||||
@@ -87,11 +87,6 @@ def test_ask_image_processor_tool_subclass_and_registry():
|
||||
assert ask_image_processor.category == "custom"
|
||||
assert ask_image_processor.args_schema == AskVisionCoderArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("ask_image_processor")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, AskImageProcessorTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = ask_image_processor.to_genai_declaration()
|
||||
assert declaration.name == "ask_image_processor"
|
||||
|
||||
@@ -17,7 +17,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.drivers.base import BaseDeviceDriver
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.mobile.launch_app import (
|
||||
LaunchApp,
|
||||
LaunchAppArgs,
|
||||
@@ -49,8 +49,8 @@ def mock_state():
|
||||
return MagicMock(spec=State)
|
||||
|
||||
|
||||
def test_launch_app_tool_subclass_and_registry():
|
||||
"""Verify LaunchAppTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_launch_app_tool_subclass():
|
||||
"""Verify LaunchAppTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(LaunchAppTool, ArtemisTool)
|
||||
assert issubclass(LaunchApp, ArtemisTool)
|
||||
assert isinstance(launch_app, ArtemisTool)
|
||||
@@ -60,11 +60,6 @@ def test_launch_app_tool_subclass_and_registry():
|
||||
assert launch_app.category == "action"
|
||||
assert launch_app.args_schema == LaunchAppArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("launch_app")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, LaunchAppTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = launch_app.to_genai_declaration()
|
||||
assert declaration.name == "launch_app"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
ListNotesArgs,
|
||||
ListNotesPure,
|
||||
@@ -35,8 +35,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_list_notes_pure_tool_subclass_and_registry():
|
||||
"""Verify ListNotesPureTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_list_notes_pure_tool_subclass():
|
||||
"""Verify ListNotesPureTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(ListNotesPureTool, ArtemisTool)
|
||||
assert issubclass(ListNotesPure, ArtemisTool)
|
||||
assert isinstance(list_notes_pure, ArtemisTool)
|
||||
@@ -46,11 +46,6 @@ def test_list_notes_pure_tool_subclass_and_registry():
|
||||
assert list_notes_pure.category == "memory"
|
||||
assert list_notes_pure.args_schema == ListNotesArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("list_notes_pure")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, ListNotesPureTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = list_notes_pure.to_genai_declaration()
|
||||
assert declaration.name == "list_notes_pure"
|
||||
|
||||
@@ -16,7 +16,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
ListNotes,
|
||||
ListNotesArgs,
|
||||
@@ -39,8 +39,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_list_notes_tool_subclass_and_registry():
|
||||
"""Verify ListNotesTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_list_notes_tool_subclass():
|
||||
"""Verify ListNotesTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(ListNotesTool, ArtemisTool)
|
||||
assert issubclass(ListNotes, ArtemisTool)
|
||||
assert isinstance(list_notes, ArtemisTool)
|
||||
@@ -50,11 +50,6 @@ def test_list_notes_tool_subclass_and_registry():
|
||||
assert list_notes.category == "memory"
|
||||
assert list_notes.args_schema == ListNotesArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("list_notes")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, ListNotesTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = list_notes.to_genai_declaration()
|
||||
assert declaration.name == "list_notes"
|
||||
|
||||
@@ -16,7 +16,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.log_tool import (
|
||||
AnalyzeLogs,
|
||||
AnalyzeLogsArgs,
|
||||
@@ -88,8 +88,8 @@ async def test_analyze_logs_tool_no_context():
|
||||
assert result == "Error: ArtemisContext is required for LogAnalyzer."
|
||||
|
||||
|
||||
def test_analyze_logs_tool_subclass_and_registry():
|
||||
"""Verify AnalyzeLogsTool is an ArtemisTool subclass and registered in ToolRegistry."""
|
||||
def test_analyze_logs_tool_subclass():
|
||||
"""Verify AnalyzeLogsTool is an ArtemisTool subclass."""
|
||||
assert issubclass(AnalyzeLogsTool, ArtemisTool)
|
||||
assert issubclass(AnalyzeLogs, ArtemisTool)
|
||||
assert issubclass(LogTool, ArtemisTool)
|
||||
@@ -100,11 +100,6 @@ def test_analyze_logs_tool_subclass_and_registry():
|
||||
assert analyze_logs.category == "custom"
|
||||
assert analyze_logs.args_schema == AnalyzeLogsArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("analyze_logs")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, AnalyzeLogsTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = analyze_logs.to_genai_declaration()
|
||||
assert declaration.name == "analyze_logs"
|
||||
|
||||
@@ -21,7 +21,7 @@ from langchain_core.messages import ToolMessage
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.object_detection_tool import (
|
||||
ObjectDetection,
|
||||
ObjectDetectionArgs,
|
||||
@@ -41,7 +41,7 @@ from artemis.tools.object_detection_tool import (
|
||||
import pytest
|
||||
|
||||
|
||||
def test_object_detection_tool_subclass_and_registry():
|
||||
def test_object_detection_tool_subclass():
|
||||
"""Verify ObjectDetectionTool and OperatorObjectDetectionTool subclass ArtemisTool and register."""
|
||||
assert issubclass(ObjectDetectionTool, ArtemisTool)
|
||||
assert issubclass(ObjectDetection, ArtemisTool)
|
||||
@@ -65,11 +65,6 @@ def test_object_detection_tool_subclass_and_registry():
|
||||
assert operator_object_detection.category == "perception"
|
||||
assert operator_object_detection.args_schema == OperatorObjectDetectionArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("object_detection")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, ObjectDetectionTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = object_detection.to_genai_declaration()
|
||||
assert declaration.name == "object_detection"
|
||||
|
||||
@@ -18,7 +18,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.drivers.base import BaseDeviceDriver
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.mobile.ocr import (
|
||||
OCRRecognition,
|
||||
OcrArgs,
|
||||
@@ -63,8 +63,8 @@ def mock_state(tmp_path):
|
||||
return state
|
||||
|
||||
|
||||
def test_ocr_tool_subclass_and_registry():
|
||||
"""Verify OcrRecognitionTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_ocr_tool_subclass():
|
||||
"""Verify OcrRecognitionTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(OcrRecognitionTool, ArtemisTool)
|
||||
assert issubclass(OcrRecognition, ArtemisTool)
|
||||
assert issubclass(OCRRecognition, ArtemisTool)
|
||||
@@ -76,11 +76,6 @@ def test_ocr_tool_subclass_and_registry():
|
||||
assert ocr_recognition.category == "explorer"
|
||||
assert ocr_recognition.args_schema == OcrArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("ocr_recognition")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, OcrRecognitionTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = ocr_recognition.to_genai_declaration()
|
||||
assert declaration.name == "ocr_recognition"
|
||||
|
||||
@@ -16,7 +16,7 @@ from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.drivers.base import BaseDeviceDriver
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.mobile.read_hierarchy import (
|
||||
GetUIHierarchy,
|
||||
GetUiHierarchy,
|
||||
@@ -46,8 +46,8 @@ def mock_driver():
|
||||
return driver
|
||||
|
||||
|
||||
def test_get_ui_hierarchy_tool_subclass_and_registry():
|
||||
"""Verify GetUiHierarchyTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_get_ui_hierarchy_tool_subclass():
|
||||
"""Verify GetUiHierarchyTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(GetUiHierarchyTool, ArtemisTool)
|
||||
assert issubclass(GetUiHierarchy, ArtemisTool)
|
||||
assert issubclass(GetUIHierarchy, ArtemisTool)
|
||||
@@ -58,11 +58,6 @@ def test_get_ui_hierarchy_tool_subclass_and_registry():
|
||||
assert get_ui_hierarchy.category == "diagnostic"
|
||||
assert get_ui_hierarchy.args_schema == GetUiHierarchyArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("get_ui_hierarchy")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, GetUiHierarchyTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = get_ui_hierarchy.to_genai_declaration()
|
||||
assert declaration.name == "get_ui_hierarchy"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.mobile.read_logs import (
|
||||
ReadLogs,
|
||||
ReadLogsArgs,
|
||||
@@ -33,8 +33,8 @@ def mock_ctx():
|
||||
return ctx
|
||||
|
||||
|
||||
def test_read_logs_tool_subclass_and_registry():
|
||||
"""Verify ReadLogsTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_read_logs_tool_subclass():
|
||||
"""Verify ReadLogsTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(ReadLogsTool, ArtemisTool)
|
||||
assert issubclass(ReadLogs, ArtemisTool)
|
||||
assert issubclass(ReadLogsToolAlias, ArtemisTool)
|
||||
@@ -45,11 +45,6 @@ def test_read_logs_tool_subclass_and_registry():
|
||||
assert read_logs.category == "diagnostic"
|
||||
assert read_logs.args_schema == ReadLogsArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("read_logs")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, ReadLogsTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = read_logs.to_genai_declaration()
|
||||
assert declaration.name == "read_logs"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
ReadNoteArgs,
|
||||
ReadNotePure,
|
||||
@@ -35,8 +35,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_read_note_pure_tool_subclass_and_registry():
|
||||
"""Verify ReadNotePureTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_read_note_pure_tool_subclass():
|
||||
"""Verify ReadNotePureTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(ReadNotePureTool, ArtemisTool)
|
||||
assert issubclass(ReadNotePure, ArtemisTool)
|
||||
assert isinstance(read_note_pure, ArtemisTool)
|
||||
@@ -46,11 +46,6 @@ def test_read_note_pure_tool_subclass_and_registry():
|
||||
assert read_note_pure.category == "memory"
|
||||
assert read_note_pure.args_schema == ReadNoteArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("read_note_pure")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, ReadNotePureTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = read_note_pure.to_genai_declaration()
|
||||
assert declaration.name == "read_note_pure"
|
||||
|
||||
@@ -16,7 +16,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
ReadNote,
|
||||
ReadNoteArgs,
|
||||
@@ -39,8 +39,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_read_note_tool_subclass_and_registry():
|
||||
"""Verify ReadNoteTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_read_note_tool_subclass():
|
||||
"""Verify ReadNoteTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(ReadNoteTool, ArtemisTool)
|
||||
assert issubclass(ReadNote, ArtemisTool)
|
||||
assert isinstance(read_note, ArtemisTool)
|
||||
@@ -50,11 +50,6 @@ def test_read_note_tool_subclass_and_registry():
|
||||
assert read_note.category == "memory"
|
||||
assert read_note.args_schema == ReadNoteArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("read_note")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, ReadNoteTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = read_note.to_genai_declaration()
|
||||
assert declaration.name == "read_note"
|
||||
|
||||
@@ -16,7 +16,7 @@ from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
SaveNoteArgs,
|
||||
SaveNotePure,
|
||||
@@ -35,8 +35,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_save_note_pure_tool_subclass_and_registry():
|
||||
"""Verify SaveNotePureTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_save_note_pure_tool_subclass():
|
||||
"""Verify SaveNotePureTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(SaveNotePureTool, ArtemisTool)
|
||||
assert issubclass(SaveNotePure, ArtemisTool)
|
||||
assert isinstance(save_note_pure, ArtemisTool)
|
||||
@@ -46,11 +46,6 @@ def test_save_note_pure_tool_subclass_and_registry():
|
||||
assert save_note_pure.category == "memory"
|
||||
assert save_note_pure.args_schema == SaveNoteArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("save_note_pure")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, SaveNotePureTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = save_note_pure.to_genai_declaration()
|
||||
assert declaration.name == "save_note_pure"
|
||||
|
||||
@@ -17,7 +17,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
SaveNote,
|
||||
SaveNoteArgs,
|
||||
@@ -39,8 +39,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_save_note_tool_subclass_and_registry():
|
||||
"""Verify SaveNoteTool is a subclass of ArtemisTool and properly registered in ToolRegistry."""
|
||||
def test_save_note_tool_subclass():
|
||||
"""Verify SaveNoteTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(SaveNoteTool, ArtemisTool)
|
||||
assert issubclass(SaveNote, ArtemisTool)
|
||||
assert isinstance(save_note, ArtemisTool)
|
||||
@@ -50,11 +50,6 @@ def test_save_note_tool_subclass_and_registry():
|
||||
assert save_note.category == "memory"
|
||||
assert save_note.args_schema == SaveNoteArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("save_note")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, SaveNoteTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = save_note.to_genai_declaration()
|
||||
assert declaration.name == "save_note"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.mobile.search_logs import (
|
||||
SearchLogs,
|
||||
SearchLogsArgs,
|
||||
@@ -147,8 +147,8 @@ def mock_ctx():
|
||||
return MagicMock(spec=ArtemisContext)
|
||||
|
||||
|
||||
def test_search_logs_tool_subclass_and_registry():
|
||||
"""Verify SearchLogsTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_search_logs_tool_subclass():
|
||||
"""Verify SearchLogsTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(SearchLogsTool, ArtemisTool)
|
||||
assert issubclass(SearchLogs, ArtemisTool)
|
||||
assert issubclass(SearchLogsToolAlias, ArtemisTool)
|
||||
@@ -159,11 +159,6 @@ def test_search_logs_tool_subclass_and_registry():
|
||||
assert search_logs.category == "diagnostic"
|
||||
assert search_logs.args_schema == SearchLogsArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("search_logs")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, SearchLogsTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = search_logs.to_genai_declaration()
|
||||
assert declaration.name == "search_logs"
|
||||
|
||||
@@ -16,7 +16,7 @@ from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
UpdateNoteArgs,
|
||||
UpdateNotePure,
|
||||
@@ -36,8 +36,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_update_note_pure_tool_subclass_and_registry():
|
||||
"""Verify UpdateNotePureTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_update_note_pure_tool_subclass():
|
||||
"""Verify UpdateNotePureTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(UpdateNotePureTool, ArtemisTool)
|
||||
assert issubclass(UpdateNotePure, ArtemisTool)
|
||||
assert isinstance(update_note_pure, ArtemisTool)
|
||||
@@ -47,11 +47,6 @@ def test_update_note_pure_tool_subclass_and_registry():
|
||||
assert update_note_pure.category == "memory"
|
||||
assert update_note_pure.args_schema == UpdateNoteArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("update_note_pure")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, UpdateNotePureTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = update_note_pure.to_genai_declaration()
|
||||
assert declaration.name == "update_note_pure"
|
||||
|
||||
@@ -17,7 +17,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.scratchpad import (
|
||||
UpdateNote,
|
||||
UpdateNoteArgs,
|
||||
@@ -40,8 +40,8 @@ def mock_ctx(tmp_path):
|
||||
return ctx
|
||||
|
||||
|
||||
def test_update_note_tool_subclass_and_registry():
|
||||
"""Verify UpdateNoteTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_update_note_tool_subclass():
|
||||
"""Verify UpdateNoteTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(UpdateNoteTool, ArtemisTool)
|
||||
assert issubclass(UpdateNote, ArtemisTool)
|
||||
assert isinstance(update_note, ArtemisTool)
|
||||
@@ -51,11 +51,6 @@ def test_update_note_tool_subclass_and_registry():
|
||||
assert update_note.category == "memory"
|
||||
assert update_note.args_schema == UpdateNoteArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("update_note")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, UpdateNoteTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = update_note.to_genai_declaration()
|
||||
assert declaration.name == "update_note"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.video_tool import (
|
||||
VideoAnalyzerArgs,
|
||||
VideoAnalyzerPure,
|
||||
@@ -32,8 +32,8 @@ def mock_ctx():
|
||||
return ctx
|
||||
|
||||
|
||||
def test_video_analyzer_pure_tool_subclass_and_registry():
|
||||
"""Verify VideoAnalyzerPureTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_video_analyzer_pure_tool_subclass():
|
||||
"""Verify VideoAnalyzerPureTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(VideoAnalyzerPureTool, ArtemisTool)
|
||||
assert issubclass(VideoAnalyzerPure, ArtemisTool)
|
||||
assert isinstance(video_analyzer_pure, ArtemisTool)
|
||||
@@ -43,11 +43,6 @@ def test_video_analyzer_pure_tool_subclass_and_registry():
|
||||
assert video_analyzer_pure.category == "perception"
|
||||
assert video_analyzer_pure.args_schema == VideoAnalyzerArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("video_analyzer_pure")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, VideoAnalyzerPureTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = video_analyzer_pure.to_genai_declaration()
|
||||
assert declaration.name == "video_analyzer_pure"
|
||||
|
||||
@@ -16,7 +16,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.graph.state import State
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.video_tool import (
|
||||
DIAGNOSER_VIDEO_ANALYZER_DOCSTRING,
|
||||
OPERATOR_VIDEO_ANALYZER_DOCSTRING,
|
||||
@@ -41,8 +41,8 @@ def mock_state():
|
||||
return MagicMock(spec=State)
|
||||
|
||||
|
||||
def test_video_analyzer_tool_subclass_and_registry():
|
||||
"""Verify VideoAnalyzerTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_video_analyzer_tool_subclass():
|
||||
"""Verify VideoAnalyzerTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(VideoAnalyzerTool, ArtemisTool)
|
||||
assert isinstance(video_analyzer, ArtemisTool)
|
||||
assert isinstance(video_analyzer, VideoAnalyzerTool)
|
||||
@@ -51,11 +51,6 @@ def test_video_analyzer_tool_subclass_and_registry():
|
||||
assert video_analyzer.category == "perception"
|
||||
assert video_analyzer.args_schema == VideoAnalyzerArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("video_analyzer")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, VideoAnalyzerTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = video_analyzer.to_genai_declaration()
|
||||
assert declaration.name == "video_analyzer"
|
||||
|
||||
@@ -17,7 +17,7 @@ import time
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from artemis.context import ArtemisContext
|
||||
from artemis.tools.base import ArtemisTool, ToolRegistry
|
||||
from artemis.tools.base import ArtemisTool
|
||||
from artemis.tools.wait_tool import (
|
||||
Wait,
|
||||
WaitArgs,
|
||||
@@ -35,8 +35,8 @@ def mock_ctx():
|
||||
return ctx
|
||||
|
||||
|
||||
def test_wait_tool_subclass_and_registry():
|
||||
"""Verify WaitTool is a subclass of ArtemisTool and properly registered."""
|
||||
def test_wait_tool_subclass():
|
||||
"""Verify WaitTool is a subclass of ArtemisTool."""
|
||||
assert issubclass(WaitTool, ArtemisTool)
|
||||
assert issubclass(Wait, ArtemisTool)
|
||||
assert isinstance(wait, ArtemisTool)
|
||||
@@ -46,11 +46,6 @@ def test_wait_tool_subclass_and_registry():
|
||||
assert wait.category == "system"
|
||||
assert wait.args_schema == WaitArgs
|
||||
|
||||
# Registry lookup
|
||||
reg_tool = ToolRegistry.get("wait")
|
||||
assert reg_tool is not None
|
||||
assert isinstance(reg_tool, WaitTool)
|
||||
|
||||
# GenAI FunctionDeclaration export
|
||||
declaration = wait.to_genai_declaration()
|
||||
assert declaration.name == "wait"
|
||||
|
||||
Reference in new issue
Block a user