Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions holmes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ def get_runbook_catalog() -> Optional[RunbookCatalog]:
return runbook_catalog

def create_console_tool_executor(
self, dal: Optional["SupabaseDal"], refresh_status: bool = False
self,
dal: Optional["SupabaseDal"],
refresh_status: bool = False,
disable_todos: bool = False,
) -> ToolExecutor:
"""
Creates a ToolExecutor instance configured for CLI usage. This executor manages the available tools
Expand All @@ -318,6 +321,13 @@ def create_console_tool_executor(
cli_toolsets = self.toolset_manager.list_console_toolsets(
dal=dal, refresh_status=refresh_status
)

# Disable the core_investigation toolset (which contains TodoWriteTool) when in fast mode
if disable_todos:
cli_toolsets = [
ts for ts in cli_toolsets if ts.name != "core_investigation"
]

return ToolExecutor(cli_toolsets)

def create_tool_executor(self, dal: Optional["SupabaseDal"]) -> ToolExecutor:
Expand All @@ -343,8 +353,11 @@ def create_console_toolcalling_llm(
dal: Optional["SupabaseDal"] = None,
refresh_toolsets: bool = False,
tracer=None,
disable_todos: bool = False,
) -> "ToolCallingLLM":
tool_executor = self.create_console_tool_executor(dal, refresh_toolsets)
tool_executor = self.create_console_tool_executor(
dal, refresh_toolsets, disable_todos
)
from holmes.core.tool_calling_llm import ToolCallingLLM

return ToolCallingLLM(
Expand Down
4 changes: 4 additions & 0 deletions holmes/core/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ def build_initial_ask_messages(
runbooks: Optional runbook catalog
system_prompt_additions: Optional additional system prompt content
"""
# Check if todos are enabled by looking for core_investigation toolset
has_todos = any(ts.name == "core_investigation" for ts in tool_executor.toolsets)

# Load and render system prompt internally
system_prompt_template = "builtin://generic_ask.jinja2"
template_context = {
"toolsets": tool_executor.toolsets,
"runbooks": runbooks or {},
"system_prompt_additions": system_prompt_additions or "",
"investigation_id": investigation_id,
"has_todos": has_todos,
}
system_prompt_rendered = load_and_render_prompt(
system_prompt_template, template_context
Expand Down
6 changes: 6 additions & 0 deletions holmes/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ def ask(
"--system-prompt-additions",
help="Additional content to append to the system prompt",
),
fast: bool = typer.Option(
False,
"--fast",
help="Fast mode: disables todos tool for quicker responses",
),
):
"""
Ask any question and answer using available tools
Expand Down Expand Up @@ -252,6 +257,7 @@ def ask(
dal=None, # type: ignore
refresh_toolsets=refresh_toolsets, # flag to refresh the toolset status
tracer=tracer,
disable_todos=fast, # disable todos tool when --fast is used
)

if prompt_file and prompt:
Expand Down
2 changes: 2 additions & 0 deletions holmes/plugins/prompts/_general_instructions.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
* For any question, try to make the answer specific to the user's cluster.
** For example, if asked to port forward, find out the app or pod port (kubectl describe) and provide a port forward command specific to the user's question

{% if has_todos %}
# MANDATORY Task Management

* You MUST use the TodoWrite tool for ANY investigation requiring multiple steps
Expand All @@ -62,6 +63,7 @@
* Follow ALL tasks in your plan - don't skip any tasks
* Use task management to ensure you don't miss important investigation steps
* If you discover additional steps during investigation, add them to your task list using TodoWrite
{% endif %}

# Tool/function calls

Expand Down
Loading