Skip to content

fix(api): showcase agent step skips on local Ollama (no API key needed) #340

@w7-mgfcode

Description

@w7-mgfcode

Summary

On a local-Ollama stack (agent_default_model = ollama:qwen3:8b), the showcase pipeline's agent_hitl_flow step (and the legacy agent step) always ⏭️ skip with "no API key matching agent_default_model provider" — even though Ollama needs no API key and is reachable. So the showcase HITL phase can never run on a local-Ollama dogfood setup.

Root cause

_llm_key_present() in app/features/demo/pipeline.py only recognizes cloud providers and returns False for anything else:

provider = model.split(":", 1)[0] if ":" in model else ""
if provider == "anthropic": return bool(settings.anthropic_api_key)
if provider == "openai":    return bool(settings.openai_api_key)
if provider in ("google-gla", "google-vertex"): return bool(settings.google_api_key)
return False   # <- ollama lands here

ollama requires no key, so the gate wrongly reports "no key" and the step skips.

Scope

Demo-only. Interactive Agent Chat (Chat page) builds the model via app/features/agents/agents/base.py:build_agent_model (which supports ollama:OpenAIChatModel/OllamaProvider) and does NOT gate on _llm_key_present, so HITL already works there on Ollama. Only the demo pipeline gates on this helper.

Fix

Add an ollama branch returning True (no key required). The step still degrades gracefully if Ollama is unreachable — the chat round-trip fails and the step skips via the existing error path, so we let it attempt the call rather than pre-skip.

if provider == "ollama":
    return True

Tests

Add a direct unit test for _llm_key_present():

  • ollama:qwen3:8b (no keys set) → True
  • openai:gpt with empty openai_api_keyFalse (cloud branch unchanged)

Notes

Found during a local-Ollama showcase dogfood on 2026-06-01.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions