Skip to content

GIE-501(prompt): add query efficiency guidance to reduce excessive tool calls#46

Open
slashpai wants to merge 1 commit intorhobs:mainfrom
slashpai:query-efficiency-prompt
Open

GIE-501(prompt): add query efficiency guidance to reduce excessive tool calls#46
slashpai wants to merge 1 commit intorhobs:mainfrom
slashpai:query-efficiency-prompt

Conversation

@slashpai
Copy link
Member

Add QUERY EFFICIENCY section to ServerPrompt with PromQL aggregation patterns
(topk, sum by, rate) to prevent agents from querying one entity at a time

Details on eval runs in jira

Triggered by evals test cpu-usage from #34

@slashpai slashpai requested a review from a team March 13, 2026 11:25
@openshift-ci openshift-ci bot requested review from iNecas and rexagod March 13, 2026 11:25
@openshift-ci
Copy link

openshift-ci bot commented Mar 13, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: slashpai

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@slashpai slashpai requested review from iNecas and saswatamcode and removed request for iNecas March 13, 2026 11:26
- Add QUERY EFFICIENCY section to ServerPrompt with PromQL aggregation patterns
  (topk, sum by, rate) to prevent agents from querying one entity at a time
- Mark Steps 2-3 (get_label_names, get_label_values) as optional when aggregated
  queries suffice
- Add aggregation reminders to ExecuteInstantQueryPrompt and ExecuteRangeQueryPrompt

Signed-off-by: Jayapriya Pai <janantha@redhat.com>
@slashpai slashpai force-pushed the query-efficiency-prompt branch from 3e3f5d0 to fb9ac9a Compare March 13, 2026 11:27
@slashpai
Copy link
Member Author

@saswatamcode @iNecas Please take a look when you get chance

Copy link
Member

@saswatamcode saswatamcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, but some comments

- Search the returned list to find the exact metric name that exists

**STEP 2: Call get_label_names for the metric you found**
**STEP 2 (optional): Call get_label_names for the metric you found**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping these would save tool_calls and token, but I think that would end up harming accuracy, as LLM will effectively be guessing labels. For non-platform custom metrics these def shouldn't be optional


## QUERY EFFICIENCY

Write PromQL that answers the question in as few queries as possible. Do NOT query one entity at a time (e.g., one query per pod, per namespace, or per node). Instead, use PromQL aggregation to get all results in a single query.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great advice for broad questions like top CPU or total reqs on a service.

But I feel like this would work against it, when there would be some incident RCA where it should look per entity/pod level, right?

- **execute_range_query**: Trends over time, rate calculations, historical analysis`
- **execute_range_query**: Trends over time, rate calculations, historical analysis

## QUERY EFFICIENCY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming to Query Aggregation? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants