What is Langflow?
Langflow is a visual framework for building multi-agent and RAG applications. It’s a low-code app builder for RAG and multi-agent AI applications, providing a Python-based platform that allows users to create flows using a drag-and-drop interface or through code.Key Features of Langflow
- Visual Drag-and-Drop Interface: Langflow provides an intuitive visual interface where users can build complex AI workflows by simply dragging and dropping components. This eliminates the need for extensive coding and makes AI application development accessible to non-technical users and developers alike.
- Multi-Agent and RAG Support: Built-in support for Retrieval-Augmented Generation (RAG) and multi-agent architectures allows users to create sophisticated AI applications that can access external knowledge bases and coordinate multiple AI agents to solve complex tasks collaboratively.
- Code and No-Code Flexibility: Langflow offers both visual workflow creation and Python SDK integration, allowing users to switch between drag-and-drop interfaces and programmatic control. This flexibility enables both rapid prototyping and production-ready deployments with custom logic.
Prerequisites
Before integrating Langflow with TrueFoundry, ensure you have:- TrueFoundry Account: Create a Truefoundry account with atleast one model provider and generate a Personal Access Token by following the instructions in Generating Tokens. For a quick setup guide, see our Gateway Quick Start
- Langflow Installation: Install Langflow using either the Python package or Docker deployment
- Load Balance Configuration: Setup load balancing configuration for your desired models (see Setup Process section below)
Why Load Balancing Configuration is Necessary
Langflow works optimally with standard OpenAI model names (likegpt-4
, gpt-4o-mini
), but may experience compatibility issues with Truefoundry’s fully qualified model names (like openai-main/gpt-4
or azure-openai/gpt-4
).
When Langflow encounters these fully qualified model names directly, it may not function as expected due to internal processing differences.
The Solution: Load balancing configuration allows you to:
- Use standard model names in your Langflow configurations (e.g.,
gpt-4
) - Have Truefoundry Gateway automatically route the request to the fully qualified target model (e.g.,
openai-main/gpt-4
)
Setup Process
1. Generate Your TrueFoundry Access Token
Navigate to your TrueFoundry dashboard and generate a Personal Access Token:
2. Setup Load Balance Configuration
Create a load balancing configuration to route your requests to specific model providers:3. Configure Langflow Language Model Component
In your Langflow interface, configure the Language Model component with TrueFoundry Gateway settings:
- Model Provider: Select “OpenAI” from the dropdown
- Model Name: Use the standard model name from your load balancing configuration (e.g.,
gpt-4o-mini
) - OpenAI API Key: Enter your TrueFoundry Personal Access Token
- OpenAI API Base: Set to
https://{controlPlaneUrl}/api/llm/api/inference/openai


{controlPlaneUrl}
with your actual Truefoundry control plane URL.
4. Advanced Configuration in Agent Settings
For more advanced flows using agents, configure the agent component with TrueFoundry settings: Ensure the following settings are configured:- Model Name: Use the load-balanced model name (e.g.,
gpt-4
) - OpenAI API Base:
https://{controlPlaneUrl}/api/llm/api/inference/openai
- OpenAI API Key: Your TrueFoundry Personal Access Token
Usage Examples
Basic Chat Flow
Create a simple chat flow using the configured Language Model:
- Drag and drop a “Chat Input” component
- Connect it to your configured “OpenAI” Language Model component
- Connect the output to a “Chat Output” component
- Run the flow to test the integration
Multi-Agent RAG Application
For more complex applications involving RAG and multiple agents:Environment Variables Configuration
Alternatively, you can set environment variables for easier configuration across multiple flows:Understanding Load Balancing
When you use Langflow with standard model names likegpt-4
, your requests get load-balanced according to your configuration. In the example configuration above, any request to gpt-4
will be routed to openai-main/gpt-4
with 100% of the traffic.
You can create more sophisticated routing rules with multiple targets and different weights:
Benefits of Using TrueFoundry Gateway with Langflow
- Cost Tracking: Monitor and track costs across all your Langflow applications
- Security: Enhanced security with centralized API key management
- Access Controls: Implement fine-grained access controls for different teams
- Rate Limiting: Prevent API quota exhaustion with intelligent rate limiting
- Fallback Support: Automatic failover to alternative providers when needed
- Analytics: Detailed analytics and monitoring for all LLM calls