Skip to content
Merged
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
65 changes: 15 additions & 50 deletions src/agentlab/agents/generic_agent_hinter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,19 @@
"""
Baseline agent for all ServiceNow papers
import importlib, sys, warnings

This module contains the GenericAgent class, which is the baseline agent for all ServiceNow papers. \
It is a simple agent that can be ran OOB on all BrowserGym environments. It is also shipped with \
a few configurations that can be used to run it on different environments.
"""
OLD = __name__
NEW = "agentlab.agents.hint_use_agent"
SUBS = ("agent_configs", "generic_agent_prompt", "generic_agent", "tmlr_config")

from .agent_configs import (
AGENT_3_5,
AGENT_8B,
AGENT_37_SONNET,
AGENT_CLAUDE_SONNET_35,
AGENT_CLAUDE_SONNET_35_VISION,
AGENT_CUSTOM,
AGENT_GPT5_MINI,
AGENT_GPT5_NANO,
AGENT_LLAMA3_70B,
AGENT_LLAMA4_17B_INSTRUCT,
AGENT_LLAMA31_70B,
CHAT_MODEL_ARGS_DICT,
RANDOM_SEARCH_AGENT,
AGENT_4o,
AGENT_4o_MINI,
AGENT_4o_MINI_VISION,
AGENT_4o_VISION,
AGENT_o1_MINI,
AGENT_o3_MINI,
FLAGS_GPT_4o,
GenericAgentArgs,
warnings.warn(
f"{OLD} is renamed to {NEW}. {OLD} will be removed in future",
DeprecationWarning,
stacklevel=2,
)
Comment on lines +7 to 11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecation notice not logged category Logging

Tell me more
What is the issue?

The code uses a warning to log the deprecation notice, which may not be captured in standard logging systems.

Why this matters

Warnings might be suppressed or not visible in production environments, potentially leading to missed deprecation notices.

Suggested change ∙ Feature Preview

Add a logging statement in addition to the warning:

import logging

logging.warning(f"{OLD} is renamed to {NEW}. {OLD} will be removed in future")
warnings.warn(
    f"{OLD} is renamed to {NEW}. {OLD} will be removed in future",
    DeprecationWarning,
    stacklevel=2,
)
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

from .generic_agent import GenericAgent, GenericAgentArgs

__all__ = [
"AGENT_3_5",
"AGENT_4o",
"AGENT_4o_MINI",
"AGENT_4o_VISION",
"AGENT_o3_MINI",
"AGENT_o1_MINI",
"AGENT_LLAMA4_17B_INSTRUCT",
"AGENT_LLAMA3_70B",
"AGENT_LLAMA31_70B",
"AGENT_8B",
"RANDOM_SEARCH_AGENT",
"AGENT_CUSTOM",
"AGENT_CLAUDE_SONNET_35",
"AGENT_37_SONNET",
"AGENT_4o_VISION",
"AGENT_4o_MINI_VISION",
"AGENT_CLAUDE_SONNET_35_VISION",
"AGENT_GPT5_MINI",
"AGENT_GPT5_NANO",
]
# Alias the top-level
new_mod = importlib.import_module(NEW)
sys.modules[OLD] = new_mod

# Alias known submodules
for sub in SUBS:
sys.modules[f"{OLD}.{sub}"] = importlib.import_module(f"{NEW}.{sub}")
Comment on lines +13 to +19

This comment was marked as off-topic.

54 changes: 54 additions & 0 deletions src/agentlab/agents/hint_use_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""
Baseline agent for all ServiceNow papers

This module contains the GenericAgent class, which is the baseline agent for all ServiceNow papers. \
It is a simple agent that can be ran OOB on all BrowserGym environments. It is also shipped with \
a few configurations that can be used to run it on different environments.
"""

from .agent_configs import (
AGENT_3_5,
AGENT_8B,
AGENT_37_SONNET,
AGENT_CLAUDE_SONNET_35,
AGENT_CLAUDE_SONNET_35_VISION,
AGENT_CUSTOM,
AGENT_GPT5_MINI,
AGENT_GPT5_NANO,
AGENT_LLAMA3_70B,
AGENT_LLAMA4_17B_INSTRUCT,
AGENT_LLAMA31_70B,
CHAT_MODEL_ARGS_DICT,
RANDOM_SEARCH_AGENT,
AGENT_4o,
AGENT_4o_MINI,
AGENT_4o_MINI_VISION,
AGENT_4o_VISION,
AGENT_o1_MINI,
AGENT_o3_MINI,
FLAGS_GPT_4o,
GenericAgentArgs,
)
from .generic_agent import GenericAgent, GenericAgentArgs

__all__ = [
"AGENT_3_5",
"AGENT_4o",
"AGENT_4o_MINI",
"AGENT_4o_VISION",
"AGENT_o3_MINI",
"AGENT_o1_MINI",
"AGENT_LLAMA4_17B_INSTRUCT",
"AGENT_LLAMA3_70B",
"AGENT_LLAMA31_70B",
"AGENT_8B",
"RANDOM_SEARCH_AGENT",
"AGENT_CUSTOM",
"AGENT_CLAUDE_SONNET_35",
"AGENT_37_SONNET",
"AGENT_4o_VISION",
"AGENT_4o_MINI_VISION",
"AGENT_CLAUDE_SONNET_35_VISION",
"AGENT_GPT5_MINI",
"AGENT_GPT5_NANO",
]
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class GenericAgentArgs(AgentArgs):

def __post_init__(self):
try: # some attributes might be temporarily args.CrossProd for hyperparameter generation
# TODO: Rename the agent to HintUseAgent when appropriate
self.agent_name = f"GenericAgent-hinter-{self.chat_model_args.model_name}".replace(
"/", "_"
)
Expand Down Expand Up @@ -92,7 +93,8 @@ def __init__(
self.max_retry = max_retry

self.flags = flags
if self.flags.hint_db_path is not None:

if self.flags.hint_db_path is not None and self.flags.use_task_hint:
assert os.path.exists(
self.flags.hint_db_path
), f"Hint database path {self.flags.hint_db_path} does not exist."
Expand Down Expand Up @@ -323,14 +325,16 @@ def _get_task_hints(self) -> list[str]:
if self.flags.hint_type == "docs":
if not hasattr(self, "hint_index"):
print("Initializing hint index new time")
self._init()
# @patricebechard It seems _.init() method is missing do we still need it?
# self._init()
if self.flags.hint_query_type == "goal":
query = self.obs_history[-1]["goal_object"][0]["text"]
elif self.flags.hint_query_type == "llm":
queries, _ = self._get_queries()
# HACK: only 1 query supported
query = queries[0]
else:
# @patricebechard: This raises an error with the default value 'direct'
raise ValueError(f"Unknown hint query type: {self.flags.hint_query_type}")

print(f"Query: {query}")
Expand Down Expand Up @@ -369,7 +373,7 @@ def _get_task_hints(self) -> list[str]:
goal_or_queries = "\n".join(self.queries)

task_hints = self.hints_source.choose_hints(
self.llm,
self.chat_llm,
self.task_name,
goal_or_queries,
)
Expand Down
Loading