Skip to content

v0.1.0 — Initial release: Self-Validating Agent Graph

Latest

Choose a tag to compare

@ahmedbutt2015 ahmedbutt2015 released this 21 Apr 21:21

First public release of LangValidator — a LangGraph pipeline where every agent output passes through a checkpoint node that scores it and decides whether to pass, retry with feedback, or halt.

What's included

Graph

  • AgentState TypedDict with query, conversation history, score, retry counter, halt state
  • retrieval_agent and reasoning_agent nodes (Claude Haiku)
  • checkpoint_node that scores each output and writes validation feedback
  • halt_node and finalize_node as terminal states
  • StateGraph with conditional edges and retry loops (pass ≥ 0.75, retry 0.45–0.75, halt < 0.45)

Validators

  • Rule-based — deterministic scoring across length, keyword overlap, placeholders, and toxic language patterns
  • LLM-as-judge — Claude Haiku rates output 0–10 with a rubric, normalized to 0.0–1.0
  • Semantic — cosine similarity helper that takes any embedding function

MCP-style tools

  • Fact-check — checks output statements against a knowledge base
  • Schema-check — validates output as JSON with required keys, types, non-empty constraints

Examples

  • examples/run_rule_based.py — full pipeline with rule-based scorer
  • examples/run_llm_judge.py — full pipeline with LLM-as-judge scorer
  • examples/standalone_validators.py — validators and tools standalone, no API key needed

Tests

  • 18 unit tests covering all validators and tools
  • All tests pass without an API key

Quickstart

pip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-...
python main.py --query "What is LangGraph?" --strategy llm_judge

Feedback welcome

This is my first open-source agent and I am actively looking for feedback and collaborators. Open an issue or discussion with suggestions, critiques, or ideas for what to build next.