-
Notifications
You must be signed in to change notification settings - Fork 8.2k
feat(cuga): new cuga release #10559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jordanrfrazier
merged 7 commits into
langflow-ai:main
from
sami-marreed:bugfix/cuga-new-release
Nov 11, 2025
Merged
feat(cuga): new cuga release #10559
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
74dfaf1
feat(cuga): new cuga release
sami-marreed 1099a5b
[autofix.ci] apply automated fixes
autofix-ci[bot] b240d09
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] 68271f5
Merge branch 'main' of https://github.com/langflow-ai/langflow into b…
sami-marreed b017a89
chore: merge from main
sami-marreed 224ec61
[autofix.ci] apply automated fixes
autofix-ci[bot] 323cbd6
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| import asyncio | ||
| import json | ||
| import os | ||
| import re | ||
| import traceback | ||
| import uuid | ||
|
|
@@ -108,9 +107,9 @@ class CugaComponent(ToolCallingAgentComponent): | |
| info=( | ||
| "Custom instructions or policies for the agent to adhere to during its operation.\n" | ||
| "Example:\n" | ||
| "# Plan\n" | ||
| "## Plan\n" | ||
| "< planning instructions e.g. which tools and when to use>\n" | ||
| "# Answer\n" | ||
| "## Answer\n" | ||
| "< final answer instructions how to answer>" | ||
| ), | ||
| value="", | ||
|
|
@@ -193,6 +192,20 @@ class CugaComponent(ToolCallingAgentComponent): | |
| info="If true, will add a tool to the agent that returns the current date.", | ||
| value=True, | ||
| ), | ||
| BoolInput( | ||
| name="lite_mode", | ||
| display_name="Enable CugaLite", | ||
| info="Enable CugaLite for simple API tasks (faster execution).", | ||
| value=True, | ||
| advanced=False, | ||
| ), | ||
| IntInput( | ||
| name="lite_mode_tool_threshold", | ||
| display_name="CugaLite Tool Threshold", | ||
| info="Route to CugaLite if app has fewer than this many tools.", | ||
| value=25, | ||
| advanced=False, | ||
| ), | ||
| BoolInput( | ||
| name="browser_enabled", | ||
| display_name="Enable Browser", | ||
|
|
@@ -254,33 +267,27 @@ async def call_agent( | |
| } | ||
| logger.debug(f"LLM MODEL TYPE: {type(llm)}") | ||
| if current_input: | ||
| try: | ||
| from cuga.config import settings as cuga_settings | ||
| # Import settings first | ||
| from cuga.config import settings | ||
|
|
||
| logger.info("Updating cuga settings programmatically") | ||
| cuga_settings.set("advanced_features.registry", False) # noqa: FBT003 | ||
| # Use Dynaconf's set() method to update settings dynamically | ||
| # This properly updates the settings object without corruption | ||
| logger.debug("Updating CUGA settings via Dynaconf set() method") | ||
|
|
||
| if self.browser_enabled: | ||
| logger.info("browser_enabled is true, setting mode to hybrid") | ||
| cuga_settings.set("advanced_features.mode", "hybrid") | ||
| cuga_settings.set("advanced_features.use_vision", False) # noqa: FBT003 | ||
| else: | ||
| logger.info("browser_enabled is false, setting mode to api") | ||
| cuga_settings.set("advanced_features.mode", "api") | ||
|
|
||
| logger.info(f"Cuga settings updated - MODE: {cuga_settings.get('advanced_features.mode')}") | ||
| except (ImportError, AttributeError) as e: | ||
| logger.warning(f"Could not update cuga settings: {e}") | ||
| os.environ["DYNACONF_ADVANCED_FEATURES__REGISTRY"] = "false" | ||
| if self.browser_enabled: | ||
| logger.info("browser_enabled is true, setting env to hybrid") | ||
| os.environ["DYNACONF_ADVANCED_FEATURES__MODE"] = "hybrid" | ||
| os.environ["DYNACONF_ADVANCED_FEATURES__USE_VISION"] = "false" | ||
| else: | ||
| logger.info("browser_enabled is false, setting env to api") | ||
| os.environ["DYNACONF_ADVANCED_FEATURES__MODE"] = "api" | ||
| settings.advanced_features.registry = False | ||
| settings.advanced_features.lite_mode = self.lite_mode | ||
| settings.advanced_features.lite_mode_tool_threshold = self.lite_mode_tool_threshold | ||
|
|
||
| if self.browser_enabled: | ||
| logger.info("browser_enabled is true, setting mode to hybrid") | ||
| settings.advanced_features.mode = "hybrid" | ||
| settings.advanced_features.use_vision = False | ||
| else: | ||
| logger.info("browser_enabled is false, setting mode to api") | ||
| settings.advanced_features.mode = "api" | ||
|
|
||
| from cuga.backend.activity_tracker.tracker import ActivityTracker | ||
| from cuga.backend.cuga_graph.nodes.api.variables_manager.manager import VariablesManager | ||
| from cuga.backend.cuga_graph.utils.agent_loop import StreamEvent | ||
| from cuga.backend.cuga_graph.utils.controller import ( | ||
| AgentRunner as CugaAgent, | ||
|
|
@@ -291,6 +298,16 @@ async def call_agent( | |
| from cuga.backend.llm.models import LLMManager | ||
| from cuga.configurations.instructions_manager import InstructionsManager | ||
|
|
||
| var_manager = VariablesManager() | ||
|
|
||
| # Reset var_manager if this is the first message in history | ||
| logger.info(f"[CUGA] Checking history_messages: count={len(history_messages) if history_messages else 0}") | ||
| if not history_messages or len(history_messages) == 0: | ||
| logger.info("[CUGA] First message in history detected, resetting var_manager") | ||
| var_manager.reset() | ||
| else: | ||
| logger.info(f"[CUGA] Continuing conversation with {len(history_messages)} previous messages") | ||
|
|
||
| llm_manager = LLMManager() | ||
| llm_manager.set_llm(llm) | ||
| instructions_manager = InstructionsManager() | ||
|
|
@@ -760,11 +777,13 @@ async def get_memory_data(self): | |
| list: List of Message objects representing the chat history | ||
| """ | ||
| logger.info("[CUGA] Retrieving chat history messages.") | ||
| logger.info(f"[CUGA] Session ID: {self.graph.session_id}") | ||
| messages = ( | ||
| await MemoryComponent(**self.get_base_args()) | ||
| .set(session_id=self.graph.session_id, order="Ascending", n_messages=self.n_messages) | ||
| .retrieve_messages() | ||
| ) | ||
| logger.info(f"[CUGA] Retrieved {len(messages)} messages from memory") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd move most of these types of logs to |
||
| return [ | ||
| message for message in messages if getattr(message, "id", None) != getattr(self.input_value, "id", None) | ||
| ] | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment claims to use Dynaconf's set() method, but code uses direct attribute assignment.
The comment states "Use Dynaconf's set() method to update settings dynamically" but the implementation uses direct attribute assignment (e.g.,
settings.advanced_features.registry = False). Either update the comment to reflect the actual implementation or switch to using Dynaconf'sset()method if that's the intended approach.If direct assignment is correct, apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents