Skip to content

Commit 37eb80d

Browse files
Merge pull request #65 from AI-Hypercomputer/shangkun-style
style: run format.sh to fix formatting and linter errors
2 parents a5a10d5 + 66340ac commit 37eb80d

8 files changed

Lines changed: 41 additions & 17 deletions

File tree

MaxKernel/auto_agent/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
INCLUDE_THOUGHTS = os.environ.get("INCLUDE_THOUGHTS", "true").lower() == "true"
1616
MAX_COMPILATION_RETRIES = int(os.environ.get("MAX_COMPILATION_RETRIES", "6"))
1717

18+
1819
# Set events compaction policy to avoid memory overflow
1920
def get_compaction_config():
2021
return EventsCompactionConfig(
@@ -24,6 +25,7 @@ def get_compaction_config():
2425
overlap_size=0,
2526
)
2627

28+
2729
# Model configuration
2830
model_config = types.GenerateContentConfig(
2931
temperature=TEMPERATURE,

MaxKernel/auto_agent/subagents/kernel_writing/agent.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
load_kernel_and_plan_to_state,
1414
load_single_kernel_to_state,
1515
)
16-
from auto_agent.config import get_thinking_planner, model_config, MAX_COMPILATION_RETRIES
16+
from auto_agent.config import (
17+
MAX_COMPILATION_RETRIES,
18+
get_thinking_planner,
19+
model_config,
20+
)
1721
from auto_agent.constants import MODEL_NAME
1822
from auto_agent.custom_types import CustomLlmAgent
1923
from auto_agent.subagents.kernel_writing.kernel_compilation import (

MaxKernel/hitl_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
)
3434
from hitl_agent.tools.tools import (
3535
filesystem_tool_r,
36-
set_working_directory,
3736
set_max_compilation_retries,
37+
set_working_directory,
3838
)
3939

4040
# Root orchestration agent

MaxKernel/hitl_agent/subagents/kernel_writing/agent.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
load_single_kernel_to_state,
1616
save_kernel_and_plan_paths,
1717
)
18-
from hitl_agent.config import model_config, thinking_planner, MAX_COMPILATION_RETRIES
18+
from hitl_agent.config import (
19+
MAX_COMPILATION_RETRIES,
20+
model_config,
21+
thinking_planner,
22+
)
1923
from hitl_agent.constants import MODEL_NAME
2024
from hitl_agent.custom_types import CustomLlmAgent
2125
from hitl_agent.subagents.kernel_writing.kernel_compilation import (

MaxKernel/hitl_agent/tools/filesystem_tools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Filesystem tools configuration for the HITL agent."""
22

33
import os
4+
45
from google.adk.tools.mcp_tool.mcp_session_manager import StdioConnectionParams
56
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
67
from mcp import StdioServerParameters

MaxKernel/hitl_agent/tools/retries_tool.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
import logging
44
import os
5+
56
from google.adk.tools import FunctionTool, ToolContext
67

78

89
async def set_max_compilation_retries_fn(
9-
retries: int, tool_context: ToolContext, persist: bool = False
10+
retries: int, tool_context: ToolContext, persist: bool = False
1011
) -> str:
1112
"""Set the maximum number of compilation validation and auto-fixing attempts.
1213
@@ -24,6 +25,7 @@ async def set_max_compilation_retries_fn(
2425

2526
# Update in-memory config variables
2627
import hitl_agent.config as hitl_cfg
28+
2729
hitl_cfg.MAX_COMPILATION_RETRIES = retries
2830
os.environ["MAX_COMPILATION_RETRIES"] = str(retries)
2931

@@ -49,7 +51,10 @@ async def set_max_compilation_retries_fn(
4951

5052
# Update the active validation loops in-memory
5153
try:
52-
from hitl_agent.subagents.kernel_writing.agent import kernel_compilation_validation_loop as hitl_loop
54+
from hitl_agent.subagents.kernel_writing.agent import (
55+
kernel_compilation_validation_loop as hitl_loop,
56+
)
57+
5358
hitl_loop.max_retries = retries
5459
except Exception as e:
5560
logging.warning(f"Could not update hitl_loop max_retries: {e}")

MaxKernel/hitl_agent/tools/tools.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tool setup for HITL kernel generation agents."""
22

33
import logging
4+
45
from google.adk.models import LlmRequest
56
from google.adk.tools import ToolContext
67
from google.adk.tools.retrieval.vertex_ai_rag_retrieval import (
@@ -9,10 +10,13 @@
910
from vertexai.preview import rag
1011

1112
from hitl_agent.config import RAG_CORPUS
13+
from hitl_agent.tools.filesystem_tools import (
14+
filesystem_tool_r,
15+
filesystem_tool_rw,
16+
)
17+
from hitl_agent.tools.retries_tool import set_max_compilation_retries
1218
from hitl_agent.tools.search_api_tool import search_api_tool
1319
from hitl_agent.tools.workspace_tool import set_working_directory
14-
from hitl_agent.tools.filesystem_tools import filesystem_tool_r, filesystem_tool_rw
15-
from hitl_agent.tools.retries_tool import set_max_compilation_retries
1620

1721

1822
# Custom VertexAiRagRetrieval that forces function_declarations mode to avoid

MaxKernel/hitl_agent/tools/workspace_tool.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22

33
import logging
44
import os
5+
56
from google.adk.tools import FunctionTool, ToolContext
67
from google.adk.tools.mcp_tool.mcp_session_manager import MCPSessionManager
78

89
import hitl_agent.config as config
9-
from hitl_agent.tools.filesystem_tools import filesystem_tool_r, filesystem_tool_rw
10+
from hitl_agent.tools.filesystem_tools import (
11+
filesystem_tool_r,
12+
filesystem_tool_rw,
13+
)
1014

1115

1216
async def set_working_directory_fn(
13-
path: str, tool_context: ToolContext, persist: bool = False
17+
path: str, tool_context: ToolContext, persist: bool = False
1418
) -> str:
1519
"""Set the active workspace/working directory path for the session.
1620
@@ -65,10 +69,10 @@ async def set_working_directory_fn(
6569
server_params_r.args[-1] = abs_path
6670
await filesystem_tool_r.close()
6771
filesystem_tool_r._mcp_session_manager = MCPSessionManager(
68-
connection_params=filesystem_tool_r._connection_params,
69-
errlog=filesystem_tool_r._errlog,
70-
sampling_callback=filesystem_tool_r._sampling_callback,
71-
sampling_capabilities=filesystem_tool_r._sampling_capabilities,
72+
connection_params=filesystem_tool_r._connection_params,
73+
errlog=filesystem_tool_r._errlog,
74+
sampling_callback=filesystem_tool_r._sampling_callback,
75+
sampling_capabilities=filesystem_tool_r._sampling_capabilities,
7276
)
7377

7478
# Update read-write filesystem tool
@@ -78,10 +82,10 @@ async def set_working_directory_fn(
7882
server_params_rw.args[-1] = abs_path
7983
await filesystem_tool_rw.close()
8084
filesystem_tool_rw._mcp_session_manager = MCPSessionManager(
81-
connection_params=filesystem_tool_rw._connection_params,
82-
errlog=filesystem_tool_rw._errlog,
83-
sampling_callback=filesystem_tool_rw._sampling_callback,
84-
sampling_capabilities=filesystem_tool_rw._sampling_capabilities,
85+
connection_params=filesystem_tool_rw._connection_params,
86+
errlog=filesystem_tool_rw._errlog,
87+
sampling_callback=filesystem_tool_rw._sampling_callback,
88+
sampling_capabilities=filesystem_tool_rw._sampling_capabilities,
8589
)
8690

8791
return f"Successfully switched working directory to: {abs_path} (persisted: {persist})"

0 commit comments

Comments
 (0)