Tool Lazy Loading

Tool Lazy Loading Mechanism

Hawa Code supports tool lazy loading functionality. By default, the system does not provide all tools to the model at once. Instead, the model dynamically selects and loads the required tools based on actual needs. This lazy loading mechanism significantly reduces token consumption.

Key Features

  • Lifecycle Management: Loaded tools remain effective until the end of a single conversation. When users engage in multiple interactions, tools are automatically unloaded after each conversation ends and need to be reloaded for the next conversation.

  • Wide Compatibility: Currently, both standard tools and MCP tools support lazy loading functionality.

  • Performance Trade-off: After enabling tool lazy loading, analysis speed may be slightly slower due to the additional step of loading tools.

Usage

Set the following environment variable to enable tool lazy loading mode. Restart the terminal for the changes to take effect:

HAWA_CODE_LAZY_TOOL=true

Environment Variable Configuration Methods:

  1. Recommended Method: Configure directly in the env field of ~/.hcode/settings.json
  2. System Environment Variables: Configure through the operating system’s environment variable mechanism