r/LangChain • • 20h 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 • • 17h 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 • • 8h 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 • • 7h 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 • • 22h 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 • • 23h 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 • • 23h ago

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

Thumbnail reddit.com
3 Upvotes