Skip to content

Commit db928b2

Browse files
committed
chore: revert all changes to outdated files
1 parent c65a2ae commit db928b2

2 files changed

Lines changed: 1 addition & 153 deletions

File tree

src/google/adk/cli/utils/_telemetry.py

Lines changed: 0 additions & 106 deletions
This file was deleted.

src/google/adk/cli/utils/agent_loader.py

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@
3939

4040
logger = logging.getLogger("google_adk." + __name__)
4141

42-
43-
def is_single_agent_directory(path: Path | str) -> bool:
44-
"""Returns True if the directory contains a single agent configuration or file."""
45-
p = Path(path).resolve()
46-
return (
47-
p.joinpath("agent.py").is_file()
48-
or p.joinpath("root_agent.yaml").is_file()
49-
)
50-
51-
5242
# Special agents directory for agents with names starting with double underscore
5343
SPECIAL_AGENTS_DIR = os.path.join(
5444
os.path.dirname(__file__), "..", "built_in_agents"
@@ -70,36 +60,10 @@ class AgentLoader(BaseAgentLoader):
7060
"""
7161

7262
def __init__(self, agents_dir: str):
73-
agents_path = Path(agents_dir).resolve()
74-
is_single_agent = is_single_agent_directory(agents_path)
75-
if is_single_agent:
76-
self._is_single_agent = True
77-
self._single_agent_name = agents_path.name
78-
self.agents_dir = str(agents_path.parent)
79-
else:
80-
self._is_single_agent = False
81-
self._single_agent_name = None
82-
self.agents_dir = str(agents_path)
83-
63+
self.agents_dir = str(Path(agents_dir))
8464
self._original_sys_path = None
8565
self._agent_cache: dict[str, Union[BaseAgent, App]] = {}
8666

87-
@property
88-
def is_single_agent(self) -> bool:
89-
"""Returns True if the loader is in single agent mode."""
90-
return self._is_single_agent
91-
92-
@property
93-
def single_agent_name(self) -> Optional[str]:
94-
"""Returns the name of the agent in single agent mode."""
95-
return self._single_agent_name
96-
97-
def _set_single_agent_mode(self, name: str, agents_dir: str) -> None:
98-
"""Internal method to force single agent mode. Use with care."""
99-
self._is_single_agent = True
100-
self._single_agent_name = name
101-
self.agents_dir = agents_dir
102-
10367
def _load_from_module_or_package(
10468
self, agent_name: str
10569
) -> Optional[Union[BaseAgent, App]]:
@@ -240,13 +204,6 @@ def _validate_agent_name(self, agent_name: str) -> None:
240204
name_to_check = agent_name
241205
check_dir = self.agents_dir
242206

243-
if self._is_single_agent and not agent_name.startswith("__"):
244-
if agent_name != self._single_agent_name:
245-
raise ValueError(
246-
f"Agent not found: {agent_name!r}. In single agent mode, only "
247-
f"'{self._single_agent_name}' is accessible."
248-
)
249-
250207
if not self._VALID_AGENT_NAME_RE.match(name_to_check):
251208
raise ValueError(
252209
f"Invalid agent name: {agent_name!r}. Agent names must be valid"
@@ -411,8 +368,6 @@ def load_agent(self, agent_name: str) -> Union[BaseAgent, App]:
411368
@override
412369
def list_agents(self) -> list[str]:
413370
"""Lists all agents available in the agent loader (sorted alphabetically)."""
414-
if self._is_single_agent:
415-
return [self._single_agent_name]
416371
base_path = Path.cwd() / self.agents_dir
417372
agent_names = [
418373
x
@@ -484,4 +439,3 @@ def remove_agent_from_cache(self, agent_name: str):
484439
logger.debug("Deleting module %s", key)
485440
del sys.modules[key]
486441
self._agent_cache.pop(agent_name, None)
487-

0 commit comments

Comments
 (0)