Metadata-Version: 2.4
Name: secondopinion-x402
Version: 0.2.1
Summary: Adversarial verification for AI agents: pay an independent skeptic per verdict in USDC via x402. LangChain, CrewAI and OpenAI Agents SDK tools included; free trial needs no wallet.
Author-email: Second Opinion <secondopinionx402@gmail.com>
License: MIT
Project-URL: Homepage, https://secondopinionx402.com
Project-URL: Documentation, https://secondopinionx402.com/llms.txt
Project-URL: Benchmark, https://secondopinionx402.com/benchmark
Keywords: ai-agents,verification,fact-checking,x402,micropayments,langchain,crewai,usdc
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: x402[evm]>=2.16.0
Requires-Dist: requests>=2.31
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.2; extra == "langchain"
Provides-Extra: crewai
Requires-Dist: crewai>=0.30; extra == "crewai"
Provides-Extra: openai-agents
Requires-Dist: openai-agents>=0.1; extra == "openai-agents"

# Second Opinion for Python agents (LangChain · CrewAI · anything)

Give your agent a paid, independent skeptic: before acting on a claim, it
buys an adversarial verification ($0.02–$0.75 in USDC via x402 — no account,
no API key) and gets a structured verdict with calibrated confidence,
citations, and a signed offline-verifiable receipt.

## Setup (~5 minutes)

```bash
pip install secondopinion-x402
```

1. Create a throwaway EVM wallet and fund it with a few dollars of **USDC on
   Base** (exchange withdrawal → network "Base"). No ETH needed — payments
   are gas-free for you; the facilitator covers it. Keep only pocket money in it.
2. `export SECOND_OPINION_PRIVATE_KEY=0x…` — the key signs payments locally
   and **never leaves your machine**.

## Try it first — no wallet

```python
from secondopinion import SecondOpinionClient

so = SecondOpinionClient()          # no key needed for the free trial
v = so.try_free("The Model Context Protocol uses JSON-RPC 2.0")
```

Free trial is rate-limited per caller per day and returns unsigned verdicts.

## Plain Python (paid)

```python
so = SecondOpinionClient()                       # default tier: quick ($0.02)
v = so.verify("Library X v3 supports streaming natively",
              context="About to build a day's work on this")
if v["verdict"] == "refuted":
    ...  # stop and re-plan; v["findings"] says why, v["citations"] has sources
```

## LangChain

```python
from secondopinion import langchain_tool
tools = [langchain_tool()]          # requires langchain-core
# or: langchain_tool(tier="verify") to default to web-researched verdicts
```

## CrewAI

```python
from secondopinion import SecondOpinionCrewTool
tools = [SecondOpinionCrewTool()]   # requires crewai
```

## OpenAI Agents SDK

```python
from secondopinion import openai_agents_tool
agent = Agent(..., tools=[openai_agents_tool()])   # requires openai-agents
```

## What comes back

`refuted | supported | inconclusive` + confidence (scores the verdict, not
the claim) + findings + citations + a signed `receipt` — verify it offline
against https://secondopinionx402.com/.well-known/second-opinion-pubkey.json
for a tamper-evident audit trail. Measured accuracy, failures included:
https://secondopinionx402.com/benchmark

Tiers: `quick` $0.02 reasoning-only (~20s) · `verify` $0.20 live web research
(~60s) · `panel` $0.75 three skeptics, majority vote. You are never charged
for failed requests; failed async jobs retry free.

Status: core client and LangChain adapter are payment-tested against
production; the CrewAI adapter is a thin wrapper of the same client
(import-guarded) — report anything odd and it'll be fixed fast.
