Reliable LangChain agents with persistent memory and automatic recovery from failures.
Wraps any LangChain chain with step-level checkpointing, heuristic verification, and automatic retry. Runs fully locally with Ollama โ no API keys required.
A 100-step agent pipeline crashes at step 70. Without checkpointing you lose everything and pay to redo it. With AgentVault:
FASE 1 โ Interrupted at step 7 of 12
Vanilla: ๐ฅ Lost all progress. 7 API calls wasted.
ReliableAgent: ๐ฅ 7 checkpoints saved to SQLite.
FASE 2 โ Resuming
Vanilla: Starts from 0 โ 12 more calls (19 total)
ReliableAgent: Resumes from step 8 โ 5 more calls (12 total)
โญโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโฎ
โ โ Vanilla โ ReliableAgent โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโค
โ Total API calls โ 19 โ 12 โ
โ Calls saved โ โ โ 7 (37% less) โ
โ State after crash โ Lost all โ 7 steps in SQLiteโ
โฐโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโฏ
Run the demo: python3 demo_interruption.py
Resilience benchmark โ 30 steps with 30% injected failure rate:
| Metric | Vanilla | ReliableAgent |
|---|---|---|
| Completion rate | 56.7% | 96.7% |
| Failed steps | 13 | 1 |
| Recovery rate | โ | 92% |
- LangChain โ agent/chain abstraction
- Ollama โ local LLM inference (no API keys)
- OpenViking โ persistent context database (auto-detected)
- SQLite โ fallback storage when OpenViking is not available
- Superpowers โ agentic skills framework (inspiration)
pip install -e .Pull a model:
ollama pull llama3.2 ollama serve
from langchain_ollama import OllamaLLM from langchain_core.prompts import PromptTemplate from langchain_core.output_parsers import StrOutputParser from core import ReliableAgent llm = OllamaLLM(model="llama3.2") chain = PromptTemplate.from_template("Answer: {input}") | llm | StrOutputParser() agent = ReliableAgent(chain=chain, session_id="my_session", max_retries=2) result = agent.run_steps([ {"input": "What is 2+2?"}, {"input": "Name the planets in the solar system."}, ]) print(result)
If the run is interrupted, re-running with the same session_id resumes from the last successful step automatically.
Injects 30% failure rate per step (timeouts, connection resets, empty responses) with a fixed seed:
python -m benchmarks.run_benchmark_flaky
30 arithmetic/factual steps, vanilla vs ReliableAgent:
python -m benchmarks.run_benchmark
python examples/simple_agent.py
core/
agent.py # ReliableAgent โ wraps any LangChain chain
memory.py # OpenViking + SQLite persistence layer
verifier.py # Heuristic step verification (no model calls)
benchmarks/
run_benchmark.py # Basic 30-step benchmark (Ollama)
run_benchmark_flaky.py # Resilience benchmark with injected failures
run_benchmark_portfolio.py # 20-step financial analysis (Ollama)
run_benchmark_portfolio_claude.py # Same benchmark with Claude API
examples/
simple_agent.py # Minimal working demo
demo_interruption.py # Crash + recovery demo (shows the core value prop)
run_steps(steps)
โ
โโ Resume from last checkpoint (if any)
โ
โโ For each step:
โโ chain.invoke(step_input)
โโ Verifier.verify(result, history) โ no model call
โ โโ empty output? โ retry
โ โโ loop detected? โ retry
โ โโ inconsistent? โ retry
โโ Save to memory (OpenViking or SQLite)
โโ If max_retries exceeded โ mark failed, continue
- volcengine/OpenViking โ context database for AI agents
- obra/superpowers โ agentic skills framework