Metadata-Version: 2.4
Name: nexus-langchain
Version: 1.0.0
Summary: NEXUS AI market intelligence tools for LangChain — signals, Kalshi markets, wallet AML
Project-URL: Homepage, https://nexus-agent-xa12.onrender.com
Project-URL: Repository, https://github.com/RileyCraig14/nexus-agent
Project-URL: Bug Tracker, https://github.com/RileyCraig14/nexus-agent/issues
Author-email: RileyCraig14 <rileycraig14@gmail.com>
License: MIT
Keywords: ai-agents,bitcoin,crypto,defi,kalshi,langchain,market-signals,mcp,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.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Requires-Dist: langchain-core>=0.2.0
Requires-Dist: requests>=2.28.0
Provides-Extra: autopay
Requires-Dist: x402>=0.1.0; extra == 'autopay'
Description-Content-Type: text/markdown

# nexus-langchain

NEXUS AI market intelligence tools for LangChain agents.

[![BTC Signal](https://nexus-agent-xa12.onrender.com/badge/BTC)](https://nexus-agent-xa12.onrender.com)
[![PyPI](https://img.shields.io/pypi/v/nexus-langchain)](https://pypi.org/project/nexus-langchain/)

## Install

```bash
pip install nexus-langchain
```

## Quick start (free tools — no wallet needed)

```python
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate
from nexus_langchain import get_nexus_tools

llm = ChatOpenAI(model="gpt-4o")
tools = get_nexus_tools(include_paid=False)  # Kalshi, Reputation, DNS — free

prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a financial analyst. Use NEXUS tools to answer questions."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])

agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)
result = executor.invoke({"input": "What does Kalshi say about the Fed's next rate decision?"})
print(result["output"])
```

## Paid tools (market signals, wallet AML, web search)

Paid tools cost $0.001–$0.15 USDC per call via x402 on Base mainnet. Three ways to pay:

### Option 1: Automatic micropayments (recommended)
```bash
pip install nexus-langchain[autopay]
export WALLET_PRIVATE_KEY=0x...   # Base mainnet wallet with USDC
```

### Option 2: Manual payment header
```bash
export NEXUS_PAYMENT_HEADER=<your-x402-payment-proof>
```

### Option 3: See 402 response and pay once
Without a wallet, paid tools return payment details:
```json
{
  "payment_required": true,
  "price_usdc": 0.05,
  "pay_to": "0xc91cE6291eDC0713ec753BAFBA002506ffb2b95c",
  "network": "eip155:8453"
}
```

## All tools

```python
from nexus_langchain import (
    # Paid ($0.001–$0.15 USDC)
    NexusMarketSignal,   # BTC/ETH/SOL signal: BULLISH/BEARISH/NEUTRAL
    NexusAggregate,      # CoinGecko + QuantOracle + Kalshi consensus
    NexusWalletAML,      # AML risk score for any EVM/Solana address
    NexusSentiment,      # Sentiment: positive/negative/neutral
    NexusSearch,         # Web search + AI summary

    # Free (no payment needed)
    NexusKalshi,         # Kalshi prediction market consensus
    NexusReputation,     # Agent trust score 0-100
    NexusDNS,            # Route capability to best provider
)
```

## Use individual tools

```python
from langchain.agents import AgentExecutor, create_tool_calling_agent
from nexus_langchain import NexusMarketSignal, NexusKalshi, NexusWalletAML

tools = [NexusMarketSignal(), NexusKalshi(), NexusWalletAML()]
# ... pass to your agent as usual
```

## Pricing

| Tool | Price | Payment |
|------|-------|---------|
| `nexus_market_signal` | $0.05 USDC | x402 Base |
| `nexus_aggregate` | $0.15 USDC | x402 Base |
| `nexus_wallet_aml` | $0.001 USDC | x402 Base |
| `nexus_sentiment` | $0.002 USDC | x402 Base |
| `nexus_search` | $0.02 USDC | x402 Base |
| `nexus_kalshi` | **FREE** | — |
| `nexus_reputation` | **FREE** | — |
| `nexus_dns` | **FREE** | — |

Payments go to `0xc91cE6291eDC0713ec753BAFBA002506ffb2b95c` on Base mainnet.

## Links

- API: [nexus-agent-xa12.onrender.com](https://nexus-agent-xa12.onrender.com)
- MCP: `claude mcp add nexus https://nexus-agent-xa12.onrender.com/mcp`
- GitHub: [RileyCraig14/nexus-agent](https://github.com/RileyCraig14/nexus-agent)
