Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions artemis/agents/explorer/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
" coordinate, so you can act on it right away."
)

ASK_EXPLORER_ULTRA_DESCRIPTION = (
ASK_EXPLORER_DESCRIPTION
+ " Explorer can also inspect pixel data to identify color codes and"
" disambiguate visually similar targets like subtle color swatches."
)

ASK_EXPLORER_QUERY_DESCRIPTION = (
"What to find, described the way you see it on the screenshot: visible"
" text, icon shape, color, position, or nearby landmarks (e.g. 'gear icon"
Expand Down
2 changes: 1 addition & 1 deletion artemis/agents/explorer/explorer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"**Finalization**: Submit coordinates using `submit_answer`. In your final turn all other tools are stripped away, leaving only `submit_answer`, so never postpone the submission past the point where you are reasonably confident.",
"**Tool Classes**: `Perception` tools extract and locate elements, coordinates and text on the screen; the `Finalization` tool (`submit_answer`) submits your ranked candidates and terminates the search.",
{
"text": "**Transformation Tool**: `ask_image_processor` performs pixel-level image editing (cropping, upscaling, masking, contrast changes) and registers the resulting images in the Image Pool. It is slow and expensive; use it only when perception on the original screenshot is insufficient, and call it sequentially because later perception steps depend on its output.",
"text": "**Transformation Tool**: `ask_image_processor` performs pixel-level image editing and analysis (cropping, upscaling, masking, color/contrast adjustments, or pixel sampling) and registers the resulting images in the Image Pool. It is slow and expensive; use it only when perception on the original screenshot is insufficient, and call it sequentially because later perception steps depend on its output.",
"requires": ["ask_image_processor"]
},
{
Expand Down
1 change: 1 addition & 0 deletions artemis/agents/explorer/perception_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,3 +630,4 @@ async def exec_inspect_region(
"text": f"Error: Region inspection failed: {e}",
"image_path": None,
}

13 changes: 8 additions & 5 deletions artemis/agents/explorer/tool_declarations.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@
"type": "function",
"function": {
"name": "ask_image_processor",
"description": ("[Transformation] A scripting tool for pixel-level image processing."),
"description": (
"[Transformation] A scripting tool for pixel-level image processing,"
" transformations, and spot pixel/color inspection."
),
"parameters": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -274,10 +277,10 @@
types.FunctionDeclaration(
name="ask_image_processor",
description=(
"[Transformation] A scripting tool for pixel-level image"
" processing. CAUTION: This tool is slow and expensive. Returns"
" a summary of the operations performed and new image IDs,"
" along with new labels and screen coordinates."
"[Transformation] A scripting tool for pixel-level image processing,"
" transformations, and spot pixel/color inspection. CAUTION: This tool is"
" slow and expensive. Returns a summary of the operations performed and"
" new image IDs, along with new labels and screen coordinates."
),
parameters=types.Schema(
type=types.Type.OBJECT,
Expand Down
2 changes: 1 addition & 1 deletion artemis/agents/operator/operator.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions artemis/agents/operator/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@


from artemis.agents.prompt_assembly import render_tool_enum, resolve_available
from artemis.config import resolve_explorer_version
from artemis.mcp.action_specs import OPERATOR_SHELL_ORDER


Expand Down Expand Up @@ -260,12 +261,14 @@ def _checkpoint_max_repairs(ctx: ArtemisContext) -> int:
def _grammar_render_context(ctx: ArtemisContext) -> dict:
"""Template variables shared by the static and legacy system renders."""
midway, final, verification_active = _operator_grammar_flags(ctx)
explorer_tier = resolve_explorer_version(ctx, agent_or_profile_name="operator")
return {
"plan_grammar": render_plan_grammar_spec(midway=midway, final=final),
"verification_active": verification_active,
"checks_active": midway or final,
"midway_checks_active": midway,
"checkpoint_max_repairs": _checkpoint_max_repairs(ctx),
"explorer_tier": explorer_tier,
}


Expand Down
14 changes: 12 additions & 2 deletions artemis/tools/explorer_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
ASK_EXPLORER_DESCRIPTION,
ASK_EXPLORER_QUERY_DESCRIPTION,
ASK_EXPLORER_TOOL_NAME,
ASK_EXPLORER_ULTRA_DESCRIPTION,
)
from artemis.agents.explorer.explorer import Explorer
from artemis.agents.explorer.geometry import (
Expand Down Expand Up @@ -516,9 +517,15 @@ def __init__(
):
self.version = version
self.agent_name = agent_name
if description is None:
description = (
ASK_EXPLORER_ULTRA_DESCRIPTION
if version == "ultra"
else ASK_EXPLORER_DESCRIPTION
)
super().__init__(
name=ASK_EXPLORER_TOOL_NAME,
description=description or ASK_EXPLORER_DESCRIPTION,
description=description,
args_schema=AskExplorerArgs,
category=category,
)
Expand Down Expand Up @@ -558,7 +565,10 @@ def get_ask_explorer_tool(
agent_name: str = "operator",
) -> BaseTool:
"""Exports ``ask_explorer`` as a LangChain tool bound to ``ctx``."""
return AskExplorerTool(version=version, agent_name=agent_name).to_langchain_tool(ctx)
resolved_version = resolve_explorer_version(
ctx, explicit_version=version, agent_or_profile_name=agent_name
)
return AskExplorerTool(version=resolved_version, agent_name=agent_name).to_langchain_tool(ctx)


ask_explorer_wrapper = ToolWrapper(
Expand Down
2 changes: 1 addition & 1 deletion artemis/tools/image_processor_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self):
name="ask_image_processor",
description=(
"Call this tool to ask the image processor agent to run"
" complex image transformations or modifications."
" complex image transformations, modifications, or pixel/color measurements."
),
args_schema=AskVisionCoderArgs,
category="custom",
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/tools/test_explorer_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
ASK_EXPLORER_CONTEXT_FEEDBACK_DESCRIPTION,
ASK_EXPLORER_DESCRIPTION,
ASK_EXPLORER_QUERY_DESCRIPTION,
ASK_EXPLORER_ULTRA_DESCRIPTION,
)
from artemis.context import ArtemisContext
from artemis.graph.state import State
Expand Down Expand Up @@ -118,7 +119,12 @@ def test_tool_contract_is_tier_agnostic():
@pytest.mark.parametrize("version", [None, "flash", "pro", "ultra"])
def test_description_does_not_depend_on_the_tier(version):
tool = AskExplorerTool(version=version)
assert tool.description == ASK_EXPLORER_DESCRIPTION
expected = (
ASK_EXPLORER_ULTRA_DESCRIPTION
if version == "ultra"
else ASK_EXPLORER_DESCRIPTION
)
assert tool.description == expected
assert tool.version == version


Expand Down