Skip to main content

CredEx AI SDK — Wrap your agent once, every action gets verified, remembered, and anchored.

Project description

CredEx SDK

Wrap your agent once. Every action gets verified, remembered, and anchored.

The CredEx SDK adds consensus verification, persistent memory, and XRPL anchoring to any AI agent. Install it in your agent's runtime — everything that flows through it is automatically verified by 5 independent agents, stored in searchable memory, and anchored to the XRP Ledger with cryptographic proof.

Works like Sentry for errors or Datadog for observability: install the SDK, and your agent's actions are automatically instrumented. No per-action effort required.

Quick Start

pip install credex-sdk
import credex

# Initialize once at startup
credex.init(api_key="credex_your_key_here")

Integration Options

1. Patch OpenAI (Zero-Code Change)

import credex
credex.init(api_key="credex_...")
credex.patch_openai()  # ← One line. Done.

# Every completion is now automatically verified through CredEx
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "What is quantum computing?"}]
)
# ✓ Verified by 5 agents, stored in memory, anchored to XRPL

2. Patch Anthropic

import credex
credex.init(api_key="credex_...")
credex.patch_anthropic()

from anthropic import Anthropic
client = Anthropic()
message = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain XRPL consensus"}]
)
# ✓ Automatically verified

3. LangChain Callback Handler

import credex
from credex.integrations.langchain import CredExHandler

credex.init(api_key="credex_...")
handler = CredExHandler()

# Every LLM call, tool use, and agent action is captured
chain.invoke(input, config={"callbacks": [handler]})

4. Decorator (Any Function)

import credex
credex.init(api_key="credex_...")

@credex.verify
def generate_response(prompt):
    """Output is automatically verified after return."""
    return my_llm.generate(prompt)

@credex.remember
def research(query):
    """Output is stored in CredEx persistent memory."""
    return search_and_summarize(query)

@credex.audit
def critical_action(params):
    """Full audit chain: verify + remember + anchor to XRPL."""
    return execute_critical(params)

5. Direct Client

from credex import CredExClient

client = CredExClient()

# Verify a claim
result = client.verify(
    claim="The XRPL processes 1,500 TPS with 3-5 second finality",
    domain="crypto",
    context="Documentation claim"
)
print(result["verdict"])  # TRUE/FALSE/UNCERTAIN
print(result["confidence"])  # 0.0-1.0
print(result["tx_hash"])  # XRPL anchor

# Store a memory
client.memory_store(
    content="User prefers Python examples over JavaScript",
    category="preference",
    importance=0.8
)

# Search memories
memories = client.memory_search("user language preferences")

Configuration

credex.init(
    api_key="credex_...",          # Or set CREDEX_API_KEY env var
    base_url="https://credexai.live",  # Default
    verify_level="milestones",     # "all", "milestones", "sample", "none"
    auto_anchor=True,              # Anchor verified results to XRPL
    auto_memory=True,              # Store results in persistent memory
    sample_rate=0.1,               # For verify_level="sample" — verify 10%
    verbose=False,                 # Print SDK activity to stderr
    agent_name="my-agent",         # Name in CredEx logs
)

Verify Levels

Level Behavior Use Case
"all" Verify every action Maximum trust, higher latency
"milestones" Verify tool calls, chain ends, agent finishes Balanced (default)
"sample" Randomly verify N% of actions High-volume, cost-sensitive
"none" Memory only, no verification Logging/memory without verification

How It Works

Your Agent Code
      ↓
CredEx SDK (intercepts LLM calls / actions)
      ↓ POST /mcp (JSON-RPC)
CredEx Platform
      ├── 5 Verifier Agents (consensus vote)
      ├── Persistent Memory (semantic search)
      └── XRPL Anchoring (cryptographic proof)
      ↓
Original response returned unchanged

The SDK never modifies your agent's responses. It observes the output after the LLM returns, routes it to CredEx for verification and storage, and returns the original response to your code. The verification happens synchronously by default (so you know the result), but your agent's behavior is unchanged.

What You Get

  • Verified outputs: 5 independent verifier agents evaluate every output. A TRUE verdict with cryptographic proof means the output cannot be dismissed as hallucination.
  • Persistent memory: Every action is stored in searchable, semantic memory. Your agent remembers across sessions, restarts, and deployments.
  • XRPL anchoring: Verified results are anchored to the XRP Ledger with a transaction hash. Immutable proof that a specific output was verified at a specific time.
  • Trust score: Your agent builds a trust score over time based on verification results. Higher trust = more marketplace visibility and earning potential.

Environment Variables

Variable Description
CREDEX_API_KEY Your CredEx API key (alternative to passing in code)
CREDEX_URL CredEx server URL (default: https://credexai.live)
CREDEX_AGENT_NAME Agent name for CredEx logs

Get an API Key

  1. Go to credexai.live
  2. Sign up / sign in
  3. Navigate to Settings → API Keys
  4. Generate a key (starts with credex_)

Or register programmatically via auth.md.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

credex_sdk-0.3.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

credex_sdk-0.3.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file credex_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: credex_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for credex_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 eec879e7e63710313b3283681dedc98f2ae51d7ffd4970ea84b347e4e408e6b6
MD5 846995509660df36a5902f7e7c9558fc
BLAKE2b-256 b797e1538e3bd5f4d12431236291e61dc7ae04a16e09f9598131dc58b457231a

See more details on using hashes here.

File details

Details for the file credex_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: credex_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for credex_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddfc5db4950b2d4565f33789092251b0fd462af0e3ed7159bdc9081228532ed0
MD5 5650d76b986956f420606c3271d7367c
BLAKE2b-256 af1800d6da87faba7413406c6a15a8187a135b19477cade70d6f88d4ed018d4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page