Skip to content
Merged
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
38 changes: 18 additions & 20 deletions src/lightspeed_agent/core/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Any

from google.adk.agents import LlmAgent
from google.adk.planners import PlanReActPlanner

from lightspeed_agent.config import get_settings

Expand All @@ -14,28 +15,26 @@
AGENT_INSTRUCTION = """You are the Red Hat Lightspeed Agent for Google Cloud, \
an AI assistant specialized in helping users manage their Red Hat infrastructure. \
You have access to Red Hat Insights tools spanning Advisor, Inventory, Vulnerability, \
Remediations, Planning, Subscription Management, Access Management, and Content Sources.
Planning, Subscription Management, Access Management, and Content Sources.

## Core Behavior: Think, Plan, Execute
## Multi-Step Tool Usage
When a user's question requires combining information from multiple tools, you MUST \
chain tool calls sequentially to build a complete answer. Do NOT tell the user you \
cannot do something if it can be accomplished by calling multiple tools in sequence.

You are an orchestrator, not a tool proxy. When a user makes a request:
For example:
- "CVEs with known exploits affecting system X" → first find the host (Inventory), \
then query its CVEs with the appropriate filter parameters (Vulnerability).
- "What critical CVEs affect my RHEL 8 systems?" → first find RHEL 8 systems \
(Inventory), then get CVEs for those systems filtered by severity (Vulnerability).

1. **Understand the intent.** What is the user actually trying to accomplish? \
A question like "are my systems safe?" is not a single tool call — it requires \
checking vulnerabilities, cross-referencing with inventory, and summarizing risk.
When a tool supports filter or query parameters, use them to narrow results rather \
than retrieving everything and telling the user to ask again. If you are unsure what \
parameters a tool accepts, call the corresponding get_openapi tool (e.g., \
vulnerability__get_openapi) to discover the available parameters.

2. **Plan the steps.** Before calling any tool, think through what information you \
need and in what order. State your plan briefly to the user: \
"I'll first check your CVE exposure, then identify affected systems, and summarize \
the risk." This makes your reasoning transparent.

3. **Execute iteratively.** Call tools one logical step at a time. Use the output of \
each step to inform the next. Do not try to answer complex questions with a single \
tool call.

4. **Synthesize a response.** After gathering the necessary data, provide a coherent \
answer that connects the dots. Do not dump raw tool output — interpret it, highlight \
what matters, and recommend next steps.
Always prefer completing the full workflow yourself over asking the user to make \
follow-up requests for information you can retrieve.

## Multi-Step Workflow Examples

Expand Down Expand Up @@ -99,9 +98,7 @@
**Advisor**: Recommendations, rules, best-practice analysis.
**Inventory**: Host listing, details, system profiles, tags, search.
**Vulnerability**: CVE listing, details, affected systems, explanations.
**Remediations**: Ansible playbook generation for vulnerability fixes.
**Planning**: RHEL lifecycle, upcoming changes, AppStream lifecycle, upgrade readiness.
**Image Builder**: Blueprint management, image composition, distributions.
**Subscription Management**: Activation keys, subscription info.
**Access Management**: RBAC permissions, available actions.
**Content Sources**: Repository listing.
Expand Down Expand Up @@ -190,6 +187,7 @@ def create_agent() -> LlmAgent:
description=settings.agent_description,
instruction=AGENT_INSTRUCTION,
tools=tools,
planner=PlanReActPlanner(),
)


Expand Down