langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Agent Model Selection Bug

Open mennovdmm opened this issue 1 year ago • 5 comments

Bug Description

Bug Description

After updating to the latest Langflow version (automatic update 2025-05-18), all Agent components automatically fallback from Claude 3.5 Sonnet to Claude 3.7 Sonnet, regardless of user selection.

Expected: Claude 3.5 Sonnet remains selected Actual: Component reverts to Claude 3.7 Sonnet

Reproduction

Steps to Reproduce

  1. Create new Agent component
  2. Set Model Provider to "Anthropic"
  3. Select "Claude 3.5 Sonnet" from model dropdown
  4. Save the configuration
  5. Refresh/reopen the component settings

Expected behavior

Environment

  • Langflow version: Latest (auto-updated 2025-05-18 01:00:50Z 1.4.1 (latest))
  • Docker deployment via Elestio
  • Issue confirmed on both self-hosted and DataStax hosted versions
  • All browsers affected (including incognito)

Additional Context

  • Regular Anthropic/LLM components work correctly with Claude 3.5
  • Only affects Agent component specifically
  • Started immediately after automatic update
  • Impact: Claude 3.5 has larger context window needed for complex prompts

Impact

Mission-critical for production flows requiring Claude 3.5's larger context window.

Who can help?

No response

Operating System

Ubuntu 24.04 LTS (kernel 6.8.0-60-generic)

Langflow Version

1.4.1 (latest)

Python Version

3.12

Screenshot

No response

Flow File

No response

mennovdmm avatar May 18 '25 06:05 mennovdmm

The issue you're experiencing seems to be related to a change in the latest Langflow update (version 1.4.1), which might be affecting the model selection logic for Agent components. The update introduced a DropdownInput for selecting the "Model Provider" and dynamically populates options from MODEL_PROVIDERS_DICT. This change could be causing the automatic fallback to Claude 3.7 Sonnet when the component is refreshed or reopened [1].

To address this, you might want to check if there are any specific conditions or default settings in the code that could be causing the fallback to the latest model version. It could be helpful to review the logic in the get_llm method or related functions that handle model selection and ensure that the selected model version is being correctly saved and loaded from the configuration settings [1].

If the issue persists, consider looking into the configuration saving and loading mechanism to ensure that the selected model version is being correctly stored and retrieved. The use of YAML files for configuration might be a point to investigate [2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar May 18 '25 06:05 dosubot[bot]

@dosu I am also having this issue, for an agent using a Google Generative AI model.

I simply add an agent, configure the API Key, and then it auto-refreshes the model list. It doesn't auto-refresh until I add the key, which is understandable.

I configure the model I want, and then save the flow. Suppose I go back to the home page, and then re-open the flow. This auto-selects the first model in each agent's model list, which often tends to be a Gemma model with no support for function calling. I have to go there and re-configure every single agent.

ricardopieper avatar Jul 03 '25 20:07 ricardopieper

Also having this issue, very annoying for complex agent set ups

Wish there was a workaround to just set a default model for a specific flow or just save the last state of an entire flow per flow

Logrui avatar Jul 18 '25 00:07 Logrui

@Logrui Did you upgrade to the newest 1.15 version?

Yukiyukiyeah avatar Jul 18 '25 00:07 Yukiyukiyeah

Fixed by: https://github.com/langflow-ai/langflow/pull/9495

Empreiteiro avatar Nov 05 '25 17:11 Empreiteiro