perf(cli): defer AIAgent import to cut cold-start latency

This commit is contained in:
Hermes Agent
2026-04-05 15:23:42 +00:00
parent d139f2c6d2
commit 5bf6993cc3

7
cli.py
View File

@@ -13,6 +13,8 @@ Usage:
python cli.py --list-tools # List available tools and exit
"""
from __future__ import annotations
import logging
import os
import shutil
@@ -477,7 +479,6 @@ from rich.text import Text as _RichText
import fire
# Import the agent and tool systems
from run_agent import AIAgent
from model_tools import get_tool_definitions, get_toolset_for_tool
# Extracted CLI modules (Phase 3)
@@ -2029,6 +2030,8 @@ class HermesCLI:
Returns:
bool: True if successful, False otherwise
"""
from run_agent import AIAgent
if self.agent is not None:
return True
@@ -4056,6 +4059,8 @@ class HermesCLI:
turn_route = self._resolve_turn_agent_config(prompt)
def run_background():
from run_agent import AIAgent
try:
bg_agent = AIAgent(
model=turn_route["model"],