Skip to content

Commit 506c605

Browse files
committed
trim comments to the load-bearing lines
1 parent 81f3b0e commit 506c605

3 files changed

Lines changed: 6 additions & 21 deletions

File tree

swarms/agents/autonomous_loop.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,8 @@ def _run_autonomous_loop(
213213

214214
self._say_user(task)
215215

216-
# Add planning tools to tools_list_dictionary.
217-
# "lazy" ships a small always-on core plus the search_tools
218-
# meta-tool; the rest are fetched on demand, which keeps the
219-
# resident schema block from being re-sent on every iteration.
216+
# "lazy" ships a small core plus search_tools; the rest are
217+
# fetched on demand, so the resident block stays flat.
220218
if self.agent.selected_tools == "lazy":
221219
planning_tools = get_lazy_autonomous_tools()
222220
logger.info(
@@ -364,9 +362,7 @@ def _run_autonomous_loop(
364362
)
365363
)
366364

367-
# Filter tool handlers if selected_tools is not "all".
368-
# "lazy" keeps every handler: the model can load any schema at
369-
# run time, so the handler has to be there when it does.
365+
# "lazy" keeps every handler: any schema can be loaded at run time.
370366
if (
371367
self.agent.selected_tools != "all"
372368
and self.agent.selected_tools != "lazy"

swarms/structs/autonomous_loop_utils.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,8 @@ def get_autonomous_planning_tools() -> List[Dict[str, Any]]:
594594
]
595595

596596

597-
# The always-resident set under selected_tools="lazy". Everything the loop
598-
# structurally depends on (planning, subtask bookkeeping, termination, and the
599-
# user-facing reply), plus the meta-tool used to fetch the rest. Keeping this
600-
# small is the point: the resident schema cost stays flat as tools are added.
597+
# Always resident under selected_tools="lazy": what the loop structurally
598+
# depends on, plus the meta-tool that fetches the rest.
601599
LAZY_CORE_TOOL_NAMES = (
602600
"create_plan",
603601
"subtask_done",
@@ -769,9 +767,7 @@ def search_tools_tool(agent: Any, query: str = "", **kwargs) -> str:
769767
agent.tools_list_dictionary = []
770768
agent.tools_list_dictionary.extend(matches)
771769

772-
# Rebuild so the newly added schemas reach the provider. Without this the
773-
# client keeps the tool list it was constructed with and the model would
774-
# be told about tools it cannot actually call.
770+
# Rebuild, or the client keeps the tool list it was constructed with.
775771
try:
776772
agent.llm = agent.llm_handling()
777773
except Exception as e:

tests/structs/test_async_subagent.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,11 +1283,6 @@ def run(self, task):
12831283
print("=" * 60)
12841284

12851285

1286-
# ============================================================================
1287-
# Lazy autonomous tool loading (#1753)
1288-
# ============================================================================
1289-
1290-
12911286
class _ToolAgentStub:
12921287
"""Minimal stand-in exposing what search_tools_tool touches."""
12931288

@@ -1324,7 +1319,6 @@ def test_lazy_core_is_a_strict_subset_and_much_smaller():
13241319

13251320
full_size = len(json.dumps(full))
13261321
lazy_size = len(json.dumps(lazy))
1327-
# The whole point is a large reduction, not a marginal one.
13281322
assert lazy_size < full_size * 0.5
13291323

13301324

@@ -1393,7 +1387,6 @@ def test_repeating_a_search_does_not_reload_or_dump_the_catalogue():
13931387

13941388
assert len(agent.tools_list_dictionary) == count
13951389
assert "No tool matched" in message
1396-
# The fallback lists names, which is cheap, rather than loading schemas.
13971390
assert "think" in message
13981391

13991392

0 commit comments

Comments
 (0)