Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# LLM_PROVIDER=gemini

# Model name (works with both providers). For litellm, use "provider/model" format
# (e.g., "openai/gpt-4o", "vertex_ai/gemini-2.5-flash"). For gemini, any provider/
# (e.g., "openai/gpt-4o", "vertex_ai/gemini-3.5-flash"). For gemini, any provider/
# prefix is stripped automatically. Falls back to GEMINI_MODEL when not set.
# LLM_MODEL=

Expand Down Expand Up @@ -39,8 +39,8 @@ GOOGLE_CLOUD_LOCATION=global
# Path to a service account JSON key file. Uses Application Default Credentials (ADC).
# GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json

# Model to use (default: gemini-2.5-flash)
GEMINI_MODEL=gemini-2.5-flash
# Model to use (default: gemini-3.5-flash)
GEMINI_MODEL=gemini-3.5-flash

# Gemini HTTP retries (google-genai SDK: exponential backoff + jitter for 429/408/5xx)
# See: https://cloud.google.com/vertex-ai/generative-ai/docs/retry-strategy
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

Red Hat Lightspeed Agent for Google Cloud — an A2A-ready (Agent-to-Agent protocol) AI agent providing access to Red Hat Insights, built on Google Agent Development Kit (ADK), Gemini 2.5 Flash, and a Red Hat Lightspeed MCP server sidecar. Integrates with Google Cloud Marketplace for provisioning, billing, and metering.
Red Hat Lightspeed Agent for Google Cloud — an A2A-ready (Agent-to-Agent protocol) AI agent providing access to Red Hat Insights, built on Google Agent Development Kit (ADK), Gemini 3.5 Flash, and a Red Hat Lightspeed MCP server sidecar. Integrates with Google Cloud Marketplace for provisioning, billing, and metering.

## Common Commands

Expand Down Expand Up @@ -140,5 +140,5 @@ CORS → body size limits → security headers → rate limiting (60 req/min, 10

All configuration is via environment variables, managed through Pydantic settings in `config/settings.py`. See `.env.example` for the complete list (30+ vars) and `docs/configuration.md` for detailed documentation.

Key variables: `GOOGLE_API_KEY` (or Vertex AI), `GEMINI_MODEL` (default: `gemini-2.5-flash`), `DATABASE_URL`, `SESSION_DATABASE_URL`, `MCP_TRANSPORT_MODE`, `MCP_SERVER_URL`, `RED_HAT_SSO_CLIENT_ID`/`SECRET`. Dev-only bypasses: `SKIP_JWT_VALIDATION`, `SKIP_DCR_JWT_VALIDATION`, `SKIP_ORDER_VALIDATION`.
Key variables: `GOOGLE_API_KEY` (or Vertex AI), `GEMINI_MODEL` (default: `gemini-3.5-flash`), `DATABASE_URL`, `SESSION_DATABASE_URL`, `MCP_TRANSPORT_MODE`, `MCP_SERVER_URL`, `RED_HAT_SSO_CLIENT_ID`/`SECRET`. Dev-only bypasses: `SKIP_JWT_VALIDATION`, `SKIP_DCR_JWT_VALIDATION`, `SKIP_ORDER_VALIDATION`.

2 changes: 1 addition & 1 deletion EXTERNAL_SERVICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The agent uses Google Gemini models by default, but Vertex AI supports deploying

| Setting | Default | Description |
|---------|---------|-------------|
| `GEMINI_MODEL` | `gemini-2.5-flash` | Model used for agent responses |
| `GEMINI_MODEL` | `gemini-3.5-flash` | Model used for agent responses |
| `GOOGLE_GENAI_USE_VERTEXAI` | `false` | Switch between AI Studio and Vertex AI |
| `GOOGLE_CLOUD_LOCATION` | `us-central1` | Region for Vertex AI |

Expand Down
5 changes: 3 additions & 2 deletions deploy/cloudrun/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1258,8 +1258,9 @@ gcloud run services update lightspeed-agent \

**Tuning tips:**

- **51,200 characters** (default, 50 KiB) is a conservative limit that keeps input tokens well within
Vertex AI TPM quotas for `gemini-2.5-flash`
- **51,200 characters** (default, 50 KiB) is a conservative starting point meant to keep input
tokens well within your Vertex AI TPM quota — verify against the quota for whichever model
you configure via `GEMINI_MODEL`, since quotas and context windows vary by model
- If you have higher TPM quotas, increase the limit to allow richer responses
- The optimal limit depends on the model's context window and expected session length — longer
multi-turn sessions accumulate more context, leaving less room for individual tool results.
Expand Down
2 changes: 1 addition & 1 deletion deploy/cloudrun/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
- name: GOOGLE_CLOUD_LOCATION
value: "${VERTEXAI_LOCATION}"
- name: GEMINI_MODEL
value: "gemini-2.5-flash"
value: "gemini-3.5-flash"
# Agent Configuration
- name: AGENT_HOST
value: "0.0.0.0"
Expand Down
4 changes: 2 additions & 2 deletions deploy/openshift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ The MCP server runs as a sidecar container in the agent pod.

| Value | Description | Default |
|---|---|---|
| `google.geminiModel` | Default Gemini model (used when `llm.model` is not set) | `gemini-2.5-flash` |
| `google.geminiModel` | Default Gemini model (used when `llm.model` is not set) | `gemini-3.5-flash` |
| `google.useVertexAI` | Use Vertex AI instead of AI Studio | `false` |
| `google.cloudLocation` | Vertex AI region (use `global` for pay-as-you-go) | `global` |
| `secrets.gcpServiceAccountKey` | GCP service account key JSON for Vertex AI authentication via ADC (alternative to `secrets.googleApiKey`) | `""` |
Expand Down Expand Up @@ -624,7 +624,7 @@ To use Vertex AI with service account authentication, set in `my-values.yaml`:

```yaml
llm:
model: "vertex_ai/gemini-2.5-flash"
model: "vertex_ai/gemini-3.5-flash"

google:
useVertexAI: true
Expand Down
4 changes: 2 additions & 2 deletions deploy/openshift/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ google:
# Set to true to use Vertex AI instead of Google AI Studio
useVertexAI: false
cloudLocation: global
geminiModel: gemini-2.5-flash
geminiModel: gemini-3.5-flash
httpRetry:
attempts: 5
initialDelay: 1.0
Expand All @@ -113,7 +113,7 @@ llm:
# "litellm" — use any provider supported by LiteLLM (OpenAI, Anthropic, etc.).
provider: "gemini"
# Model name (works with both providers). For litellm, use "provider/model"
# format (e.g., "vertex_ai/gemini-2.5-flash"). For gemini, any provider/
# format (e.g., "vertex_ai/gemini-3.5-flash"). For gemini, any provider/
# prefix is stripped automatically. Falls back to google.geminiModel when empty.
model: ""
# Custom API endpoint URL (litellm only, for self-hosted models).
Expand Down
2 changes: 1 addition & 1 deletion deploy/podman/lightspeed-agent-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data:
# Google AI Configuration
GOOGLE_GENAI_USE_VERTEXAI: "FALSE"
GOOGLE_CLOUD_LOCATION: "global"
GEMINI_MODEL: "gemini-2.5-flash"
GEMINI_MODEL: "gemini-3.5-flash"

# Red Hat SSO Configuration
RED_HAT_SSO_ISSUER: "https://sso.redhat.com/auth/realms/redhat-external"
Expand Down
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ with the [A2A protocol](https://google.github.io/A2A/) (Agent-to-Agent) for inte
│ │ (agents/llm_agent.py) │ │
│ │ │ │
│ │ + name: str │ │
│ │ + model: str (e.g., "gemini-2.5-flash") │ │
│ │ + model: str (e.g., "gemini-3.5-flash") │ │
│ │ + instruction: str │ │
│ │ + tools: list[BaseTool | McpToolset] │ │
│ └───────────────────────────────────┬──────────────────────────────────┘ │
Expand Down
8 changes: 4 additions & 4 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The agent supports multiple LLM backends via Google ADK. By default it uses Gemi
| Variable | Default | Description |
|----------|---------|-------------|
| `LLM_PROVIDER` | `gemini` | LLM provider backend: `gemini` (Google AI Studio or Vertex AI) or `litellm` (100+ providers via LiteLLM) |
| `LLM_MODEL` | - | Model name (works with both providers). For `litellm`: uses `provider/model` format (e.g., `openai/gpt-4o`, `vertex_ai/gemini-2.5-flash`). For `gemini`: any `provider/` prefix is stripped automatically. Falls back to `GEMINI_MODEL` when not set |
| `LLM_MODEL` | - | Model name (works with both providers). For `litellm`: uses `provider/model` format (e.g., `openai/gpt-4o`, `vertex_ai/gemini-3.5-flash`). For `gemini`: any `provider/` prefix is stripped automatically. Falls back to `GEMINI_MODEL` when not set |
| `LLM_API_KEY` | - | API key for non-Google LLM providers (`litellm` only). Some providers also accept their own env vars (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.) |
| `LLM_API_BASE` | - | Custom API endpoint URL (`litellm` only). For self-hosted models or proxy endpoints |

Expand All @@ -22,13 +22,13 @@ The agent supports multiple LLM backends via Google ADK. By default it uses Gemi
```bash
# These are the defaults; no LLM_* variables required
LLM_PROVIDER=gemini
GEMINI_MODEL=gemini-2.5-flash
GEMINI_MODEL=gemini-3.5-flash
```

**Different Gemini model:**

```bash
LLM_MODEL=gemini-2.0-flash
LLM_MODEL=gemini-2.5-flash
```

**OpenAI:**
Expand Down Expand Up @@ -80,7 +80,7 @@ These settings apply when `LLM_PROVIDER=gemini` (the default).
| `GOOGLE_API_KEY` | - | Google AI Studio API key (required if not using Vertex AI) |
| `GOOGLE_CLOUD_PROJECT` | - | GCP project ID (required for Vertex AI) |
| `GOOGLE_CLOUD_LOCATION` | `global` | Vertex AI model location (use `global` for pay-as-you-go) |
| `GEMINI_MODEL` | `gemini-2.5-flash` | Default Gemini model (used when `LLM_MODEL` is not set) |
| `GEMINI_MODEL` | `gemini-3.5-flash` | Default Gemini model (used when `LLM_MODEL` is not set) |
| `GOOGLE_APPLICATION_CREDENTIALS` | - | Path to GCP service account key JSON file for Vertex AI authentication (ADC) |
| `GEMINI_HTTP_RETRY_ATTEMPTS` | `5` | Max HTTP attempts per model call (including the first). Use `1` to disable SDK retries. Aligns with [google-genai defaults](https://cloud.google.com/vertex-ai/generative-ai/docs/retry-strategy). |
| `GEMINI_HTTP_RETRY_INITIAL_DELAY` | `1.0` | Initial backoff delay in seconds (exponential backoff with jitter). |
Expand Down
2 changes: 1 addition & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ curl -s -o /dev/null -w "%{http_code}" \

```bash
# Test Gemini API directly
curl -X POST "https://generativelanguage.googleapis.com/v1/models/gemini-2.5-flash:generateContent?key=$GOOGLE_API_KEY" \
curl -X POST "https://generativelanguage.googleapis.com/v1/models/gemini-3.5-flash:generateContent?key=$GOOGLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"Hello"}]}]}'
```
Expand Down
2 changes: 1 addition & 1 deletion src/lightspeed_agent/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Settings(BaseSettings):
description="Google Cloud location for Vertex AI (use 'global' for pay-as-you-go)",
)
gemini_model: str = Field(
default="gemini-2.5-flash",
default="gemini-3.5-flash",
description="Gemini model to use",
)
google_application_credentials: str | None = Field(
Expand Down
2 changes: 1 addition & 1 deletion src/lightspeed_agent/core/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def _create_model(settings: Settings) -> BaseLlm:
return LiteLlm(**kwargs)

model_name = settings.llm_model or settings.gemini_model
# Strip LiteLLM provider prefix (e.g. "vertex_ai/gemini-2.5-flash" -> "gemini-2.5-flash")
# Strip LiteLLM provider prefix (e.g. "vertex_ai/gemini-3.5-flash" -> "gemini-3.5-flash")
if "/" in model_name:
model_name = model_name.split("/", 1)[1]
retry_opts = http_retry_options_from_settings(settings)
Expand Down
5 changes: 5 additions & 0 deletions tests/test_llm_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ def test_default_provider_is_gemini():
assert s.llm_provider == "gemini"


def test_default_gemini_model():
s = Settings(google_api_key="test-key")
assert s.gemini_model == "gemini-3.5-flash"


def test_llm_model_defaults_to_none():
s = Settings(google_api_key="test-key")
assert s.llm_model is None
Expand Down
Loading