Commit graph

6,796 commits

Author SHA1 Message Date
Jordan Frazier
115b0f535f
ref: make superuser creation more multi-user friendly (#9019)
* Fix superuser creationg race condition

* remove now unnecessary race condition check

* Add tests

* [autofix.ci] apply automated fixes

* ruff

* [autofix.ci] apply automated fixes

* clean up tests

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-23 18:45:03 +00:00
Lucas Oliveira
491af2ec77
fix: update text truncation limits to allow better visibility (#9147)
* Updated limits to triple

* removed update of items length
2025-07-23 13:41:44 +00:00
Lucas Oliveira
9e24202466
feat: adds authentication to mcp server under feature flag (#9095)
* init auth forms

* Add iam endpoint

* Add radix radio

* Add radio group UI element

* Add IAM endpoint to types

* Add auth modal

* Remove auth from tools component

* Add auth modal to mcp server tab

* Add placeholders to fields

* Add dynamic headers

* changed authentication name

* CHanged paddings

* Added header and button under feature flag

* [autofix.ci] apply automated fixes

* update api key form field

* add credential handling and fix feature flag

* Update autologin condition

* design update

* style updates

* ci details

* revert ci logs

* test update, ff name update, and username + pass -> basic

* restore ci

* default fix

* added iam endpoint

* add oauth

* remove secretstr

* updated backend test and schema

* updated test

* updated test user can update

* test fix

---------

Co-authored-by: Mike Fortman <michael.fortman@datastax.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-22 20:04:47 +00:00
Cristhian Zanforlin Lousa
c1d417adf2
fix: Improve duplicate flow name handling and add comprehensive tests (#8962)
*  (flows.py): Improve flow naming logic to handle duplicate names more effectively and accurately
📝 (test_rename_flow_to_save.py): Add unit tests to ensure correct numbering and handling of duplicate flow names

* [autofix.ci] apply automated fixes

*  (test_rename_flow_to_save.py): refactor test functions to remove unnecessary session parameter and improve code readability

* 📝 (flows.py): improve regex pattern to extract numbers only from flows following a specific naming convention to avoid extracting numbers from the original flow name if it contains parentheses

* [autofix.ci] apply automated fixes

* 📝 (flows.py): improve comments for better readability and understanding of regex usage in extracting numbers from flow names

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-22 17:45:15 +00:00
Rodrigo Nader
3bb22b29cc
feat: Add dual output support to Agent component with structured JSON parsing (#8836)
* feat: Add dual output support to Agent component with structured JSON parsing

## Summary
- Add "Structured Response" output alongside existing "Response" output
- Filter out conflicting json_mode field from OpenAI inputs
- Implement robust JSON parsing with fallback handling

## Changes Made
### Agent Component (agent.py)
- Add second output: "Structured Response" (Data type) with tool_mode=False
- Filter json_mode from OpenAI inputs to prevent UI conflicts
- Add json_response() method with multi-stage JSON parsing:
  - Direct JSON parsing for valid responses
  - Regex extraction for embedded JSON in text
  - Graceful error handling with diagnostic info
- Share execution between outputs (no duplicate agent runs)
- Fix model building to handle missing json_mode attribute

### Tests (test_agent_component.py)
- Add 9 comprehensive test cases covering:
  - Dual output structure validation
  - Input filtering verification
  - JSON parsing (valid, embedded, error cases)
  - Model building without json_mode
  - Shared execution efficiency
  - Frontend node structure
  - Component initialization

## Benefits
- Users get both Message and Data output types to choose from
- Clean UI without confusing duplicate JSON toggles
- Robust JSON parsing handles various response formats
- Efficient single-execution approach
- Maintains backward compatibility

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [autofix.ci] apply automated fixes

* update to templates with  model list update

* [autofix.ci] apply automated fixes

* Update test_agent_component.py

* update to the test and update to templates

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
2025-07-21 16:33:30 +00:00
Gabriel Luiz Freitas Almeida
ca595ac7fb
feat: add module and code hash to component's metadata (#8737)
* feat: filter out base components path in custom component loading

* revert changes to allow testing the function

* feat: add module_name parameter to custom component template functions

* feat: include full module name in component template creation

* feat: add module metadata to various starter project JSON files

* feat: add code hash generation for custom component templates

* test: add unit tests for code hash and module metadata functionality

* feat: add code hash to metadata in various starter project JSON files

* feat: refactor code hash generation to accept source code and class name

* feat: implement loading strategy for custom components in settings service

* Update metadata for various starter project JSON files to include code hashes and module references for ChatInput and ChatOutput components. This enhances traceability and consistency across the project configurations.

* refactor: improve _generate_code_hash function for better error handling and clarity

- Simplified the logic to generate a SHA256 hash of the source code.
- Added explicit error handling for empty source code, encoding issues, and type errors.
- Updated docstring to reflect changes in argument descriptions and added information about raised exceptions.

* test: add unit tests for metadata functionality in custom utils

- Introduced tests for the _generate_code_hash function, covering basic hash generation, error handling for empty and None source, hash consistency, and uniqueness for different code.
- Added tests to verify metadata addition in template building functions, ensuring that module names and code hashes are correctly included in the metadata of custom components.

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
2025-07-18 18:03:17 +00:00
Edwin Jose
e20ae03c38
ref: refactor MCP-related functionality centralizing common utilities (#9059)
* reactor to have common mcp codes in mcp_support

* [autofix.ci] apply automated fixes

* Refactor MCP API argument passing and function signatures

Updated function calls in mcp_projects.py to use explicit keyword arguments for clarity. Refactored mcp_support.py to use more concise query assignment and added keyword-only arguments to handle_call_tool and handle_list_tools for improved code readability and maintainability.

* Rename mcp_support.py to mcp_utils.py and update imports

Renamed mcp_support.py to mcp_utils.py for clarity and updated all relevant import statements in mcp.py and mcp_projects.py to reflect the new module name.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-17 19:21:04 +00:00
Gabriel Luiz Freitas Almeida
f1e95940a5
feat(database): add noop mode with config flag and update related tests (#9054)
* test: enhance agent component tests and add new fixture for database-less sessions

- Added `use_noop_session` fixture to facilitate testing without a database.
- Expanded `TestAgentComponent` with new tests for agent responses using the Calculator tool and validation across all OpenAI and Anthropic models.
- Updated `test_component.py` to include tests for message sending without a database, ensuring proper event handling and message integrity.
- Refactored existing tests for clarity and consistency.

* fix: enhance user retrieval logic in get_or_create_super_user and teardown_superuser functions

- Updated user retrieval in both functions to handle different result types from the database query, ensuring robustness against unexpected return values.
- Added checks for `first()` method and list type to improve error handling and maintainability.

* feat: add support for no-op database operations in settings

- Introduced `use_noop_database` configuration option to disable all database operations, controlled by the `LANGFLOW_USE_NOOP_DATABASE` environment variable.
- Updated the `use_noop_session` fixture to reflect the new environment variable for testing without a database.

* feat: implement NoopSession for database-less operations

- Added NoopSession class to provide a no-operation database session, allowing for testing and operation without a real database connection.
- Updated DatabaseService to utilize NoopSession when the `use_noop_database` setting is enabled, ensuring all database operations are disabled in this mode.
- Enhanced error handling and logging for session management, improving robustness in scenarios where the database is not in use.

* refactor: update import paths for NoopSession in test files

- Changed import path for NoopSession from `langflow.services.database.service` to `langflow.services.database.session` in both `test_agent_component.py` and `test_component.py`.
- This refactor improves code organization and aligns with recent changes in the project structure.

* feat: enhance NoopSession with result handling methods

- Added an internal _NoopResult class to the NoopSession, providing methods `first()`, `all()`, and `one_or_none()` for better handling of no-operation results.
- This enhancement improves the usability of NoopSession in testing scenarios by mimicking expected database query behaviors.

* refactor: improve logging for NOOP database session

- Changed the log level from warning to info for the NOOP database session message in the DatabaseService class.
- This adjustment enhances clarity in logging, indicating that all DB operations are disabled without implying an error condition.

* docs: improve docstring formatting for custom_component_update function

- Reformatted the docstring for the custom_component_update function to enhance readability by breaking long lines into multiple lines.
- This change improves documentation clarity, making it easier for developers to understand the function's purpose and behavior.

* docs: add LANGFLOW_USE_NOOP_DATABASE environment variable documentation

- Introduced documentation for the new LANGFLOW_USE_NOOP_DATABASE environment variable, which allows users to enable a no-op database mode, avoiding database connections and operations.
- This addition enhances the clarity of configuration options available for Langflow, aiding users in understanding how to run flows without a database.

* refactor: move NOOP database session logging to settings

- Removed the logging statement from the DatabaseService class and added it to the `set_use_noop_database` field validator in the Settings class.
- This change centralizes the logging for the NOOP database session, improving code organization and ensuring that the message is logged whenever the setting is applied.
2025-07-15 16:52:23 +00:00
Gabriel Luiz Freitas Almeida
b17871bf44
refactor(api): update /config endpoint to use ConfigResponse.from_settings (#8674)
* refactor: update config response handling and import structure

- Moved EventManager import to the correct module path.
- Refactored get_config endpoint to utilize ConfigResponse.from_settings for improved clarity and maintainability.
- Updated ConfigResponse to include a class method for instantiating from Settings, enhancing the encapsulation of configuration logic.

* 📝 Add docstrings to `improve-docs-and-configsetup` (#8677)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-14 17:23:37 +00:00
Jordan Frazier
7a02842730
bug: fix check for server ready when using 0.0.0.0 as host (#9002)
* Fix check for server ready when using 0.0.0.0 as host

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* fix: add noqa comment to health check host assignment for clarity

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-11 13:08:50 +00:00
Sebastián Estévez
6fd461cd97
bug: re-add NVIDIA Remix starter template (#8994)
feat: add NVIDIA Remix starter template

Introduced a new JSON configuration file for the NVIDIA Remix starter project, defining nodes and edges for chat input, output, and agent interactions. This setup enhances the integration of the NVIDIA RTX Remix Toolkit REST API, providing a structured approach for building chat-based applications.

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-10 18:44:15 +00:00
Gabriel Luiz Freitas Almeida
70f18bcb89
feat: add utility to insert code field into build config dictionary (#8933)
feat: add code field to build configuration in custom component update if it was removed

- Introduced `add_code_field_to_build_config` utility function to enhance build configuration with a code field.
- Updated `custom_component_update` to conditionally add the code field if it is not already present, improving component customization capabilities.

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
2025-07-10 18:35:00 +00:00
Lucas Oliveira
87795931f0
fix: improved better health check and stream URL check on MCP, improved JSON recognition (#8982)
* Improved health check and stream URL check on MCP

* Improved health check by validating session connectivity

* Changed mcp servers from json checks

* Fixed imports

* Fixed mcp server tab test
2025-07-10 16:56:02 +00:00
Mendon Kissling
955127469c
templates: Update Vector Store RAG.json (#8977)
Update Vector Store RAG.json

Co-authored-by: Eric Hare <ericrhare@gmail.com>
2025-07-10 15:44:44 +00:00
Gabriel Luiz Freitas Almeida
8033f2c9d3
refactor: update imports and move functions out of MCPToolsComponent (#8976) 2025-07-10 10:53:56 -03:00
Gabriel Luiz Freitas Almeida
d325fca054
refactor: update cache service type hints in MCPToolsComponent (#8975) 2025-07-10 08:52:25 -03:00
Lucas Oliveira
2fec8437b8
fix: make files be saved in unique path (#8965)
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-10 08:42:03 -03:00
Lucas Oliveira
85a1068c03
fix: make mcp server component handle cache miss gracefully (#8966)
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-10 08:24:10 -03:00
Eric Hare
8f315a29bc
fix: Update file component description for accuracy (#8960)
* fix: Update file component description for accuracy

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-09 23:34:53 +00:00
Rodrigo Nader
a0e484c0eb
feat: add DataFrame output to Structured Output component (#8842)
* feat: add DataFrame output to Structured Output component

- Add new DataFrame output alongside existing Data output for structured data
- Single output: creates DataFrame with one row
- Multiple outputs: creates DataFrame with multiple rows, each containing a Data object
- Maintains backward compatibility with existing Data output
- Includes comprehensive test coverage for both single and multiple output scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* [autofix.ci] apply automated fixes

* Update structured_output.py

* [autofix.ci] apply automated fixes

* udpate to tests

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* update to format instructions

* Update system prompt in structured output component test

Expanded the system prompt in the test for StructuredOutputComponent to provide more detailed extraction instructions, including handling of missing values, duplicates, and output format requirements. This improves test clarity and better simulates real-world extraction scenarios.

* [autofix.ci] apply automated fixes

* Update structured_output.py

* fix: return empty Data object instead of None in StructuredOutputComponent

Updated the return statement in the StructuredOutputComponent to return an empty Data object when there are no outputs, improving consistency in the output handling.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-09 21:57:07 +00:00
Rodrigo Nader
e0400f29eb
feat: enhance DataFrame Operations component with contains filter and modern UI (#8838)
* feat: enhance DataFrame Operations component with contains filter and modern UI

- Add "contains" filter operator for partial string matching in DataFrame filters
- Update UI to use SortableListInput with icons for consistent modern design
- Add 7 filter operators: equals, not equals, contains, starts with, ends with, greater than, less than
- Fix deselection handling to prevent "unhashable type: list" errors
- Improve dynamic field visibility when operations are deselected
- Add comprehensive test suite with 25 tests covering all operations and edge cases
- Update placeholder text from "Select DataFrame Operation" to "Select Operation"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [autofix.ci] apply automated fixes

* Update dataframe_operations.py

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
2025-07-09 21:50:59 +00:00
Harsha Vardhan Khurdula
8c72ea087c
feat: jigsawstack bundle integration (#8832)
* fix: formatting errors.

* fix: formmating errors for jigsawstack components.

* fix: bugs identified by coderabbitai.

* fix: formatting issues on JigsawStack icon gradient.

* fix: project starters.

* fix: value errors.

* fix: app startup

* fix: resolve merge conflicts, accept incoming changes.

* fix:  follow lexicographical order for bundle names.

Co-authored-by: Edwin Jose <edwinjose900@gmail.com>

* feat: add JigsawStack bundle to the sidebar, following lexographical order.

* fix: remove duplicate changes, by rebasing to main/src/.../styleUtils.ts

* fix: apply suggested fixes for potential issues identified from coderabbitai.

---------

Co-authored-by: Edwin Jose <edwinjose900@gmail.com>
2025-07-09 19:53:12 +00:00
Gabriel Luiz Freitas Almeida
e13a3ca800
fix: Ensure flow_id is not None before logging vertex build details (#8954)
* fix: Update log_vertex_build to accept UUID for flow_id and improve error handling

* Changed flow_id type from str to str | UUID for better type safety.
* Added error handling to raise a ValueError if flow_id is invalid, enhancing robustness of the logging function.

* fix: Ensure flow_id is not None before logging vertex build details

* Updated log_vertex_build call to check if flow_id is not None, enhancing robustness and preventing potential errors when flow_id is absent.
2025-07-09 19:17:50 +00:00
Gabriel Luiz Freitas Almeida
be25e88a97
chore: update package versions to include post-release tags (#8955)
* Bump langflow version to 1.5.0.post1 in pyproject.toml and uv.lock.
* Update langflow-base version to 0.5.0.post1 in related files for consistency.
2025-07-09 17:57:03 +00:00
Gabriel Luiz Freitas Almeida
d437d018ce
refactor(auth): simplify flow retrieval by removing settings_service dependency (#8956)
* refactor: Simplify flow reading logic by removing unnecessary settings service dependency

* 🛠️ (flows.py): Remove settings_service parameter from _read_flow and related functions to streamline flow retrieval logic.
* 🔧 (flows.py): Adjust query to directly filter by user_id, enhancing clarity and reducing complexity.

* test: Enhance flow retrieval tests with user isolation checks

* 🧪 (test_flows.py): Remove hardcoded user_id from flow creation tests to ensure user-specific data handling.
*  (test_flows.py): Add a new test to verify that users can only access their own flows, ensuring proper user isolation in flow retrieval.
* 🔧 (test_flows.py): Implement user creation and cleanup logic to maintain test integrity and avoid side effects.
2025-07-09 17:53:34 +00:00
Lucas Oliveira
1362aa1172
fix: make deletion of single file commit to DB, create tests for file deletion (#8953)
* Added commit to db session

* Changed order

* Deleted flush

* Added test to files
2025-07-09 15:17:54 +00:00
Gabriel Luiz Freitas Almeida
24db0cdc73 fix: remove crewai dependency and add import guards in crewai components (#8923) 2025-07-08 09:59:46 -03:00
Jordan Frazier
be18f6d03a feat: add new openai reasoning models (#8786)
* Add new openai reasoning models

* [autofix.ci] apply automated fixes

* Updates language model, but FE doesn't send a POST for updating template atm

* use chatopenai constants

* [autofix.ci] apply automated fixes

* Add reasoning to language model test

* Remove temp from all reasoning models

* t [autofix.ci] apply automated fixes

* refactor: Update template notes (#8816)

* update templates

* small-changes

* template cleanup

---------

Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>

* ruff

* uv lock

* starter projects update

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Mike Fortman <michael.fortman@datastax.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
2025-07-08 09:59:46 -03:00
Jordan Frazier
15f2177c90 fix: handle EventLoopBlockError in CI to fix non-deterministic test failures (#8890)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
fix: fixes auth check for auto_login  (#8796)
2025-07-08 09:59:46 -03:00
Jordan Frazier
969afef523 ref: improve docling template updates and error message (#8837)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-08 09:59:46 -03:00
Jordan Frazier
fe58d69ae7 fix: fixes auth check for auto_login (#8796) 2025-07-08 09:59:46 -03:00
Gabriel Luiz Freitas Almeida
69ceaea739 chore: Bump version to 1.5.0 and update dependencies
- Updated langflow version to 1.5.0 in pyproject.toml, package.json, and package-lock.json.
- Updated langflow-base dependency to version 0.5.0.
- Added platform markers for several dependencies in uv.lock to improve compatibility across different systems.
2025-07-08 09:59:46 -03:00
Gabriel Luiz Freitas Almeida
7aeb687533
fix: don't send duplicate messages to Agent (#8909)
* fix: update message input handling in LCAgentComponent and improve memory data retrieval

* Refactor MessageTextInput to MessageInput for consistency.
* Enhance input dictionary construction to handle different input types in LCAgentComponent.
* Update get_memory_data method to filter out current input value from retrieved messages.

* fix: update AgentComponent to include documentation link and improve input handling

* Added documentation link for AgentComponent.
* Removed memory inputs from the agent component for cleaner input management.
* Enhanced error handling in message_response method to ensure better validation and logging of exceptions.

* fix: enhance input handling in LCAgentComponent by updating message conversion

* Updated input dictionary construction in LCAgentComponent to use to_lc_message() for Message instances, improving input handling consistency.

* test: add regression test for message duplication in agent component

* Introduced a new test to verify that mathematical expressions do not experience message duplication when processed by the agent component.
* The test checks both input and output JSON to ensure correct handling of expressions like "2+2" without duplication errors.

* test: add workspace tag to regression test for message duplication in agent component

* Updated the regression test for mathematical expressions to include the "@workspace" tag, enhancing test categorization and organization.
* This change ensures better tracking and management of tests related to the agent component.

* fix: add temporary comment in get_memory_data to address message duplication

* Added a TODO comment in the get_memory_data method of AgentComponent to indicate a temporary fix for message duplication issues. This serves as a reminder to develop a more robust solution in the future.

* feat: add message extraction utility for BaseMessage

* Introduced a new helper function, _get_message_from_base_message, to extract and concatenate text content from BaseMessage instances, improving message handling.
* Updated input handling in handle_on_chain_start to utilize the new extraction function, ensuring consistent processing of input messages.

* refactor: standardize code snippets across starter project JSON files

* Updated the "value" field in multiple starter project JSON files to ensure consistent formatting and structure of code snippets.
* This change enhances readability and maintainability of the code examples provided in the starter projects.

* feat: add caching and content dictionary creation for images

* Introduced a new function, create_image_content_dict, to generate a content dictionary for multimodal inputs from image files, enhancing image handling capabilities.
* Implemented LRU caching to optimize performance for repeated image processing.
* Added comprehensive error handling and documentation for better usability and maintainability.

* refactor: update message handling to utilize create_image_content_dict

* Replaced direct image URL creation with create_image_content_dict for improved image content handling in the Data and Message classes.
* Adjusted the order of content in human messages to ensure text appears first, enhancing message structure and clarity.
* Removed deprecated to_lc_message method to streamline the codebase and improve maintainability.

* docs: enhance _get_message_from_base_message docstring for clarity

* Expanded the docstring for the _get_message_from_base_message function to provide detailed information on input types, expected behavior, and examples of usage.
* Improved documentation aims to enhance usability and maintainability of the code by clarifying how to extract text content from BaseMessage instances.

* refactor: enhance image path handling and update message content structure

* Modified the get_file_paths function to support both Image objects and string paths for improved flexibility in file handling.
* Updated test cases to reflect changes in image content structure, ensuring consistency in type and source type attributes.
* Introduced new tests for create_image_content_dict to validate successful creation and error handling for image content dictionaries.

* refactor: streamline message extraction in handle_on_chain_start

* Removed the _get_message_from_base_message function to simplify the codebase.
* Updated handle_on_chain_start to directly use the text method of BaseMessage for extracting message content, enhancing clarity and maintainability.

* feat: enhance input handling for multimodal messages

* Added functionality to process image content within input messages, ensuring images are included in chat history as HumanMessage instances.
* Updated input handling logic to separate image types from text, improving the structure and clarity of message content.
* This enhancement supports better management of multimodal inputs in the agent's chat history.

* feat: add to_lc_message method for converting Data to BaseMessage

* Introduced the to_lc_message method in the Message class to facilitate conversion of Data instances to BaseMessage.
* Implemented logic to handle both HumanMessage and AIMessage based on the presence of required keys and sender type.
* Added logging for missing required keys to improve debugging and maintainability.

* refactor: simplify sender check in Message class

* Updated the sender validation logic in the Message class to remove unnecessary checks for missing sender values.
* This change enhances code clarity and maintains the intended functionality for handling user messages with associated files.

* test: update test_message_from_human_text to reflect content type change

* Modified the test for message conversion to assert that lc_message.content is a string instead of a list.
* Updated assertions to ensure the content matches the expected text, enhancing test accuracy and reliability.

* fix: update sender validation in Message class and adjust test case

* Modified the sender validation logic to handle cases where the sender is not specified, defaulting to HumanMessage.
* Updated the corresponding test case to reflect this change, ensuring accurate type assertion for lc_message when no sender is provided.

* refactor: update import statements for consistency and clarity

* Replaced the import of BaseModel from langchain.pydantic_v1 with the direct import from pydantic to streamline dependencies.
* This change enhances code clarity and aligns with best practices for managing imports in the codebase.

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: Carlos Coelho <80289056+carlosrcoelho@users.noreply.github.com>
2025-07-08 01:36:39 +00:00
Gabriel Luiz Freitas Almeida
fd92d16553
fix: prevent message duplication in ProjectMCPServer and handle_call_tool (#8918)
* Updated the message processing logic in both ProjectMCPServer and handle_call_tool to ensure that duplicate messages are not added to the collected results.
* Introduced a helper function to manage the addition of results, enhancing code clarity and maintainability.

Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
2025-07-07 20:47:21 +00:00
Sebastián Estévez
6c8764c36a
fix: health check for mcp server (#8908)
* fix health check for mcp server

* [autofix.ci] apply automated fixes

---------

Co-authored-by: phact <estevez.sebastian@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-07 18:56:26 +00:00
Mendon Kissling
746a3b6264
docs: add agent docs link from component (#8900)
* agent-docs-link

* bundle
2025-07-07 16:16:40 +00:00
Rodrigo Nader
90d9ab2f64
fix: resolve circular import in Component class (#8839)
* fix: resolve circular import in Component class

Move graph-related imports inside methods to break circular dependency chain:
- Move create_state_model import inside _build_state_model method
- Move has_chat_output import inside is_connected_to_chat_output method

This enables component testing without circular import errors that were
preventing execution of component test suites.

Fixes circular import chain:
Component -> graph.state.model -> graph.vertex -> Component

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-07 16:01:28 +00:00
Gabriel Luiz Freitas Almeida
7ec3cb063d
chore(deps): update pyleak version and activate pyleak_marker in tests (#8905)
* chore: update pyleak dependency to version 0.1.14 in pyproject.toml and uv.lock

* fix(tests): enable pyleak marker in test files to address memory leak issues
2025-07-07 15:23:25 +00:00
Edwin Jose
b6e3df6b89
fix: updates Youtube Analysis template error message (#8906)
* Update Youtube Analysis.json

* fix: removed the if else

* Update Youtube Analysis.json

* Update Youtube Analysis.json

* Update src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json

Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>

---------

Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
2025-07-07 15:18:50 +00:00
Jordan Frazier
64855b2f49
fix: langwatch component initialization and some QoL (#8885)
* Fix langwatch component initialization and some QoL

* [autofix.ci] apply automated fixes

* Fix ruff and add unit tests

* [autofix.ci] apply automated fixes

* feat(langwatch): add utility for caching evaluators and refactor component to use it

* test(langwatch): add initial test file for LangWatchComponent and mock evaluator method

* fix(langwatch): use getattr for safer access to current_evaluator attribute

* test(langwatch): update cache clearing method to use utility function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-07 13:42:33 +00:00
Jordan Frazier
56ff3e12f6
fix: add launcher script to wrap langflow startup (#8884)
* Add launcher script to wrap langflow startup

* [autofix.ci] apply automated fixes

* Ruff

* [autofix.ci] apply automated fixes

* ruff

* [autofix.ci] apply automated fixes

* rut pusff

* [autofix.ci] apply automated fixes

* use exec instead of subprocess

* [autofix.ci] apply automated fixes

* Remove forced run addition to cli

* Integrate Typer for improved error handling in langflow launcher

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-07-07 13:28:54 +00:00
Edwin Jose
a88829a9d6
feat(api): add special handling for _mcp_servers file uploads and improve tests (#8847)
* update

* [autofix.ci] apply automated fixes

* refactor: update file query logic and enhance error logging in file deletion

* refactor: enhance error handling and improve code clarity in MCP server list retrieval

* refactor: improve type hinting and code clarity in MCP servers file tests

* fix: handle potential None value for server configuration file in async server list retrieval

* Update test_files.py

* fix: autofix.ci / Update Starter Projects (pull_request)

* chore: Add API key environment variables to CI workflows

* Updated .github/workflows/ci.yml and .github/workflows/python_test.yml to include OPENAI_API_KEY, ANTHROPIC_API_KEY, and other relevant API keys as environment variables for CI jobs.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Carlos Coelho <80289056+carlosrcoelho@users.noreply.github.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2025-07-04 16:20:04 +00:00
Cristhian Zanforlin Lousa
557f7b31aa
feat: Add image upload support with file path handling (#8830)
*  (data.py): introduce a new function get_file_paths to resolve file paths before creating image URLs in HumanMessage contents

*  (general-bugs-agent-images-playground.spec.ts): add test case for user to send images in the playground with the agent component

* 📝 (general-bugs-agent-images-playground.spec.ts): update file path to image file to fix test failure due to incorrect file path

* [autofix.ci] apply automated fixes

* fix: autofix.ci / Update Starter Projects (pull_request)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2025-07-04 13:54:22 +00:00
Mendon Kissling
dd55acb7f3
docs: link components to docs pages (#8850)
* docs-links

* Update url.py

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
2025-07-03 21:08:13 +00:00
Lucas Oliveira
1fdeefda1b
fix: enable tool mode only if a server is selected (#8865)
* Enable tool mode only if a server is selected

* Set tool mode as false when mcp server is cleared

* Added bool to build config tool show
2025-07-03 18:34:51 +00:00
Deon Sanchez
b1ae5e4159
refactor: reuse single session when getting variables from db (#8814)
* refactor: enhance database session management in custom components

- Updated `get_variables` method in `CustomComponent` to accept an optional session parameter, allowing for session reuse and reducing connection pool exhaustion.
- Modified `update_params_with_load_from_db_fields` to pass the session when calling `get_variables`.
- Adjusted `get_instance_results` to support session management for database operations.
- Increased connection pool size and max overflow in settings for improved performance under load.

* [autofix.ci] apply automated fixes

* Prefer single session by default:

* remove unused session

* Revert pool size changes

* refactor: update get_variables method for backward compatibility

- Added a new async `get_variables` method in `CustomComponent` to maintain backward compatibility with the deprecated method, ensuring it calls the existing `get_variable` method with session management.
- This change enhances the robustness of the component while preserving existing functionality.

* refactor: remove unused session import from endpoints.py

- Eliminated the unused `session_scope` import from the `endpoints.py` file to streamline the code and improve clarity. This change contributes to maintaining a clean and efficient codebase.

* refactor: update deprecated variables method in CustomComponent

- Modified the `variables` method to call the new `get_variables` method for improved clarity and consistency. This change maintains backward compatibility while encouraging the use of the updated async method.

* refactor: update method calls to use get_variables because we don't have session in update_build_config

- Replaced instances of the deprecated `get_variable` method with the new `get_variables` method in `LMStudioEmbeddingsComponent`, `LMStudioModelComponent`, and `ChatOllamaComponent`. This change enhances code clarity and maintains consistency across components while ensuring backward compatibility.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jordan Frazier <jordan.frazier@datastax.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Carlos Coelho <80289056+carlosrcoelho@users.noreply.github.com>
2025-07-03 14:55:55 +00:00
Gabriel Luiz Freitas Almeida
6403a8f564
fix(graph): fixes bug that caused simple flows with Loop to fail (#8809)
* fix: improve predecessors check for loop component

- Enhanced the handling of cycle vertices to prevent infinite loops by ensuring that a vertex can only run if all pending predecessors have completed.
- Updated conditions for the first execution of cycle vertices to allow running only if all pending predecessors are also cycle vertices.
- This refactor improves the robustness of the vertex management system in asynchronous workflows.

* fix: update _mark_branch method to return visited vertices and refine predecessor mapping

* fix: prevent duplicate item dependencies in LoopComponent

* feat: add loop connection handling in Component class

- Introduced methods to process loop feedback connections, allowing components to connect outputs to loop-enabled inputs.
- Implemented checks to validate loop connections and ensure proper handling of callable methods from other components.
- Enhanced the edge creation logic to support special loop feedback edges targeting outputs instead of inputs.

* fix: enhance name overlap validation in FrontendNode

- Updated the validate_name_overlap method to exclude outputs that allow loops from the overlap check.
- Improved error message to include the display name of the component, along with detailed lists of input and output names for better debugging.

* fix: correct condition for executing cycle vertices in RunnableVerticesManager

- Updated the logic to ensure that a cycle vertex can only execute if it is a loop and all pending predecessors are cycle vertices. This change enhances the robustness of the vertex management system in asynchronous workflows.

* feat: implement comprehensive loop flow for URL processing

- Added a new loop flow that processes multiple URLs through a series of components including URLComponent, SplitTextComponent, LoopComponent, ParserComponent, PromptComponent, OpenAIModelComponent, StructuredOutputComponent, and ChatOutput.
- Enhanced the StructuredOutputComponent to include a detailed system prompt and refined output schema to ensure proper JSON formatting.
- Introduced a test case to validate the creation and execution of the loop flow, ensuring all components are correctly integrated and the expected execution order is maintained.

* refactor: enhance loop target handling in Component and Edge classes

- Introduced LoopTargetHandleDict to better manage loop target structures in the Component and Edge classes.
- Updated the Component class to utilize type casting for loop target handles, improving type safety.
- Refactored the Edge class to accommodate the new loop target handling, ensuring compatibility with existing edge structures.
- Removed deprecated message handling methods from the Component class to streamline the codebase and improve maintainability.

* test: skip OpenAI model integration test if API key is not set

- Added a conditional skip to the test_build_model_integration_reasoning method to prevent execution when the OPENAI_API_KEY environment variable is not set, ensuring tests run only in appropriate environments.

* [autofix.ci] apply automated fixes

* chore: add required secrets for OpenAI and Anthropic APIs in CI workflows

* Updated ci.yml to include OPENAI_API_KEY and ANTHROPIC_API_KEY secrets.
* Modified python_test.yml to mark these secrets as required for workflow execution.

* fix: update OPENAI_API_KEY check in test_loop.py to handle dummy values

* Modified the condition in the pytest skipif decorator to also skip tests when OPENAI_API_KEY is set to "dummy", ensuring more robust test execution.

* refactor: streamline component setup in test_loop.py

* Removed redundant comments and improved formatting for component initialization in the loop_flow function.
* Added missing system_prompt to StructuredOutputComponent to resolve "Multiple structured outputs" error.
* Updated test_loop_flow to ensure it tests the graph creation with proper loop feedback connection.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-03 14:39:09 +00:00
Ítalo Johnny
2f3600a64e
fix: metadata serialization in AstraDB vector store (#8855)
* fix(astradb): serialize metadata in documents

* chore: update starter projects

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Hare <ericrhare@gmail.com>
2025-07-03 14:20:50 +00:00
Yuqi Tang
19c9514d54
feat: update if-else component (#8756)
* add ifelse component

* [autofix.ci] apply automated fixes

* fix test

* fix test

* fix test

* fix tests

* [autofix.ci] apply automated fixes

* fix tests

* fix test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Lucas Democh <democh@datax.dev>
2025-07-02 22:56:57 +00:00
Edwin Jose
e28093234b
ref: sidebar experience improvement with new bundles (#8824)
* cohere sidebar

* side bar embeddings

* move memories

* sort style utils

* [autofix.ci] apply automated fixes

* serach components add

* Update __init__.py

* Update styleUtils.ts

* [autofix.ci] apply automated fixes

* Update model_input_constants.py

* fix lint

* update to wikipedia

*  (tableInputComponent.spec.ts): Refactor test to use for loops for better readability and efficiency
 (filterEdge-shard-1.spec.ts): Update model names for better clarity and consistency
🐛 (duckduckgo.spec.ts): Update selector for search button to match changes in the frontend
🐛 (generalBugs-shard-11.spec.ts): Update selector for search button to match changes in the frontend

* [autofix.ci] apply automated fixes

* update tests path

* update tests

* Update test_arxiv_component.py

* [autofix.ci] apply automated fixes

* make embeddings functions

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2025-07-02 20:11:59 +00:00