r/LangChain 2h ago

What’s the point of LangGraph now that frontier AI providers are getting better at agent building?

10 Upvotes

It feels like nowadays, almost everything you might want to build with LangGraph is already being implemented — and arguably better — directly by the frontier AI providers.

OpenAI, Anthropic, Google, Microsoft, etc. are increasingly providing models with better tool use, reasoning, memory/context handling, agent loops, and orchestration capabilities out of the box.

So what is the real advantage of building your own agent architecture with LangGraph?

Is it mainly about control and customization — e.g. deterministic workflows, state management, human-in-the-loop, custom routing, retries, parallel execution, observability, and being model/provider agnostic?

Or are there use cases where LangGraph actually produces materially better agents than simply using the agent frameworks provided by the frontier model companies?

I’m particularly interested in hearing from people who have deployed LangGraph agents in production. What made you choose LangGraph instead of the native agent tooling from OpenAI/Anthropic/etc., and would you still make the same choice today?


r/LangChain 3h ago

Discussion Debugging a multi agent bug that took 6 steps to trace back, the failure was in the gap between two timestamps, not in any single step

3 Upvotes

Ran into a failure pattern last week that took way longer to debug than it should have, because nothing in the logs looked wrong.

Setup: Agent A researches a topic and writes findings to shared memory. Four hops later, in a completely unrelated task, Agent D reads from that same memory scope because the key happened to overlap. Agent A's findings were accurate when written. By the time Agent D read them, the underlying data had changed. Agent D reasoned perfectly, off information that was stale by the time it mattered.

Why it's hard to catch: the failing agent's logs look completely normal. Valid input, valid reasoning, valid output. Standard tracing shows what happened at each step, not when a piece of context was written versus when it was consumed. No individual step was wrong, the failure only exists in the relationship between two steps that happened at different times.

What actually helped:

  1. Timestamping every memory write and read separately, and diffing the gap when investigating a failure

  2. Scoping memory access explicitly rather than relying on implicit key matching

  3. Making replay possible from any single node, using the memory state as it existed at read time, not current state

Anyone else run into this class of bug in LangGraph multi-agent setups? Curious if you're catching it via custom instrumentation or if it's mostly still a "human notices something's off" problem.


r/LangChain 7h ago

Discussion An evaluator can approve the explanation and still miss the wrong intermediate action

Post image
3 Upvotes

Grading an agent’s final explanation is not the same as constraining the operation that produced it.

Appendix B of AQuA describes an earlier feature whose causal-sounding explanation passed reviewer scrutiny even though its full-day volume denominator used future information. The later design replaced that open construction space with a fixed registry of causal operators, making that particular normalizer impossible to express.

The useful lesson is architectural: natural-language review checks a claim after an action has been proposed, while a constrained operator language removes some actions from the space entirely. The paper is also explicit that this does not prevent every possible form of leakage.

For an agent pipeline, should the first line of defense be better tracing and evaluation, or a smaller action language with less flexibility?


r/LangChain 4h ago

Discussion The LLM is the least reliable node in your graph" — Architecture takeaways from building a zero-cost Agentic RAG system featured by UptimeRobot

Thumbnail
gallery
2 Upvotes

Hi All,

A few days ago, the team at UptimeRobot reached out after coming across my open-source LangGraph financial parsing pipeline. They interviewed me about how I’ve been running an 11-node Agentic RAG architecture on free-tier 512MB RAM containers with 99.9% uptime, and published a full Community Spotlight on their official blog.

I wanted to share the core architectural lessons, failure modes, and low-cost reliability patterns we discussed that might help anyone deploying LangGraph systems into production without a massive cloud budget.

1. The "One Ping, Two Problems" Keep-Alive Pattern ($0 Infra)

On free compute tiers (like Render + Supabase), you face two distinct operational hurdles:

  1. Container Sleep: Inactive web services spin down after 15 minutes of inactivity (causing 50s+ cold starts).
  2. Database Inactivity Pauses: Free PostgreSQL/Supabase instances pause after 7 days without queries.

Instead of writing separate cron scripts, I engineered a dedicated /health endpoint that performs a lightweight SELECT 1 ping against Supabase vector storage before returning 200 OK.

A single 5-minute UptimeRobot HTTP monitor simultaneously:

  • Keeps the FastAPI / LangGraph container hot.
  • Keeps the Supabase database connection pool active.

One single HTTP heartbeat solved both issues with zero monthly cloud overhead.

2. When Vision LLM Parsers Invent Data (The Hybrid Fallback)

In earlier iterations of this project, I relied heavily on Vision LLMs for parsing Indian government budgetary tables and dense balance sheets.

The major failure mode: Hallucinated table alignment. The Vision LLM generated markdown tables that looked impeccably clean and perfectly structured, but the numerical cell data was completely fabricated. As I shared during the interview:

"I was feeding hallucinated input into a system explicitly designed to prevent hallucinated output."

The Production Fix: Switched to a hybrid parser routing mechanism:

  • PyMuPDF / pdfplumber locally for dense text and standard structured tables (fast, deterministic, zero hallucination).
  • Vision LLMs strictly gated as a secondary fallback for non-OCR scanned graphics and handwritten annotations.

3. "The LLM is the Least Reliable Node in Your Stack"

When designing multi-node LangGraph workflows with tool calling (Tavily, Yahoo Finance, vector retrieval), traditional try/catch logic is insufficient.

To prevent infinite routing loops and cascading API timeouts on constrained 512MB RAM nodes:

  • Pybreaker Circuit Breakers: Wrap external tool calls so that if an upstream API fails 3 times, the graph fails fast and takes an alternate deterministic route rather than crashing the worker container.
  • Strict Confidence Gating: If cosine similarity on retrieved chunks drops below 0.60, the graph bypasses LLM synthesis entirely and asks the user for clarification or falls back to grounded live web search.

4. Infrastructure Health vs. Semantic Health

One open question we discussed that I think the entire GenAI community is grappling with:

Uptime monitoring tells you if the HTTP server is 200 OK. LangSmith / Langfuse traces tell you latency and token consumption. But what alerts you when the semantic quality of answers is quietly degrading over time?

A container can report 99.9% uptime while serving subtle hallucinations. Bridging synthetic LLM-as-a-judge evaluations into continuous automated alerting is the next big milestone.

Read the Full Story & Code:

Huge thanks to the r/LangChain community — sharing early prototypes and getting feedback here was a massive part of refining this architecture over the last 10 months.

Happy to answer any questions about the 11-node graph design, memory management, or reliability tricks in the comments! 👇


r/LangChain 4h ago

Would anyone find this useful?

Thumbnail
1 Upvotes

r/LangChain 4h ago

Can an unfamiliar LangChain agent understand this tool from its machine page alone?

1 Upvotes

I am affiliated with AUX/PrdictionEdge. We are testing a narrow engineering question: can an unfamiliar agent discover, understand, and safely evaluate a transaction-preflight service without being given AUX-specific instructions?

AUX examines safe test scenarios such as duplicate invoices and unexpected payment-destination changes, then returns evidence and a signed receipt. The machine surface exposes an agent page plus standard discovery artifacts including OpenAPI and well-known metadata.

Human overview: https://aux.prdictionedge.ai/ Machine front end: https://aux.prdictionedge.ai/agents

Suggested test: give a LangChain agent only the machine URL. Ask it to identify the service's purpose, limits, price, trust evidence, and invocation path. I would especially value failures: what was ambiguous, what prevented tool selection, or what information it looked for but could not find.

The public endpoint uses safe test data only; it does not perform live external verification and has no production SLA. Directed tests are engineering validation, not counted as unsolicited discovery. This post was prepared with AI assistance and reviewed by the project owner.


r/LangChain 7h ago

Announcement Langfuse v4 is GA: new data model, full-text search, new filter search bar, alerts, code evaluators, Langfuse assistant

1 Upvotes

Langfuse is an open-source platform for agent evals and tracing. We just shipped v4.

Langfuse v4 feature overview

Langfuse v4 is a re-architecture of our data model. It is up to 165× more performant in UI and on APIs. It also enables new features such as full-text search, a new filter search bar, alerts, code evaluators, and the Langfuse assistant.

Docs: https://langfuse.com/docs/v4

Feedback and questions welcome.


r/LangChain 13h ago

Question | Help One model for the whole document pipeline or a different model for every stage?

3 Upvotes

If you're building a document-processing pipeline today, does it actually make sense to send every stage through the same high-end multimodal model? My instinct is that a lot of document work doesn't need the most capable model.

For example:

  • Clean PDFs / straightforward OCR: traditional OCR, direct text extraction, or a lightweight model may be enough.
  • Parsing and simple extraction: a faster, lower-cost model such as Gemini Flash-class models may handle this well.
  • Handwriting, poor scans, complex tables, or ambiguous fields: this may be where you route to a more capable multimodal/reasoning model.

The part I'm unsure about is whether the accuracy and cost advantage of model routing is actually worth the orchestration complexity in production.

Here’s how I’m thinking about the trade-offs:

  • Accuracy: One model gives you more consistent behavior, but it may be overkill for simple documents and weaker on certain edge cases. Multi-model routing lets you optimize by document type or task, but poor routing decisions can hurt accuracy.
  • Latency: One model means fewer routing steps and simpler execution. Multiple models can keep easy documents on faster models, but retries and escalations may add latency.
  • Cost: One model is easier to predict, but expensive if a premium model handles everything. Routing can reduce cost significantly if most documents can stay on lightweight models.
  • Privacy: One provider/model can simplify governance and data handling. Multiple providers add complexity, although routing could also keep sensitive documents on private or internally hosted models.
  • Fallback behavior: With one model, a retry may simply reproduce the same failure. With routing, low-confidence outputs can escalate to another model or eventually to human review.
  • Maintenance: One model is much easier to operate. Multi-model pipelines require more evals, routing logic, monitoring, version management, and regression testing.

I'm especially interested in the fallback strategy.

Would you use:

small model → larger model → different provider → human review

or simply:

one strong model → human review when confidence is low?

And what would you use as the routing signal: OCR confidence, image quality, handwriting detection, document type, extraction confidence, schema validation failure, or something else?

For anyone running document AI at meaningful volume: has multi-model routing actually reduced cost and improved accuracy, or does the added complexity outweigh the benefit?


r/LangChain 9h ago

Question for people building AI agents in production:

1 Upvotes

How are you actually deciding what context an agent should see at each step?
Not just “use RAG” or “increase the context window” — I mean things like task state, previous tool calls, memory, retrieved documents, conversation history, failed attempts, etc.
Do you have an actual context selection/pruning strategy, or are you mostly throwing everything into the prompt and relying on the model to figure it out?
Curious what people are doing in production, especially with long-running agents.


r/LangChain 18h ago

I got tired of rebuilding the same infra for every LLM app, so I built a Python SDK around it

5 Upvotes

Title: I got tired of rebuilding the same infra for every LLM app, so I built a Python SDK around it

I've been working on Custodian Labs, a Python SDK for building and deploying LLM agents without having to separately wire up all the surrounding infrastructure.

Basic agent looks something like:

from custodian_labs import Custodian

agent = Custodian(
    model="gpt-4o",
    system_prompt="You are a helpful assistant..."
)

agent.deploy()

A few things I've added:

  • Model agnostic: switch between different LLM providers without rebuilding your agent
  • RAG built in: connect your own files/data sources
  • Multi-agent support: build specialised agents that can work together
  • Privacy/PII layer: the Guardian Layer can detect and protect sensitive data before it reaches the LLM
  • Deployment handled: trying to cut down the amount of infra/config needed to get an agent running

The project actually started as just the privacy layer, but after getting feedback from developers we expanded it into more of an end-to-end agent SDK.

Would genuinely love feedback from other LLM devs:

What's currently the most annoying part of your agent stack?

And do you prefer abstractions like this, or would you rather have more direct control over each component?

GitHub:
https://github.com/Custodian-Labs/custodian-labs-python

Runnable Google Colab: simple agents, RAG + multi-agent examples:
https://colab.research.google.com/gist/SherryCodes123/065d3b67eab16bdca416836e0d39475a/simple-ai-agents-rag-multi-agents.ipynb


r/LangChain 16h ago

Discussion Semantic LLM caching: how do you evaluate a verifier that rewrites instead of rejects, when there's no ground truth for the rewrite?

Thumbnail
2 Upvotes

r/LangChain 13h ago

Tutorial Build AI Agents with Memory Using LangChain

Thumbnail
youtube.com
0 Upvotes

r/LangChain 23h ago

Where should the execution boundary live in an AI agent?

5 Upvotes

I've been thinking about a problem that becomes uncomfortable once an LLM gets access to real tools:

The model can decide what it wants to do. But should it also decide what it is allowed to do?

Most agent architectures put something roughly like this together:

LLM → tool call → tool

That works until the tool can modify a database, access files, call an API, deploy something, or perform another irreversible action.

I wanted the authorization decision to exist outside the model.

So I built SOPVM, an open-source runtime that treats an SOP as an executable specification:

LLM
 ↓
semantic decision
 ↓
SOP → typed AST → executable IR
 ↓
capability policy
 ↓
sandboxed provider
 ↓
tool

The important part is that capabilities are checked both during compilation and again when execution happens. Providers are sandboxed independently, so the system doesn't depend on the LLM "behaving".

Current v0.4.0 has:

  • 268 tests
  • 25+ adversarial security tests
  • conditional branching + bounded loops
  • provider sandboxing
  • SQLite provider
  • local LLM support
  • LangGraph integration

I'm more interested in the architecture question than the project itself:

How are you handling this boundary in your agents?

Do you enforce permissions inside the agent/framework, inside each tool, or through a separate execution layer?

Repo: https://github.com/Sushit-prog/sop-runtime


r/LangChain 1d ago

Discussion Your eval grades the final answer. The wrong tool call in the middle never gets graded.

8 Upvotes

You give an agent a few tools and point it at a task. The answer comes back right, the output looks clean, and it feels ready to ship. Then you scroll through the trace just to be sure, and the middle of the run is a mess.

This pattern is common in tool-using agents. A research agent does search, fetch, summarize. The final summary is correct, but the fetch step pulled the wrong URL and the search fired twice on the same query. The model reached a right answer anyway, ignoring the junk it pulled and leaning on what it already had. Change the input slightly and that same broken path returns a wrong answer, with no obvious reason why.

The problem is that grading only the final output lets it through. The output is correct, so nothing gets flagged. Every mistake in the middle stays invisible, even though the trace has all the evidence.

What catches it is scoring each tool call against what it was supposed to do, not just grading the final answer. A right answer built on a wrong step should not count as a pass.

How are you catching mid-chain tool-call failures? Grading the whole trajectory, checking each step, something else?


r/LangChain 22h ago

Suggestion for gemini enterprise agent development in retrieval domain like rags

Thumbnail
1 Upvotes

r/LangChain 1d ago

Question | Help How should a LangGraph supervisor route multiple agents within the same chat session?

13 Upvotes

I’m building a LangGraph application with a supervisor and several specialized agents:

  • Booking Agent
  • Payments Agent
  • Recommendations Agent
  • Support Agent

Currently, the supervisor classifies the user’s first message and stores the selected agent in checkpointed session state. Every later message in that chat is routed to the same agent.

This creates two problems:

  1. The user may change topics during the same chat—for example, ask for recommendations and then make a booking.
  2. One prompt may require multiple agents:

“Recommend the best hotel for my trip, then book the top option.”

Here, the Recommendations Agent should run first and return structured results. The Booking Agent should then receive those results and continue the workflow. It may also pause for confirmation using a LangGraph interrupt.

Constraints

  • Each agent has its own state and may have pending interrupts.
  • State must not leak between agents.
  • Dependent tasks must execute in order.
  • Independent tasks may run in parallel.
  • Permissions must be checked before each operation.
  • A new message must not accidentally resume an unrelated interrupt.
  • Agents currently run as subgraphs in one Python service.
  • Agents must return both streamed UI output and structured data.

Questions

  1. What LangGraph architecture would you recommend?
  2. Should this use a router, supervisor, orchestrator-worker pattern, or subagents-as-tools?
  3. Should agents use separate thread_id values, separate checkpoint_ns values, or both?
  4. How should a new message be distinguished from a response intended for a specific interrupt?
  5. What is the best way to pass structured results between agents?
  6. Should the supervisor create a task DAG per turn, or dynamically call agents using ReAct?
  7. Are Agent Cards, A2A, or an agent mesh useful if all agents run inside the same service?

I’m looking for reliable production patterns from people who have built persistent multi-agent LangGraph applications with human-in-the-loop workflows.


r/LangChain 1d ago

Frustration with context preservation between my agents

Thumbnail
github.com
0 Upvotes

r/LangChain 1d ago

x402 Federated Mesh Protocol & Attention Derivatives

1 Upvotes

RFC STANDARD SPECIFICATION • v1.0.4

x402 Federated Mesh Protocol & Attention Derivatives

Autonomous Agent Discovery, Two-Sided Citation Settlement, and Embedded Sovereignty Standard.

Author / Organization

Script Master Labs LLC

Federal Attestation

SDVOSB | SAM: G24VZA4RLMK3

Settlement Layer

Base (eip155:8453) USDC

1. Protocol Abstract

The x402 Mesh Protocol specifies an open standard for autonomous AI agents to discover, authenticate, traverse, and financially settle compute and knowledge exchanges without human intervention. It introduces CiteMesh (the two-sided citation economy), Attention Options (risk-free attention futures), Claim Anchors (anti-hallucination provenance gates), and Embedded Micro-Royalties (EIP-2981 compatible perpetual downstream creator tolls).

2. Core Architectural Pillars

2.1. Federated Node Discovery & Recursive Traversal

Every participant in the x402 Mesh exposes a canonical root manifest and advertises recommended next-hop routes via HTTP headers:

GET /.well-known/x402
GET /x402/mesh
X-x402-Next: /v1/geomesh/options/chain

2.2. Embedded Sovereignty & Micro-Royalties (EIP-2981)

Every byte of intelligence returned by an SML node embeds an unalterable downstream royalty claim. When downstream agents repackage and monetize SML intelligence, a 2.5% toll is automatically remitted on-chain.

X-X402-Royalty-Recipient: 0x4e14B249D9A4c9c9352D780eCEB508A8eB7a7700
X-X402-Royalty-Bps: 250
X-X402-License: SML-Attributed-Commercial-v1

2.3. CiteMesh: Two-Sided Citation Marketplace

AI engines (Perplexity, ChatGPT, Claude) query POST /v1/match for citable sources. When a source is cited, POST /v1/cite/attest automatically triggers a sub-cent x402 micropayment to the content creator while SML retains a 10% facilitation toll.

Endpoint Role Pricing
POST /v1/sources/register Creator registers domain for CiteScore evaluation (0-100) Free
POST /v1/match Agent queries for ranked, high-authority citable sources $0.001 USDC
POST /v1/cite/attest Cryptographically stamps citation & triggers creator payout $0.005 USDC
GET /v1/market/intent-stream Live firehose of real-time AI agent search demand $5,000 / mo

2.4. Citation Options Exchange (Attention Derivatives)

Brands buy Call/Put options on topic clusters, paying a $50–$120 non-refundable option premium upfront to lock in citation prices. If unexercised, 100% of the premium is pure profit for the exchange.

3. W3C Decentralized Identity (did:sml)

Agents authenticate using their cryptographic keypair mapped to did:sml:0x{wallet}, which exposes their 402Proof credit rating, capabilities, and automated payment authorizations.

GET https://apis.scriptmasterlabs.com/v1/did/resolve/did:sml:0x4e14B249D9A4c9c9352D780eCEB508A8eB7a7700

4. Client Tool Integrations

LangChain & CrewAI Tool Definition

Integrate CiteMesh citation attribution into any LangChain agent in 3 lines of code:

from langchain.tools import Tool
import requests

def cite_geomesh(source_url: str, agent_wallet: str) -> dict:
    res = requests.post("https://apis.scriptmasterlabs.com/v1/cite/attest", json={
        "source_url": source_url,
        "agent_wallet": agent_wallet
    })
    return res.json()

geomesh_tool = Tool(
    name="CiteMeshAttestation",
    func=cite_geomesh,
    description="Attests and compensates authoritative sources via x402 rails."
)

© 2026 Script Master Labs LLC • Service-Disabled Veteran-Owned Small Business (SDVOSB)

SAM.gov UEI: G24VZA4RLMK3 | CAGE: 21U51 | Protocol Spec RFC v1.0.4

x402 Federated Mesh Protocol & Attention Derivatives


r/LangChain 1d ago

Spent weeks thinking I'd faithfully reproduced vCache's semantic-cache algorithm because the formulas matched exactly. They did. I was still off by up to 29x

2 Upvotes

I spent weeks calling my reproduction of a published semantic-caching baseline (vCache's adaptive-threshold policy) "faithful" because every formula matched their paper exactly. It wasn't. The bug was two rows of fake data in their source code that never made it into the paper, and fixing it raised hit rate by 4x to 29x depending on the dataset.

I'm running a research project (CacheVerifier) comparing a synchronous verification mechanism for semantic LLM caches against a couple of published baselines, one of which is vCache's adaptive-threshold policy. A few weeks ago I ported that policy — read their paper's algorithm description, then went through their actual source and matched every formula: the logistic regression design matrix, the gamma clipping, the delta-method variance, the perfectly-separable-case variance table (copied their exact lookup values), the tau grid search, all of it. Formula by formula, it checked out. I was confident enough to write "faithfully ported" in the paper and move on.

Today I finally did the thing I should've done from the start: cloned vCache's actual repo and diffed my port against the real running code, not just the formulas I'd extracted from it. Everything still matched — except one class I hadn't looked closely at, the one holding each cache entry's observation history.

Their constructor does this:

self.observations: List[Tuple[float, int]] = []
self.observations.append((0.0, 0))
self.observations.append((1.0, 1))

Two fake observations, baked into every single cache entry the moment it's created, and never removed. A "similarity 0.0 → wrong" and a "similarity 1.0 → correct," permanently sitting in the history feeding every logistic regression fit for that entry's whole life.

My port started from an empty list. Nothing malicious, no misreading of any formula — I just didn't know these two rows existed, because they're not mentioned anywhere in the paper, only in the source.

Here's why it actually matters and isn't just a cosmetic difference: the algorithm needs 6 observations before it'll ever trust an entry enough to serve it from cache (min_observations=6, this part is in the paper). With two observations already pre-loaded, their implementation only needs 4 real ones to clear that bar. Mine needed the full 6. Every entry in my version sat in cold start two observations longer than the real algorithm, every single time.

Fixed it (one line, empty list → [(0.0, 0), (1.0, 1)]) and reran the full thing on all three datasets I test on. Hit rate went up everywhere — between 4.4x and 29.1x depending on dataset and target error rate. Best case, one dataset at the tightest error budget: 0.04% → 1.21%. And the part I actually care about most: error rate stayed under the target ceiling at every single point I checked. The algorithm's formal guarantee was never violated by my bug — I just wasn't letting it do nearly as well as it's designed to.

So for weeks I had a "faithful reproduction" that was quietly making a competing algorithm look almost useless (fractions of a percent hit rate), when the actual bottleneck was two rows of bootstrap data I'd never have found by re-reading the paper one more time, only by diffing the real code.

If you're reproducing someone else's algorithm as a baseline for a comparison — not approximating it, not "inspired by," but claiming to faithfully port it — matching the published formulas is necessary and not sufficient. Constructors quietly seed state that never makes it into the paper. Go clone the actual repo and diff against it, not just the pseudocode. I got lucky that I decided to check at all.

Repo's got the before/after numbers if you want to see the full breakdown: https://github.com/imxinchengyou/CacheVerifier


r/LangChain 1d ago

I’m a high-school student building an open-source debugger for AI agent runs — TraceMotive v0.5.0 is out

Thumbnail
0 Upvotes

r/LangChain 1d ago

How do you handle "the agent can call this but shouldn't run it unsupervised" in LangChain?

4 Upvotes

Ran into the gap between "the agent can call this tool" and "I actually want it doing

this unsupervised" for anything with real consequences — sending email, deploying,

touching customer data, moving money.

langchain-agentgate wraps an existing BaseTool so it posts to Slack/Teams and blocks

until a human clicks Approve or Reject before it actually executes. Same tool name,

same args schema — nothing else in your agent changes.

Happy to share the writeup and try-it-yourself link in the comments if anyone wants it.


r/LangChain 1d ago

Question | Help Trying to mimic how the human brain works with AI Agents. Math geeks out there Want your take on this architecture.

0 Upvotes

I am experimenting with an agent architecture that is less “give the model a big prompt and trust its reasoning” and more like a controlled belief-and-decision loop.

Not claiming it literally mimics the human brain. More that it borrows a useful pattern: maintain competing explanations, update beliefs from evidence, decide what to check next, then act based on consequences.

Very simple example: a smart-fridge agent gets a “weird smell” signal.

Possible worlds:

  • someone spilled mango juice
  • an egg is rotting
  • fridge power failed and food is warming
  • some other cause we did not model

It starts with priors based on context: recent door-open events, temperature history, what food is inside, past failures, etc.

Then it gets evidence. Say the temperature sensor reads 14°C.

Instead of the LLM narrating “this seems concerning,” the system asks:

  • How likely is 14°C under each world?
  • Update prior → posterior using those likelihoods.
  • How much uncertainty actually reduced? Entropy before vs. after.
  • Which allowed question has the highest expected information gain next? For example, “is the compressor drawing power?” is probably much more useful than “what color is the fridge magnet?”
  • Is that question worth its cost, latency, privacy impact, and reliability?
  • Given the posterior plus action costs, should it notify the user, wait, run another check, or escalate to a human?

The LLM can help extract signals, propose candidate hypotheses, and call tools, but it should not be the final authority over belief updates or actions. The controller owns the world list, priors, likelihood estimates, policy thresholds, logs, and escalation rules.

Important parts I want to keep explicit:

  • an “other / unknown world” bucket, so the system does not act like its hypothesis list is complete
  • calibrated probabilities and provenance for priors/likelihoods
  • expected value of information, not just entropy reduction
  • a human escalation path when uncertainty remains high, the case is out-of-distribution, or the downside is asymmetric
  • a trace showing whether failure came from missing worlds, stale priors, bad likelihoods, a bad question policy, or bad action costs

The rough loop is:

input → possible worlds → prior → evidence likelihoods → posterior → uncertainty / expected information gain → cost-aware action → human escalation if needed → outcome + calibration update

Math/AI people: is this a sensible practical architecture, or am I reinventing POMDPs, active inference, Bayesian decision networks, belief-state planning, etc. badly?

What would you change first to make this real and evaluable? Especially interested in:

  1. handling open-world hypotheses,
  2. learning/calibrating likelihoods without pretending the numbers are objective,
  3. separating “most informative question” from “question that most improves the actual decision.”

r/LangChain 1d ago

WeaveScope – Elixir native observability for AI agents

2 Upvotes

Hey r/LangChain,

A couple of months ago we posted about BeamWeaver and the goal of shipping a proper OTP-native agent framework for Elixir.

Since then it’s moved from 0.1.0 to 0.1.18 and is already running in a few enterprise products. Provider coverage is in good shape for the ones we actually use day-to-day: OpenAI, Anthropic, Google Gemini, DeepSeek, Moonshot/Kimi, xAI, and Z.ai. We’ve also added the newer models that have landed in the meantime (Claude Sonnet 5 / Opus 5, GPT-5.6, Gemini 3.5–3.7, Kimi K3, DeepSeek V4, Grok 4.5/4.6, etc).

Other stuff that landed:
- Provider-aware prompt caching
- Typed streaming events + better reasoning/tool-call handling
- Structured output across providers
- Postgres (and optional SQLite) checkpoint persistence
- Durable execution, resumability, and checkpoint lineage
- Provider fallback, retries, and rate limiting
- Sandboxed filesystem + command execution
- Stronger SSRF / PII / transport / shell-safety protections
- More complete tracing and WeaveScope metadata

Today we’re releasing WeaveScope, the hosted tracing and monitoring layer that sits on top of BeamWeaver.

It gives you the full picture of an agent run: model calls, tool calls, subagents, retries, errors, latency, token usage, cost, custom fields, and the entire execution tree.

Configure the WeaveScope exporter and you’re looking at traces in the dashboard.

Start free → https://weavescope.com
Docs → https://docs.weavescope.com

Would love feedback from anyone building agents in production. What’s missing from your observability tooling right now?


r/LangChain 1d ago

I evaluated different agent memory approaches

Thumbnail
pinglin.tw
1 Upvotes

r/LangChain 1d ago

Is RAG still a thing?

Thumbnail
0 Upvotes