DEV Community

hhhfs9s7y9-code
hhhfs9s7y9-code

Posted on • Originally published at github.com

NeuralBridge: Self-Healing SDK for LLM-Powered AI Agents - Getting Started in 5 Minutes

What is NeuralBridge?

NeuralBridge is an embedded SDK (not a gateway) that makes your AI agents resilient against LLM failures. It runs inside your Python process — zero infrastructure, zero HTTP proxy, one dependency.

pip install neuralbridge-sdk
Enter fullscreen mode Exit fullscreen mode

Your First Call

import neuralbridge as nb

result = nb.run("Explain quantum computing in one sentence")
print(result.text)
Enter fullscreen mode Exit fullscreen mode

That's it. NeuralBridge auto-discovers your API keys from environment variables and handles multi-provider routing, self-healing, and drift detection automatically.

What Makes It Different?

Self-Healing Engine — When an LLM call fails (timeout, rate limit, bad response), NeuralBridge doesn't just retry. It diagnoses the fault type, degrades gracefully, fails over to another provider, and learns from the experience.

from neuralbridge import SelfHealingEngine

engine = SelfHealingEngine()
result = engine.call("Write a Python function for binary search")

print(result.flight)  # Shows diagnosis, recovery action, latency
print(result.recovered)  # True if self-healing was activated
Enter fullscreen mode Exit fullscreen mode

84.1% of production faults are auto-recovered. 19us diagnosis time P50.

Why Not a Gateway?

Every gateway (LiteLLM, etc.) adds 30-200ms of network latency. NeuralBridge runs in-process, adding zero additional latency.

Approach Latency Dependencies Deployment
Gateway (LiteLLM) +30-200ms Docker + PostgreSQL Ops team
SDK (NeuralBridge) +0ms 1 (httpx) pip install

Key Features

  • 4-Layer Self-Healing: L1 retry -> L2 degrade -> L3 failover -> L4 flywheel
  • 5-Dimension Validation: JSON Schema, semantic, entity, taboo, composite
  • Multi-Provider Routing: DeepSeek, OpenAI, Anthropic, and 12+ more
  • Drift Detection: Catch model regressions before users do
  • Carbon Tracking: Per-provider carbon footprint per call
  • Open Core: Apache 2.0 license, 375 KB install size

See It in Action

import neuralbridge as nb

result = nb.run("Hello", providers=["openai", "deepseek"])
print(f"Used provider: {result.provider}")
print(f"Self-healed: {result.recovered}")
print(f"Latency: {result.latency_ms}ms")
Enter fullscreen mode Exit fullscreen mode

Learn More

pip install neuralbridge-sdk
Enter fullscreen mode Exit fullscreen mode

NeuralBridge is open source (Apache 2.0). Pro features available under commercial license.

Top comments (0)