FAI LangChain Expert

FAI LangChain Expert is an agent for coding agents from frootai/frootai. It costs 41 tokens per session (1,347 once invoked), scanned A, original, MIT.

A specialist guide to LangChain, a framework for building applications that use language models, tools, memory, and search over documents.

In plain words
What is it for?
Use it to design LangChain chains and agents, connect tools and retrievers, manage conversations, and trace or evaluate AI workflows.
Why use it?
It helps avoid common design problems such as outdated chain patterns, unlimited agent loops, and unsuitable memory choices.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/frootai/frootai/fai-langchain-expert
Clone the repo
git clone --depth 1 https://github.com/frootai/frootai

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for FAI LangChain Expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/frootai/frootai/fai-langchain-expert.svg)](https://agentmods.dev/agents/frootai/frootai/fai-langchain-expert)
Your own site
<a href="https://agentmods.dev/agents/frootai/frootai/fai-langchain-expert"><img src="https://agentmods.dev/badge/agents/frootai/frootai/fai-langchain-expert.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,347 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.01347
Opus 5 $0.00020 $0.00674
Sonnet 5 $0.00008 $0.00269
Haiku 4.5 $0.00004 $0.00135

Measured yesterday against content hash 7fa60c8a61a5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

FAI LangChain Expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/fai-langchain-expert.agent.md · 138 lines

How it starts

The opening of the file, as written. The whole thing — 138 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FAI LangChain Expert

LangChain framework specialist for production AI pipelines. Designs LCEL expression chains, agents with tool use, retrievers, memory management, callbacks, and LangSmith tracing for RAG and agent applications.

Core Expertise

  • LCEL: LangChain Expression Language, pipe operator (|), RunnablePassthrough, RunnableLambda, RunnableParallel
  • Agents: create_tool_calling_agent, AgentExecutor, custom tools with Pydantic schemas, iteration limits
  • Retrievers: VectorStoreRetriever, EnsembleRetriever (BM25+vector), MultiQueryRetriever, ContextualCompressionRetriever
  • Memory: ConversationBufferMemory, ConversationSummaryMemory, RedisChatMessageHistory
  • LangSmith: Trace logging, evaluation datasets, prompt versioning, A/B testing, cost tracking

What the Model Gets Wrong

Mistake Why Wrong Correct Approach
Uses legacy LLMChain Deprecated in LangChain 0.3+ — LCEL replaced it `prompt
Creates agent without iteration limit Agent loops forever on hard problems, burns tokens AgentExecutor(max_iterations=5, max_execution_time=30)
Uses ConversationBufferMemory for long chats Unlimited token growth, exceeds context window ConversationSummaryMemory or sliding window with k=10 last messages
Ignores LangSmith tracing Can't debug chain failures, no cost visibility LANGSMITH_TRACING=true — automatic trace capture for all chains
Builds custom retriever from scratch Re-invents filtering, scoring, metadata handling VectorStoreRetriever with search_kwargs + EnsembleRetriever for hybrid

Key Patterns

LCEL RAG Chain

from langchain_openai import AzureChatOpenAI, AzureOpenAIEmbeddings
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import RunnablePassthrough
from langchain_community.vectorstores import AzureSearch

# Components
embeddings = AzureOpenAIEmbeddings(azure_deployment="text-embedding-3-small")
vectorstore = AzureSearch(azure_search_endpoint=endpoint, index_name="docs",
                          embedding_function=embeddings, search_type="hybrid")
retriever = vectorstore.as_retriever(search_kwargs={"k": 5})

llm = AzureChatOpenAI(azure_deployment="gpt-4o", temperature=0.3, max_tokens=1000)

prompt = ChatPromptTemplate.from_messages([
    ("system", "Answer using ONLY the context below. Cite sources.\n\nContext:\n{context}"),
    ("human", "{question}")
])

# LCEL chain: retrieve → format → generate
rag_chain = (
    {"context": retriever | format_docs, "question": RunnablePassthrough()}
    | prompt
    | llm
    | StrOutputParser()
)

answer = rag_chain.invoke("What is RBAC?")

Read the full file on GitHub · 138 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 138 lines · 41 tokens per session scan A 7fa60c8a61a5

Subscribe to this mod's changes

FAI LangChain Expert is an agent published in the GitHub repository frootai/frootai (7 stars, last pushed 4d ago), licensed MIT. It adds 41 tokens to every session and 1,347 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other agents, from other repositories