Skip to main content

agrag.agents.middleware.HideToolsMiddleware

HideToolsMiddleware(names:frozenset[str]) -> None

Bases: AgentMiddleware

Remove tools by name from every model request.

DeepAgents gives each subagent its filesystem tools, even when the spec lists none. A role that needs no tools, such as the verifier, hides them so the model can only answer through its structured output.

Functions:

  • awrap_model_call – Run the call with the named tools removed from the request.

Parameters:

  • names (frozenset[str]) – The tool names to remove.

awrap_model_call​

awrap_model_call(request:ModelRequest, handler:Callable[[ModelRequest], Awaitable[ModelResponse]]) -> Any

Run the call with the named tools removed from the request.

Parameters:

  • request (ModelRequest) – The intercepted model request.
  • handler (Callable\[[ModelRequest], Awaitable[ModelResponse]]) – The remaining model-call pipeline.

Returns:

  • Any – The handler's model response.