Skip to main content

Installation

pip install reminix-langchain
This installs langchain-core as a dependency. You’ll also need a model provider package like langchain-openai or langchain-anthropic.

Chat Agent

Use LangChainChatAgent for conversational agents with streaming support.
from langchain_openai import ChatOpenAI
from reminix_langchain import LangChainChatAgent
from reminix_runtime import serve

model = ChatOpenAI(model="gpt-4o")

chatbot = LangChainChatAgent(model, name="chatbot", instructions="You are a helpful assistant.")

serve(agents=[chatbot])

Using Tools

Use create_react_agent from langgraph.prebuilt to create an agent with tools, then pass it as the first argument.
from langchain_core.tools import tool
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
from reminix_langchain import LangChainChatAgent
from reminix_runtime import serve

@tool
def get_weather(city: str) -> str:
    """Get the current weather for a city."""
    weather_data = {
        "paris": "Sunny, 22°C",
        "london": "Cloudy, 15°C",
        "tokyo": "Rainy, 18°C",
    }
    return weather_data.get(city.lower(), f"Weather data not available for {city}")

llm = ChatOpenAI(model="gpt-4o")
graph = create_react_agent(llm, tools=[get_weather])

chatbot = LangChainChatAgent(graph, name="weather-assistant")

serve(agents=[chatbot])
You can also pass a compiled LangGraph state graph directly:
from langgraph.graph import StateGraph
from reminix_langchain import LangChainChatAgent
from reminix_runtime import serve

graph = StateGraph(...)
graph.add_node("agent", agent_node)
graph.add_edge("__start__", "agent")
compiled = graph.compile()

chatbot = LangChainChatAgent(compiled, name="chatbot", instructions="You are a helpful assistant.")

serve(agents=[chatbot])

Streaming

Chat agents support streaming out of the box:
from reminix import Reminix

client = Reminix()

stream = client.agents.chat(
    "chatbot",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)

for event in stream:
    if event.type == "text_delta":
        print(event.delta, end="", flush=True)

Task Agent

Use LangChainTaskAgent for structured output.
from langchain_openai import ChatOpenAI
from reminix_langchain import LangChainTaskAgent
from reminix_runtime import serve

model = ChatOpenAI(model="gpt-4o")

analyzer = LangChainTaskAgent(model, name="analyzer", instructions="Analyze the sentiment of the given text.")

serve(agents=[analyzer])

Thread Agent

Use LangChainThreadAgent for agents that manage full message history.
from langchain_openai import ChatOpenAI
from reminix_langchain import LangChainThreadAgent
from reminix_runtime import serve

model = ChatOpenAI(model="gpt-4o")

assistant = LangChainThreadAgent(model, name="assistant", instructions="You are a helpful assistant that remembers context.")

serve(agents=[assistant])
Thread agents return the complete message array, including the assistant’s response appended to the input messages.

Options

The first argument to all LangChain agent constructors is a Runnable — either a plain model or a compiled LangGraph CompiledStateGraph.
name
str
required
Agent name. Used as the endpoint identifier.
instructions
str
System prompt for the model.
description
str
Agent description for discovery and documentation.
tags
list[str]
Tags for filtering and organizing agents.
metadata
dict
Additional metadata attached to the agent.

Next steps

Deploying

Ship your LangChain agent to production.

Configuration & Secrets

Where to put model provider API keys.

OpenAI

A lighter-weight alternative without LangChain.

TypeScript: LangChain

The same integration in TypeScript.