Skip to content

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

Merged
w7-mgfcode merged 1 commit into
devfrom
fix/demo-ollama-llm-key-present
Jun 1, 2026
Merged

fix(api): showcase agent step runs on local Ollama (no API key needed)#341
w7-mgfcode merged 1 commit into
devfrom
fix/demo-ollama-llm-key-present

Conversation

@w7-mgfcode
Copy link
Copy Markdown
Owner

Root cause

On a local-Ollama stack (agent_default_model = ollama:qwen3:8b), the showcase agent_hitl_flow step (and legacy agent step) always ⏭️ skip with "no API key matching agent_default_model provider" — because _llm_key_present() in app/features/demo/pipeline.py only recognized cloud providers and returned False for ollama, which needs no API key.

Fix

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

Tests

  • test_llm_key_present_ollama_needs_no_keyollama:qwen3:8b with no keys set → True.
  • test_llm_key_present_cloud_still_requires_keyopenai:* with empty key → False (cloud branch unchanged).

Scope note

Demo-only. Interactive Agent Chat (Chat page) builds the model via agents/base.py:build_agent_model (supports ollama:) and does not gate on _llm_key_present, so HITL already worked there on Ollama — this PR brings the showcase pipeline in line.

Validation

  • ruff check ✅ · ruff format --check
  • mypy app/ ✅ — only pre-existing xgboost optional-dep import errors in untouched files
  • pyright app/features/demo ✅ 0 errors
  • pytest -m "not integration" ✅ 1653 passed, 12 skipped

Closes #340

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Sorry @w7-mgfcode, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8df5ddc-85d3-44d6-bba3-91372998389f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/demo-ollama-llm-key-present

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@w7-mgfcode w7-mgfcode merged commit ac1af1b into dev Jun 1, 2026
8 checks passed
@w7-mgfcode w7-mgfcode deleted the fix/demo-ollama-llm-key-present branch June 1, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant