FloTorch LangChain Plugin Overview
The FloTorch LangChain Plugin streamlines the development of LangChain agents by providing managed infrastructure and centralized configuration through the FloTorch Console. Instead of managing complex configurations in code, developers can leverage a powerful set of pre-configured services:
- Centralized Agent Management - Configure and manage agents through the FloTorch Console
- Managed LLM Access - Seamless integration with FloTorch Gateway for model inference
- Persistent Memory Services - Optional memory and session capabilities with provider setup
- Automated Tool Integration - Support for MCP tools and custom tool implementations
- Configurable Logging - Flexible logging configuration for debugging and monitoring (see SDK Logging Configuration)
Prerequisites
Section titled “Prerequisites”Before getting started with the FloTorch LangChain Plugin, ensure you have completed the following:
- FloTorch Account - Create an account at console.flotorch.cloud
- Agent Configuration - Set up your agent following the Gateway Agents documentation
- API Credentials - Generate your API key from API Keys settings
- Memory Provider (Optional) - Configure if using memory features, as detailed in the Memory documentation
Installation
Section titled “Installation”Install the FloTorch LangChain Plugin using pip:
pip install flotorch[langchain]Environment Configuration
Section titled “Environment Configuration”Configure your environment variables to avoid hardcoding credentials:
export FLOTORCH_API_KEY="your_api_key"export FLOTORCH_BASE_URL="https://gateway.flotorch.cloud"Optional Logging Configuration:
# Enable debug logging (optional)export FLOTORCH_LOG_DEBUG=trueexport FLOTORCH_LOG_PROVIDER="console" # or "file"export FLOTORCH_LOG_FILE="flotorch_logs.log" # if provider is "file" (default: "flotorch_logs.log")For comprehensive logging configuration details, see the SDK Logging Configuration guide.
Quick Start
Section titled “Quick Start”Basic Agent Setup
Section titled “Basic Agent Setup”from flotorch.langchain.agent import FlotorchLangChainAgentfrom langchain.agents import AgentExecutor
# Initialize the agent manager with your FloTorch Console configurationagent_manager = FlotorchLangChainAgent( agent_name="your-agent-name", # Must match the agent name in FloTorch Console custom_tools=[your_tool], # Optional: Add custom tools base_url="https://gateway.flotorch.cloud", api_key="your_api_key" # Note: Agent goal and system prompt should be configured # in the FloTorch Console when creating the agent)
# Get the configured agent and toolsagent = agent_manager.get_agent()tools = agent_manager.get_tools()
# Use with AgentExecutorexecutor = AgentExecutor( agent=agent, tools=tools, verbose=False)Agent Creation: FloTorch vs LangChain
Section titled “Agent Creation: FloTorch vs LangChain”The following comparison illustrates the simplified configuration approach offered by FloTorch LangChain:
Core Components
Section titled “Core Components”FlotorchLangChainAgent
Section titled “FlotorchLangChainAgent”The main entry point for loading agent configurations from the FloTorch Console. It provides fully configured, LangChain-compatible agents with minimal code setup.
FlotorchLangChainLLM
Section titled “FlotorchLangChainLLM”A LangChain-compatible LLM wrapper that integrates with FloTorch Gateway for model inference, providing seamless access to managed language models.
Memory Services
Section titled “Memory Services”- FlotorchLangChainMemory - Long-term persistent memory storage
- FlotorchLangChainSession - Short-term session memory for conversation context
FlotorchLangChainSession
Section titled “FlotorchLangChainSession”Manages persistent session storage through FloTorch Gateway, enabling conversation continuity across multiple interactions.
Next Steps
Section titled “Next Steps”Explore the detailed documentation for each component:
- Agent Configuration - Comprehensive agent setup and usage patterns
- LLM Configuration - Language model setup and customization
- Memory Integration - Implement persistent memory capabilities
- Session Management - Configure session persistence and state management
References
Section titled “References”- Official LangChain documentation: LangChain docs