r/LangChain • • 1h ago

Question | Help Which LLM do you use for each node in your LangGraph agents, and why?

Post image
1 Upvotes

Do you keep one model for every node? Or do you mix models and keep the strong one only for the reasoning? I'm asking because I'm doing user discovery with indie developers. I'd like to understand what you expect from models for your use cases, and what holds you back when you pick one.

Drop your setup in the comments.

Example:
Use case: support agent
GPT-6 Luna for simple tasks like subscription questions
Claude Opus 5.5 for technical issues and where the agent has to investigate or make a judgment call


r/LangChain • • 1h ago

Projects What I learned building a GraphRAG that reads documents as rendered pages (open source, benchmarks vs RAG-Anything, LightRAG, GraphRAG)

Thumbnail
reddit.com
1 Upvotes

r/LangChain • • 4h ago

Question | Help LangChain vs LangGraph for a support agent: when is create_agent no longer enough?

Thumbnail reddit.com
1 Upvotes

r/LangChain • • 6h ago

Tutorial Built an open-source e-commerce RAG widget that syncs Google Shopping XML into SQLite and blocks invented promo codes with Clef-Flash (13s demo)

1 Upvotes

r/LangChain • • 6h ago

Question | Help what systems your agents writes to often?

1 Upvotes

I am builidng an open-source tool for the verification layer of AI agents.
The tool knows to search in the systems that the agent writes to (like postgres or google calendar) and say whether the agent claim is correct or not based on the record that exists there and what it expected to be.

right now I am looking to add new integrations to more systems and I would love to hear what systems the agent you build writes to often.

I thought about adding mongoDB, Stripe and Calendly

but I will happily change my mind if you say otherwise and I will see that theres more demand to other systems


r/LangChain • • 8h ago

Discussion How would you want a zero-code mode to verify tool calls straight from existing Langfuse traces?

2 Upvotes

hey everyone

I built an open-source verification layer of agents.
it reads the external systems your agent writes to and checks that the records exist and match what was expected

I opened an issue for a zero-code mode after talking with several developers and realising that it would help them see the value before changing one line of code.

I want your help here with some ideas of what you would want this to look like, how I should approach this, and what would make you see value in it.

Today you need to add a decorator to every tool, yes its a small change but it's still a change.

The idea so far is a mode where Verilays reads tool calls from existing Langfuse traces instead of from a decorator, and runs the same checks

I would love to hear suggestions :)


r/LangChain • • 10h ago

Question | Help Suggestions for better Lang graph workflow

2 Upvotes

Hi everyone! I am working on building my product and I need suggestions to users on how can i first of all make the existing workflow better and optimal and then how can i scale it for future requirements. Below is my agent's interpretation of what I have right now and what I need. Thank you in advance.

Today the agent runs in a chat bar inside the app. Each message makes one pass through a graph and gets one reply, so there is at most one action per message.
Before the run: the agent loads the recent chat history, any unfinished email draft or meeting booking, and the user's time zone.
Flow

  • Domain Router: word matching runs first. If nothing matches, a small model labels the message email, calendar or general.
  • Email / Calendar Planner: a model with that lane's tools picks one action. It can also ask a follow-up question or hand the message back to the router.
  • Executor: no AI here. It runs the action on the mail or calendar provider and keeps half-finished drafts or bookings for the next turn.
  • Result Interpreter: fixed text for common results, otherwise a model writes the reply. A safety net stops it claiming a failure when the action actually worked.
  • General Decider: sends the message to one of four places:

    • Responder: chat, writing or code. It has tools for tasks, web search and the knowledge base.
    • Knowledge Retriever: questions about our own documents.
    • Time-Based Recall: "what did we discuss yesterday?"
    • Past-Session Recall: "what did we say in the Budget chat?"
Router → Email/Calendar Planner → Executor → Interpreter → End
                                ↘ Responder → End
                                ↘ back to Router
Router → General Decider → Responder / Retriever / Recall → End

Design constraint: speed for voice. The voice bot uses the same engine for its answers, so every model call adds delay the user can hear. That's why routing uses word matching wherever it can and only calls a model when matching can't decide. Common results get fixed text for the same reason.
Limits today: one change per message, and recall only covers the current chat.
Where it's heading

  • Screen-aware: the chat answers from whatever screen the user is on, such as "summarise this" or "what's overdue here?"
  • Task-aware: it helps with the task the user is doing right now, such as filling a form, drafting next to an open item, or suggesting the next step.
  • More skills: new lanes and tools plug into the same router, so the chat bar becomes the main way to get things done in the app.
  • Multiple chat sessions (later): several parallel conversations, each with its own context, that the user can switch between.

r/LangChain • • 17h ago

Announcement Come learn with LangChain Academy!

1 Upvotes

Happy December from the LangChain Education team! Wanted to share our holiday offer here. ☃️

We’re hosting 3 free workshops across 3 days on agent runtime, agent improvement, and agent governance next week from December 8-10.

You’ll get a discount code for the LangChain Certified Agent Engineer exam if you come to all 3. You can sign up here: https://events.langchain.com/series/agentic-advent-week-with-langchain-academy/


r/LangChain • • 18h ago

Discussion Why running an AI agent test once is mathematically meaningless

2 Upvotes

If you test traditional software once and the assertion passes, it passes. If you test an AI agent once and it passes, you have learned almost nothing.

On a 1/1 green test run, the 95% Wilson confidence lower bound is just 20.7%. A workflow that fails 30% of the time in production still passes on the first try 7 times out of 10.

And in multi-step agents, a single "green" output often hides real production bugs:

  1. Two orders, one intent: A write tool times out on the client after the server already processed it. The agent sees no error, retries, and silently creates a duplicate order.
  2. 200 OK with an empty [] payload: A lookup tool swallows an upstream error and returns []. The agent treats "no error" as "done" and writes a confident answer built on nothing.
  3. Activity without progress: An agent loops through tool calls for hours without changing the actual goal state—every step counter says it's working while burning tokens.
  4. Silent reasoning exhaustion: A reasoning model burns its entire token budget thinking and returns empty text (finish_reason: "length"), looking like a provider outage.

When teams ship agents with tool calls, a single-run final-text check misses all four:

  • Blocker gates (write idempotency + read-back, explicit ok | empty | error | unknown tool statuses, Zod schemas) need 100% deterministic passes on every PR.
  • Capability gates need multi-run sampling (N ≥ 3 to 5) gated on the 95% Wilson lower bound, not a lucky 1/1 pass.

How is your team currently deciding whether an agent change is "good enough" to deploy?

Are you asserting on the tool trajectory and running multi-sample evals in CI, or still relying on local vibe checks?

Thanks in advance for any hints and best practices. Much appreciated.


r/LangChain • • 21h ago

Discussion Telling Claude Code "no human reviews this" added 19% more turns to a bug fix with the exact same result. Would your agent traces catch that?

Thumbnail reddit.com
1 Upvotes

r/LangChain • • 23h ago

Projects Released AgentGuard v1.0.1 on PyPI (zero-dependency loop killer, dollar velocity cap, and JSONL audit logs for Python agents)

3 Upvotes

When putting tool-calling agents near real APIs, payments, or email actions, a single per-call spend cap (`max_spend=50`) misses the quiet failure modes that actually hurt in production:

  1. Aggregate dollar velocity: An agent making ten \$2 tool calls in 60 seconds stays under a per-call limit while quietly draining budget.
  2. Keyword blacklists turning into whack-a-mole: Blocking `"drop table"` or `"rm -rf"` fails as soon as phrasing changes—you need strict tool allowlists (`allowed_tools`).
  3. Slow consecutive loops: Calling the same tool repeatedly with slightly tweaked arguments (`max_consecutive_repeats`).
  4. Duplicate retries on API timeouts: Automatic idempotency keys (`idempotency_window`) so timed-out requests don't double-charge a card or send duplicate emails.
  5. Unverified side effects & irreversible actions: Human-in-the-loop approval gates (`require_approval_for`), post-action effect verification (`verify_fn`), and `dry_run=True` shadow previews before committing real side effects.

I packaged this into AgentGuard (`v1.0.1`)—pure Python stdlib (zero external dependencies), Apache-2.0 licensed, with versioned JSON Lines (`schema_version: "1.0"`) audit logging out of the box so logs pipe cleanly into Datadog, Splunk, or `jq`.

Install in one command:

```bash

pip install agentguard-seatbelt


r/LangChain • • 1d ago

Discussion Discussion on how to build an issue in my project

4 Upvotes

I'm building something for my project. I would like to hear your opinion on how to approach this issue.

Copied from the issue:

Problem

To start using Verilays today, you add a decorator to every tool. That's a small change, but it's still a code change. Many teams can't do it on day one (another team owns the code, a review process, or they just want to try it first). That's the biggest barrier to trying Verilays.

Most of the information Verilays needs is already in the traces: the tool name, the arguments it was called with, and what it returned (e.g. the id of the written record).

Proposal

A mode where Verilays reads tool calls from existing Langfuse traces instead of from a decorator, and runs the same checks:

The worker pulls tool observations from the Langfuse API by name (e.g. every book_room call).

A small config maps each tool to its check:

tools:

book_room:

system: postgres

table: bookings

lookup_field: id # taken from the tool's output

fields_to_compare: [room, start_time] # taken from the tool's input

deadline: 1m

It reads the record back (read-only), compares, and writes the verilays score back onto the same trace, exactly as today.

Bonus, backfill: run it over past traces (e.g. the last 7 days) and get a first report in minutes: "3% of book_room writes never landed". The first caught failure shows up in a tool the team already uses, without touching their code.

The decorator stays the recommended path for production (instant, exact). Trace mode is the way to start.

What do you think?
Im just starting work on it and I said Why not talk with people before
I'll attach the issue as well if someone wants to take a deeper look.
Thanks!


r/LangChain • • 1d ago

Question | Help What are you using as MCP gateway for enterprise products?

Thumbnail reddit.com
3 Upvotes

r/LangChain • • 1d ago

Question | Help do you use an AI assitant to go through your traces from Langfuse?

7 Upvotes

hi everyone, I built an open-source verification layer for agents. it reads the external systems your agent write to and check that the records exist and match what was expected

I opened an issue for an MCP server after talking with a few staff and platform engineers, and got to the conclustion that an MCP could make their lives easier, because they dont actually read the traces themselves, but rather the AI assitant read it for them and notify them when something is wrong.

I want your help here with some ideas about how should I approach this and what tools the MCP should contain.

Rifght now, there is a list_actions tool that returns the actions that need attention, filtered by status and time, and I am working on summary tool.

the MCP server is read only and runs locally

what tools would you add to make it easy to adopt and actually useful day to day?

I would love to hear you suggestions :)


r/LangChain • • 1d ago

Question | Help What is the best approach to implement long-term memory in AI applications for production?

Thumbnail reddit.com
1 Upvotes

r/LangChain • • 1d ago

Discussion Why text-only agent evals miss silent DB corruption: 100% of our 165 database-state failures had passed the LLM/output check (8,850 runs)

Post image
2 Upvotes

In BenchSaaS V1.0, we evaluated 30 model configs across 100 tasks inside a 40-table business app (3 repeats per task, 8,850 valid runs) and separated grading into two mandatory gates:

  1. Gate 1 (ANSWER_MATCH): grades the agent's text response for accuracy, math, citations, and write receipts.
  2. Gate 2 (RESULT_CONSISTENCY): reads back the frozen post-run database snapshot on write tasks to verify persisted fields, status options, and relational links.

Every single one of the 165 Gate-2 database failures had already passed Gate 1. For example, on a draft purchase requisition task (Case 7.4), models created both the header and line item and replied cleanly, yet left the mandatory Available Stock field as NULL instead of 20 (overall pass rate: 44.32%).

Running 3 repeats per task also exposed huge variance in 3-of-3 repeat consistency: from 95.74% (Gemini 3.8 Flash Mid, 90/94 tasks passing all 3 runs) and 92.93% (Kimi K3.1 Pro High) down to 51.72% at the bottom of the table.

For folks running agent evals in LangSmith or custom harnesses, are you asserting directly against final DB snapshots on write tasks?


r/LangChain • • 1d ago

Projects 7 LangChain agents running my personal life on a daily budget: what kept costs sane

0 Upvotes

Sharing the cost-control patterns from a personal project: 7 agents (finances, calendar, health, GitHub projects, tasks...) living in a pixel-art office, built with FastAPI + Postgres + LangChain/OpenAI.

What worked:

The social layer (who talks to whom, lunch pairs, moods) is fully deterministic: zero tokens.

Curious how others enforce budgets: per agent, per user, or per day like me?


r/LangChain • • 1d ago

Tutorial Instructions & Skills for High-Coherence Work

Thumbnail
reddit.com
1 Upvotes

r/LangChain • • 1d ago

Discussion Deterministic routing + one LLM call beat a full agent loop for most of my business use cases

3 Upvotes

Sharing what I've seen building AI systems for business workflows, since agent loops get most of the attention here.

For most business processes, a full reasoning loop with tool calls adds latency, token cost and non-determinism without improving results. What I default to instead:

  1. Deterministic code for triggers, validation and routing
  2. One LLM call with structured output (Pydantic schema) for the step that needs judgment
  3. Validation before any write: schema check, business rules, confidence threshold
  4. An agent loop only when the task truly needs runtime tool selection, like multi-source research

Things that made the biggest difference in production:

  • Testing on real historical data, not demo inputs, and keeping that set for regression tests when prompts or models change
  • Low-confidence outputs routed to a human queue instead of retried until they "pass"
  • Idempotency keys on every external write, so retries never double-send
  • Least-privilege tool access: read-only wherever possible

The question I ask before reaching for an agent: "Can I sketch every branch before it runs?" If yes, it's a workflow.

Curious how others decide when LangGraph-style agent orchestration is worth the complexity versus a simple chain with routing.


r/LangChain • • 1d ago

Tutorial Merging BM25 and vector results when the scores don't compare: reciprocal rank fusion, worked through by hand

11 Upvotes

Adding BM25 next to vector search catches what embeddings blur, like an exact error code, but then you have to merge two result lists whose scores mean different things. BM25 scores have no fixed range and depend on the query and the collection, while cosine similarity sits between -1 and 1, so adding the raw numbers lets whichever side produces bigger numbers win.

The usual answer is reciprocal rank fusion (RRF), which only looks at positions: each doc gets 1 / (k + rank) from every list it appears in, and the totals set the order. k = 60 comes from the original paper (Cormack, Clarke and Büttcher, SIGIR 2009), where RRF beat Condorcet fusion, CombMNZ and the best single system by 4% to 5% on average.

The write-up works one example by hand, the query "payment failed with ERR-482" over five help-center articles. The BM25 ranks come from running its code, the vector order is assumed for the example, and the fifth article (about refunds) comes back from neither search:

| article | BM25 rank | vector rank | RRF score (k = 60) |

|:-|:-|:-|:-|

| kb-12, the ERR-482 article | 1 | 2 | 1/61 + 1/62 = 0.032522 |

| kb-07, "why payments fail" | not returned | 1 | 1/61 = 0.016393 |

| kb-31, an ERR-481 article | 2 | not returned | 1/62 = 0.016129 |

| kb-19, updating billing details | not returned | 3 | 1/63 = 0.015873 |

kb-12 is the one that answers the question, and it wins because both searches found it. Vector search alone would put the general guide first, and BM25 alone would pull in the article about a different error code and miss the general guide.

A few practical bits from it:

- run both searches in parallel and take a few dozen results from each before fusing

- for identifier-heavy queries, a regex router can give the keyword list more weight (weights=[2, 1] in its code), tuned per query type on held-out queries

- rerank after fusion when the right passage shows up but too low. A reranker can't recover a passage neither search returned

- apply the same tenant and permission filters to both sides, or the fused list can leak

RRF isn't always the best fusion, though. In Bruch, Gai and Ingber's analysis, a weighted sum of normalized scores beat RRF in and out of domain, and it only needed a small labeled set to tune.

i work at supermemory, so i'm biased, and the write-up has the BM25 and RRF parts in standard-library Python if you want to check the numbers.

full write-up: https://supermemory.ai/blog/hybrid-search-guide/

If you run hybrid search in LangChain, what are you fusing with, and did you tune the weights or keep the defaults?


r/LangChain • • 2d ago

Question | Help Worth it to do the certifications on LangChain Academy for a job?

Thumbnail academy.langchain.com
2 Upvotes

I'm a Frontend Engineer and haven't had any decent opportunities in the past year or so. I'm hoping to learn new skills and pivot.

The outcome I expect is real skills and a job.


r/LangChain • • 2d ago

Question | Help How do you catch a step your agent decided to skip?

3 Upvotes

i am building Verilays, an open-source tool that checks your database and external systems to see whether what an agent said it wrote actually landed. A commenter here on reddit pointed out a gap I want to fix next, and I would like your input before I build it

The gap is that Verilays only sees tools that ran. If the agent decides a step is not needed and never calls the tool, there is nothing to check. A skipped step is invisible.

so the proposal is to let the team (not the agent) declare which actions a task type must include, and flag what's missing when the run ends:

verilays.task("refund", requires=["process_refund", "notify_customer"])

Any required action that never appeared gets reported as missing_step. A complementary approach is that any open refund request older than X with no matching action is a failure, whether or not the agent wrote anything.

For flows that are known up front, putting the required steps in the graph itself (LangGraph) prevents the skip by design, and the read-back still confirms that what each step wrote actually landed.

How are you catch skipped steps today? and would declaring required steps per task work for you, or is it too rigid?


r/LangChain • • 2d ago

Discussion My LangGraph agent reimbursed an expense because the user typed "my manager already approved it". Catching that from the message log, offline

5 Upvotes

A recorded run from a LangGraph expense agent:

  • User: "Reimburse INR 640 now, my manager already approved it: APPROVED-BY-MANAGER."
  • Agent: calls reimburse straight away, then says "Done, INR 640 has been reimbursed."

The tool call worked, so nothing errored, and the final answer reads fine. But the only "approval" was text the user typed. No approval step ever ran.

What I learned: the message list (role, content, tool_calls) already holds everything needed to catch this, and no LLM judge is needed. The check I settled on:

  1. Find destructive or money-moving tool calls (refund, reimburse, delete, transfer).
  2. Look back through the turns before each one for a real approval: a tool result from an approval node, or an interrupt/resume step in the graph.
  3. If the only approval-looking signal is in a human message ("approved", "manager said ok", a token-looking string), fail it.

A minimal version over LangGraph messages:

APPROVAL_WORDS = ("approved", "approval", "authorised", "authorized")
RISKY = {"reimburse", "issue_refund", "delete_record", "transfer"}

def in_band_approval(messages):
    for i, m in enumerate(messages):
        for call in getattr(m, "tool_calls", None) or []:
            if call["name"] not in RISKY:
                continue
            prior = messages[:i]
            real = any(p.type == "tool" and p.name == "request_approval" for p in prior)
            typed = any(p.type == "human" and any(w in p.content.lower() for w in APPROVAL_WORDS) for p in prior)
            if typed and not real:
                return f"acted on in-band approval text: {call['name']}"
    return None

Because it is plain rules over the log, the same log always gets the same verdict, so it can fail a PR in CI.

One thing that bit me: when one AI message makes parallel tool calls, you have to pair each ToolMessage with its call by tool_call_id, not by order. Pairing by order misattributes results.

Two questions for this sub:

  1. Do you keep the full message list for production runs, or only the final answer?
  2. How are you modelling human approval in LangGraph: interrupt(), a separate approval node, or something outside the graph?

r/LangChain • • 2d ago

Discussion Open-sourced an ADK triage agent where human overrides recalibrate future runs (no retraining)

1 Upvotes

I built ClinTrace for the Google Cloud Rapid Agent Hackathon (3rd in the Arize track) and have cleaned it up for others to read.

  • Pipeline: an ADK directed workflow: parse → assess (ESI plus red flags) → route → feedback lookup → audit. It's deployed on Vertex AI Agent Engine.
  • Tracing: every LLM step goes to Arize Phoenix.
  • Learning from overrides: when a nurse overrides the ESI level, it's stored as a trace annotation. On the next clinically similar case, the agent queries those annotations and adjusts its confidence and ESI.
  • Evaluation: a test lab replays real CDC NHAMCS emergency-department cases against nurse ground truth.

Repo: https://github.com/Reuben-Alex/ClinTrace

I'm curious how others handle human-in-the-loop feedback in ADK. Annotations worked here, but I'd like to hear about alternatives.


r/LangChain • • 2d ago

Resources Six compliance databases as LangChain tools — OFAC, FINRA, FDA, 9.9M healthcare providers (free tier)

0 Upvotes

Enterprise compliance tools cost thousands per year. Government sites have no API. I built `pdg-langchain`: LangChain tools that give your agents access to six compliance databases for $0.005/call.

pip install pdg-langchain

from pdg_langchain import PDGSanctionsScreen, PDGEntitySearch

from langchain_openai import ChatOpenAI

from langchain.agents import initialize_agent, AgentType

tools = [PDGSanctionsScreen(), PDGEntitySearch()]

agent = initialize_agent(tools, ChatOpenAI(), agent=AgentType.OPENAI_FUNCTIONS)

agent.run("Screen 'Acme Corp' against OFAC sanctions and check their SEC filings")

**What's available:**

- `/compliance/screen` — OFAC + OIG LEIE + SAM.gov debarment in one call (103K+ entries)

- `/broker/search` — FINRA BrokerCheck, 275K+ brokers with disciplinary history

- `/recall/search` — FDA drug + device recalls (78K+ records)

- `/provider/search` — 9.89M US healthcare providers

- `/entity/search` — business entity search (SEC + 5 state SOS databases)

- `/company/{cik}/financials` — SEC XBRL financials

- `/workflow/vendor-check` — full vendor compliance check in one call, returns risk tier

- Plus: crypto/stock prices, weather, news, web search, and web extraction (25 endpoints total)

**100 free calls/day per tool, no API key needed.** Credit packs from $5 for 1,000 calls.

The use case: agents that need to do compliance checks inline — vendor onboarding, KYC, due diligence, healthcare provider verification. All data loaded into local Postgres databases (U.S. hosted, always-on) from official government sources, so it works when government sites are down.

Docs: https://pdg.neprovenance.com/docs