Skip to content

LangChain Plugin: Agent

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(
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,
)

Returns a FloTorch agent (LangChain-compatible) with optional config sync.

Returns the active tool list (auto-syncing via ToolsProxy).


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 AgentExecutor
executor = 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