Metadata-Version: 2.5
Name: langchain-truthbear
Version: 0.1.1
Summary: LangChain tools for Truth Bear GAUGE official-source signal data
Project-URL: Homepage, https://truthbear.co
Project-URL: Documentation, https://github.com/CHANGCHINFU/langchain-truthbear#readme
Project-URL: Repository, https://github.com/CHANGCHINFU/langchain-truthbear
Project-URL: Issues, https://github.com/CHANGCHINFU/langchain-truthbear/issues
Project-URL: Changelog, https://github.com/CHANGCHINFU/mcp-gauge/blob/main/CHANGELOG.md
Author: TruthBear
License-Expression: MIT
License-File: LICENSE
Keywords: fact-checking,gauge,langchain,official-data,truthbear,x402
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <3.15,>=3.10
Requires-Dist: langchain-core<2.0.0,>=1.4.7
Description-Content-Type: text/markdown

# langchain-truthbear

LangChain tools for [Truth Bear GAUGE](https://truthbear.co), a pay-per-call source of
official-record signals (US federal agencies and named registries) with Bitcoin-anchored receipts.

## Installation

```bash
pip install langchain-truthbear
```

No API key, no account, no signup for the free tools.

## Tools

| Tool | Cost | Purpose |
| ---- | ---- | ------- |
| `TruthBearPreview` | free | Quick fact-check: look up one data point from 180+ official sources — returns signal, value, source URL, record hash, freshness |
| `GaugeCoverage` | free | Does a signal line exist, how many objects, how fresh, is the source agency on schedule |
| `GaugeCatalog` | free | Which entity ids are valid for a signal line — filter by `signal_id` or `industry` (one required) |
| `GaugeRecord` | paid (x402) | Requests one official record; returns the HTTP 402 payment challenge untouched |

## Quick start

```python
from langchain_truthbear import TruthBearPreview

tool = TruthBearPreview()
print(tool.invoke({"query": "US unemployment rate"}))
# Signal: macro.unemployment
# Value: 3.7%
# Source: https://fred.stlouisfed.org/series/UNRATE
# Record Hash: a1b2c3...
# Freshness: 2026-08-30T12:00:00Z
```

## With an agent

```python
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_truthbear import TruthBearPreview, GaugeCoverage, GaugeCatalog

tools = [TruthBearPreview(), GaugeCoverage(), GaugeCatalog()]
# ... set up your agent with these tools
```

## Design notes

- **Standard library only** — no dependency beyond `langchain-core`.
- **No money moves here.** `GaugeRecord` returns the x402 challenge untouched; settling it is the
  caller's own wallet's job.
- **The catalog filter is required.** The unfiltered response is ~1.5 MB — too large for an agent's
  context — so a call with neither `signal_id` nor `industry` is rejected.
- **A miss is not an error.** An unknown `signal_id` returns `{"found": false}` rather than raising.
- Every paid record ships a canonical sha256 `record_hash` that can be recomputed offline.
- **Screening-level only** — not decision-grade verification.
