v0.6Shared Redis budgets, OTel export, and in-process fallback chains are liveRead changelog

14-day open test

Guardrails for every agent, before the request leaves your process.

What it is: Backstop replaces the SDK's internal httpx transport with a controlled pipeline — token budgets, priority admission, AIMD concurrency, retries, and circuit breaking.

Who it's for: Developers building multi-agent systems with OpenAI or Anthropic SDKs who need reliability without adding a network hop.

Why it's different: Guardrails are enforced before any request leaves your app. No proxy. No monkey-patching.

Design goals

In-process guardrails, measured in microseconds — not network hops.

0 hops
Network overhead
0 line
Drop-in wrap()
0×
Runaway-cost surface with N agents
Works with
OpenAIsync + async
Anthropicsync + async
httpxtransport
Python 3.10+native
Node.jsTypeScript SDK
Redisshared budget
Prometheusmetrics
OpenAIsync + async
Anthropicsync + async
httpxtransport
Python 3.10+native
Node.jsTypeScript SDK
Redisshared budget
Prometheusmetrics
OpenAIsync + async
Anthropicsync + async
httpxtransport
Python 3.10+native
Node.jsTypeScript SDK
Redisshared budget
Prometheusmetrics
OpenAIsync + async
Anthropicsync + async
httpxtransport
Python 3.10+native
Node.jsTypeScript SDK
Redisshared budget
Prometheusmetrics
OpenTelemetryOTLP export
Datadogvia OTel
Honeycombvia OTel
CloudWatchvia OTel
LiteLLMbenchmarked
BricksLLMbenchmarked
MIT Licenseopen source
GitHubrepository
OpenTelemetryOTLP export
Datadogvia OTel
Honeycombvia OTel
CloudWatchvia OTel
LiteLLMbenchmarked
BricksLLMbenchmarked
MIT Licenseopen source
GitHubrepository
OpenTelemetryOTLP export
Datadogvia OTel
Honeycombvia OTel
CloudWatchvia OTel
LiteLLMbenchmarked
BricksLLMbenchmarked
MIT Licenseopen source
GitHubrepository
OpenTelemetryOTLP export
Datadogvia OTel
Honeycombvia OTel
CloudWatchvia OTel
LiteLLMbenchmarked
BricksLLMbenchmarked
MIT Licenseopen source
GitHubrepository
Why Backstop

SDK-native guardrails that live inside your process.

Proxy gateways add latency, a single point of failure, and network complexity. Backstop takes a third path: transport-layer isolation with no network hop. Here's how it solves core reliability problems for AI engineers.

Token budgets

Reserve before dispatch. Reconcile after response.

Hard token limits enforced at the transport layer. Priority admission (critical / default / background) with starvation prevention keeps latency-sensitive calls flowing while background work waits its turn.

example.py
from openai import OpenAI
from backstop import Backstop

client = Backstop.wrap(OpenAI(), budget=50_000)

# Use the client exactly as before —
# Backstop intercepts at the transport layer.
response = client.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[{"role": "user", "content": "Hello."}],
)
Circuit breaker + AIMD

Adapt to provider pressure. Fail closed on sustained errors.

Additive-increase / multiplicative-decrease concurrency reacts to 429s and 5xxs the way TCP reacts to loss. When failures pile up, the breaker trips, cools down, and probes for recovery — no retry storms, no thundering herds.

example.py
from backstop import Backstop, BackstopConfig

client = Backstop.wrap(
    OpenAI(),
    budget=50_000,
    config=BackstopConfig(
        # In-process fallback on sustained failure —
        # no proxy, no extra infra.
        fallback_chain=[
            {"model": "gpt-4o-mini"},
            {"model": "claude-sonnet-4-20250514",
             "base_url": "https://backup.example.com/v1"},
        ],
    ),
)
Wedge · multi-agent diff CLI

Run N isolated agents. Diff the output. Prove convergence.

Wedge runs N coding agents against the same task — each wrapped in its own Backstop session with an independent budget and kill-switch — then scores patch similarity across every runner. CONVERGED, PARTIAL, or DIVERGED.

example.py
# task.yaml
name: "Refactor to class-based"
prompt: "Refactor main.py to use a class-based approach."
test_command: "pytest tests/"
runners: 3
provider: "anthropic"

# $ wedge run task.yaml
# Convergence Summary:
#   main.py: CONVERGED (sim=1.00)
Shared budgets + metrics

One cap across replicas. Metrics your ops team already reads.

Enforce a single token budget across processes and replicas via atomic Redis Lua scripts — zero admin. Export every series to Prometheus and OpenTelemetry so Datadog, Honeycomb, or CloudWatch pick it up unchanged.

example.py
client = Backstop.wrap(
    OpenAI(),
    budget=1_000_000,
    config=BackstopConfig(
        shared_budget=True,
        redis_url="redis://localhost:6379",
        otel_enabled=True,
    ),
)

# N replicas cannot overspend one cap
# beyond tolerance — enforced atomically.
Third path

Not a proxy. Not a wrapper. A transport.

Backstop plugs into the SDK's native httpx transport — no monkey-patching, no MCP layer, no observability platform. Protocol-agnostic and drop-in for any client that speaks httpx or requests.

  • Not a proxy or gateway
  • Not an MCP tool
  • Not an observability platform
  • Not an application-layer signal reader
  • Transport-layer only, in-process
Dimension
Backstop
Proxy gateway
No protection
Network hop
None — in-process
Extra service, extra RTT
None
Single point of failure
No
Yes — the proxy
No
Runaway spend protection
Reserve · dispatch · reconcile
Enforced at proxy
Hope the agent stops
Cross-replica budget
Atomic Redis Lua
Central proxy state
Multi-agent isolation
One session per agent
Shared queue
Metrics export
Prometheus + OTel
Depends on vendor
Setup
Backstop.wrap(client)
Deploy, route, monitor
Principles
The hypothesis
1 / 3
Transport-layer budget isolation becomes critical infrastructure when you go from 1 agent to N agents.
Backstop thesisdocs/deep-research-10x-better
FAQ

Common guardrail questions.

Everything you need to know about budgets, retries, circuit breakers, and observability—without adding another proxy to your stack.

Backstop wraps the SDK client and intercepts calls at the httpx transport layer. Before a request is dispatched, it reserves the estimated token cost against a local or Redis-backed budget. After the response returns, it reconciles actual usage. Because everything happens in-process, there is no extra network hop or single point of failure.

wedge · run task.yaml
Wedge tool  (isolated multi-agent diff CLI)
 │
 ├──► Runner A  Backstop.wrap(Anthropic(), budget=20_000)
 ├──► Runner B  Backstop.wrap(Anthropic(), budget=20_000)
 └──► Runner C  Backstop.wrap(Anthropic(), budget=20_000)

    (each runner = one Backstop session,
     own budget, own kill-switch —
     isolated CONTEXT, not isolated INFRA)

$ wedge run task.yaml
  Running task: Refactor to class-based
  Comparing patches...
  Done! Report saved to wedge_report.md

  Convergence Summary:
    main.py: CONVERGED (sim=1.00)
Python 3.10+MIT14-day test

Ship multi-agent code without ripping out your SDK.

One line to wrap your client. Independent budgets and kill-switches per agent. Metrics your ops team already knows how to read.

Install Backstop

Currently in the 14-day open test. Report issues on GitHub.

Python

Anthropic, OpenAI, sync + async — Python 3.10+.

Quick StartREADME

TypeScript

Drop-in wrap() for Node.js agents.

TypeScript SDKts/backstop

Extras

Shared budgets, OTel export, and CLI tooling.