LangSmith alternative
LangSmith traces every node. RunGuard stops the loop before node 4 fires.
If your team runs LangChain or LangGraph agents and needs a runtime circuit breaker — something that detects a repeating tool-call pattern and halts the agent mid-run before the 20th LLM call goes out — RunGuard fills the gap without touching your existing LangSmith tracing setup.
Why teams look for a LangSmith alternative
- LangSmith callbacks are notifications, not gates. LangSmith instruments your agent via LangChain's
CallbackManager—on_tool_start,on_llm_start,on_agent_action. These fire after each event completes and send data to LangSmith. They cannot return a value that halts the next node. Raising inside a callback is caught by LangChain's callback runner, not propagated. LangSmith sees the loop; it cannot stop it. - LangSmith is tied to the LangChain ecosystem. If you are using raw Anthropic SDK, OpenAI SDK, or any non-LangChain agent framework, LangSmith's deep integrations do not apply. You would need to add LangSmith tracing manually or use the
@traceabledecorator, which still gives you post-call logging, not pre-call prevention. RunGuard wraps any async function — no framework dependency. - Trace cost scales fast with loop volume. LangSmith charges per trace on the Plus plan. A runaway agent that loops 50 times before timing out generates 50 traces. RunGuard trips at turn 3, so you pay for 3 traces instead of 50 — and your LLM bill is also 3 calls instead of 50.
Feature comparison
| LangSmith | RunGuard | |
|---|---|---|
| Pre-call loop detection (halts before next call) | ✗ | ✓ |
| Per-run USD budget cap | ✗ | ✓ |
| Context-window overrun guard | ✗ | ✓ |
| Works with non-LangChain frameworks | Limited | ✓ |
| Post-run trace replay | ✓ | ✗ |
| Evaluation datasets and scoring | ✓ | ✗ |
| Prompt hub and versioning | ✓ | ✗ |
| Starting price | Free developer / $39/seat/mo Plus | $0 trial / $19/mo Solo |
How RunGuard is different
The core distinction is where in the call stack each tool sits. LangSmith's LangChainTracer lives inside CallbackManager, one layer above your LLM client, and its callbacks fire post-call. RunGuard's guard() wrapper sits one layer below CallbackManager — below the LangChain stack entirely — and fires pre-call. For a LangGraph agent, the composition is:
// TypeScript — RunGuard below traceable() in the call chain import { guard } from "@runguard/sdk" import { traceable } from "langsmith/traceable" const innerFn = async (msg: string) => anthropic.messages.create({ ... }) // guard() is below traceable() — pre-call gate first const safeFn = traceable(guard(innerFn, { repeats: 3, maxCycleLen: 8, maxUsd: 5 })) // LangSmith traces every call RunGuard allows; RunGuard throws on loops.
When RunGuard trips, LangSmith traces the LoopDetectedError — a useful signal in your evaluation dataset. When RunGuard does not trip, LangSmith traces the successful call. Neither tool needs to know the other exists.
When LangSmith is still the right choice
If you are building LangChain or LangGraph agents and your primary need is trace visibility, eval dataset management, prompt hub access, or online evaluation pipelines — LangSmith is the best tool in that space. Its integration with LangGraph's streaming APIs, its annotation queues, and its LangChain Hub for prompt sharing are mature and production-tested. If you need to debug why an agent made certain decisions by replaying its trace, LangSmith's trace explorer is excellent. RunGuard is not a tracing tool and will not replace those capabilities.
FAQ
- Does RunGuard work with LangGraph's
recursion_limit? recursion_limitis a step counter — it halts the graph after N total steps regardless of pattern. RunGuard detects repeating call signatures (the same tool, same arguments, same context slice) and trips at the Nth repetition, not the Nth total step. A legitimate 30-step research agent will not trigger RunGuard if its tool calls are diverse; a looping 10-step agent will trigger it at step 3 of the repeated pattern. The two mechanisms are complementary — RunGuard catches pattern loops;recursion_limitcatches runaway long graphs.- Can I use RunGuard without LangSmith?
- Yes. RunGuard has no dependency on LangSmith or LangChain. It wraps any async function that calls an LLM. If you use raw Anthropic SDK, OpenAI SDK, or Mistral, RunGuard works identically.
- What is the overhead of adding RunGuard to a LangGraph node?
- RunGuard's check is an in-memory hash lookup — typically under 0.5ms per call. It does not add a network round-trip. The overhead is negligible compared to a 200–2000ms LLM API call.