LangChain / LangGraph adapter, TuiML tools as StructuredTool objects.
LangGraph consumes LangChain tools directly (
ToolNode(tools=[...])), so this module covers both frameworks.
python
>>> from tuiml.agent.adapters.langchain import get_tools, system_prompt
>>> from langgraph.prebuilt import create_react_agent
>>> from langchain_anthropic import ChatAnthropic
>>>
>>> agent = create_react_agent(
... model=ChatAnthropic(model="claude-sonnet-4-6"),
... tools=get_tools(),
... prompt=system_prompt(),
... )
>>> agent.invoke({"messages": [("user", "Train a random forest on iris")]})
Functions
get_tools() -> List[Any]
Return every TuiML workflow tool wrapped in a LangChain StructuredTool.
Returns
list of langchain_core.tools.StructuredTool
One StructuredTool per workflow tool, each with a Pydantic args schema and a function that routes to the TuiML executor. Pass directly to LangChain agents or LangGraph
ToolNode(tools=[...]).
Raises
ImportError
If
langchain_core is not installed.
python
>>> from tuiml.agent.adapters.langchain import get_tools
>>> tools = get_tools()
>>> [t.name for t in tools][:2] # doctest: +SKIP
['tuiml_train', 'tuiml_predict']