LangChain Plugin: Agent
Overview
Section titled “Overview”FlotorchLangChainAgent
builds a LangChain agent from the FloTorch Console config, supports custom tools and optional memory signals in the prompt. It returns a LangChain agent (Runnable) suitable for use with AgentExecutor
.
from flotorch.langchain.agent import FlotorchLangChainAgent
API_KEY = "<your_api_key>"BASE_URL = "https://gateway.flotorch.cloud"AGENT_NAME = "<your_agent_name>" # agent name configured in console
FlotorchLangChainAgent
Section titled “FlotorchLangChainAgent”FlotorchLangChainAgent( agent_name: str, # agent name configured in console enable_memory: bool = False, custom_tools: list | None = None, base_url: str | None = None, api_key: str | None = None,)
get_agent() -> Runnable
Section titled “get_agent() -> Runnable”Returns a FloTorch agent (LangChain-compatible) with optional config sync.
get_tools() -> list
Section titled “get_tools() -> list”Returns the active tool list (auto-syncing via ToolsProxy).
Usage Example
Section titled “Usage Example”flotorch_client = FlotorchLangChainAgent( api_key=API_KEY, enable_memory=True, base_url=BASE_URL, agent_name=AGENT_NAME, custom_tools=tools,)
agent = flotorch_client.get_agent()all_tools = flotorch_client.get_tools()
from langchain.agents import AgentExecutorexecutor = AgentExecutor(agent=agent, tools=all_tools, memory=memory_services, verbose=False)
- When
enable_memory=True
, the prompt injects placeholders for session and long-term summaries - Tools include custom tools and MCP tools from Console config