MCPcopy Index your code
hub / github.com/langroid/langroid / test_task_tool_none_tools

Function test_task_tool_none_tools

tests/main/test_task_tool.py:272–315  ·  view source on GitHub ↗

Test that tools="none" disables all tools except DoneTool for the sub-agent.

()

Source from the content-addressed store, hash-verified

270
271
272def test_task_tool_none_tools():
273 """
274 Test that tools="none" disables all tools except DoneTool for the sub-agent.
275 """
276 # Create a main agent that delegates with no tools
277 main_config = ChatAgentConfig(
278 llm=MockLMConfig(
279 default_response=TaskTool(
280 agent_name="Calculator",
281 system_message=f"""
282 You are an assistant with no tools. Just respond directly
283 to the prompt and use `{DoneTool.name()}` to return your answer.
284 """,
285 prompt="What is 2 + 2? Just tell me the answer.",
286 model="gpt-4o-mini",
287 tools=["NONE"], # Disable all tools except DoneTool
288 max_iterations=20,
289 ).model_dump_json()
290 ),
291 name="MainAgent",
292 )
293 main_agent = ChatAgent(main_config)
294
295 # Enable TaskTool and other tools for the main agent
296 # (sub-agent won't have access to these)
297 main_agent.enable_message(
298 [TaskTool, MultiplierTool, NebrowskiTool], use=True, handle=True
299 )
300
301 # Create task
302 task = Task(
303 main_agent,
304 name="NoToolsTask",
305 interactive=False,
306 config=TaskConfig(
307 done_sequences=["T,A"], # LLM (Tool), Agent(Handled) -> done
308 ),
309 )
310
311 # Run the task
312 result = task.run(msg="Test no tools")
313
314 # Verify that the task completed (sub-agent can still use DoneTool)
315 assert result is not None, "Task should return a result"

Callers

nothing calls this directly

Calls 9

enable_messageMethod · 0.95
runMethod · 0.95
ChatAgentConfigClass · 0.90
MockLMConfigClass · 0.90
TaskToolClass · 0.90
ChatAgentClass · 0.90
TaskClass · 0.90
TaskConfigClass · 0.90
nameMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…