Skip to content

Operator sends empty system prompt to sandbox agent, causing execution failures #273

Description

@pavolloffay

Problem

When the operator calls the sandbox agent, it sends an empty system prompt:

https://github.com/openshift/lightspeed-agentic-operator/blob/main/controller/proposal/sandbox_agent.go#L219

resp, err := client.Run(ctx, "", query, schema, agentCtx, headers)
                        ^^-- empty system prompt

The sandbox falls back to a minimal default:

https://github.com/openshift/lightspeed-agentic-sandbox/blob/main/src/lightspeed_agentic/routes/query.py#L70

system_prompt = req.systemPrompt or "You are an AI agent."

This causes execution failures because the LLM doesn't know:

  1. It has the exec_command tool for running shell commands
  2. oc and kubectl are available in PATH
  3. It should actually execute remediation steps, not just describe them

Observed Behavior

Execution fails with errors like:

{
  "error": "No actions were executed because tool access is required. Please allow me to run the `oc` commands to apply the Job, wait, fetch logs, and delete the Job."
}

Or:

{
  "error": "/bin/sh: 1: oc: not found"
}

The LLM outputs text asking for permission instead of calling the available tools.

Environment

  • Cluster: OpenShift (ROSA)
  • Operator image: quay.io/redhat-user-workloads/crt-nshift-lightspeed-tenant/lightspeed-agentic-operator:main@sha256:d7373db02667fe2fd3e045616144f5498ec7ef01ca715bce73e9e8e93bb97c50
  • Sandbox image: quay.io/redhat-user-workloads/crt-nshift-lightspeed-tenant/lightspeed-agentic-sandbox:main@sha256:767982acbf70ca130facc2faef45aaedac8a26881bd3823137182f8199492c92
  • Model: gpt-5 via LiteLLM gateway

Proposed Solutions

Option 1: Add systemPrompt field to Agent CRD

Allow cluster admins to configure per-agent system prompts:

apiVersion: agentic.openshift.io/v1alpha1
kind: Agent
metadata:
  name: default
spec:
  llmProvider:
    name: litellm
  model: gpt-5
  systemPrompt: |
    You are an OpenShift cluster remediation agent. You have access to:
    - exec_command: Execute shell commands. oc and kubectl are available.
    - File read/write capabilities
    
    When given a remediation plan, execute each action using these tools.

Option 2: Generate sensible default system prompts per step

The operator could generate appropriate prompts based on the step type:

  • Analysis: "You are an OpenShift diagnostic agent. Analyze the cluster state and propose remediation options..."
  • Execution: "You are an OpenShift remediation agent. Execute the approved plan using the exec_command tool. oc and kubectl are available..."
  • Verification: "You are an OpenShift verification agent. Verify that the remediation was successful..."

Option 3: Improve sandbox default

Change the sandbox default from "You are an AI agent." to something that explains the available tools.

Reproduction Steps

  1. Deploy the agentic operator with any LLM backend
  2. Create a simple proposal:
apiVersion: agentic.openshift.io/v1alpha1
kind: Proposal
metadata:
  name: test
  namespace: openshift-lightspeed
spec:
  request: "List all pods in the openshift-lightspeed namespace."
  targetNamespaces:
    - openshift-lightspeed
  analysis:
    agent: default
  execution:
    agent: default
  1. Observe that analysis completes but execution fails with "tool access required" errors

Additional Context

The openai-agents SDK's Shell capability does provide instructions ("Use exec_command for shell execution"), but these may not be sufficient for the LLM to understand the full context of being a Kubernetes cluster agent with oc/kubectl available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions