Skip to main content

Neurop Forge SDK - Execute 5,175+ pre-verified, hash-locked function blocks across 5 domains

Project description

Neurop Forge SDK

Execute 5,175+ pre-verified, hash-locked function blocks across 5 domains — with full audit trail.

Neurop Forge is an AI-native execution control layer. AI agents search, compose, and execute blocks — but never modify them. Every execution is deterministic, cryptographically auditable, and policy-governed.

Installation

pip install neurop-forge-sdk

Quick Start

from neuropforge import NeuropForge

client = NeuropForge(api_key="your_api_key")

# Execute a block by exact name — deterministic, auditable
result = client.execute("to_uppercase", text="hello world")
print(result.result)       # "HELLO WORLD"
print(result.audit_hash)   # cryptographic proof of execution

# Search for blocks by natural language
blocks = client.search("validate email address")
for block in blocks:
    print(f"{block.name} [{block.domain}] — {block.why_selected}")

# Browse domains
for domain in client.domains():
    print(f"{domain.domain}: {domain.block_count} blocks")

Domains

Neurop Forge organizes 5,175+ blocks into 5 domains:

Domain Blocks Examples
data 4,552 String ops, math, validation, collections, date/time
crypto 218 Hashing, wallet generation, gas fee calculation
integrations 164 Webhook triggers, API calls, message formatting
payments 137 Transaction validation, fee calculation, refund processing
auth 104 Token generation, password hashing, permission checks
# List blocks in a specific domain
crypto_blocks = client.domain_blocks("crypto", limit=10)
for block in crypto_blocks:
    print(f"{block.name}: {block.description}")

Async Client

For asyncio-based agent frameworks (LangChain, CrewAI, AutoGen):

from neuropforge import AsyncNeuropForge

async with AsyncNeuropForge(api_key="your_api_key") as client:
    result = await client.execute("calculate_gas_fee", gas_limit=21000, gas_price_gwei=30.5)
    print(result.result)  # 0.0006405

    domains = await client.domains()
    blocks = await client.search("validate payment amount")

LangChain Integration

Use Neurop Forge as a LangChain tool for controlled AI execution:

from langchain.tools import tool
from neuropforge import NeuropForge

client = NeuropForge(api_key="your_api_key")

@tool
def neurop_execute(block_name: str, inputs: dict) -> str:
    """Execute a pre-verified Neurop Forge block. The AI cannot generate
    arbitrary code — it can only call verified blocks by exact name."""
    result = client.execute(block_name, **inputs)
    return str(result.result)

@tool
def neurop_search(query: str) -> str:
    """Search the Neurop Forge library for blocks matching a natural language query."""
    results = client.search(query, limit=5)
    return "\n".join(f"{r.name} [{r.domain}]: {r.why_selected}" for r in results)

CLI

The nf command-line tool is included for testing and exploration:

# Set your API key
export NEUROP_API_KEY="your_api_key"

# Check API health
nf health

# Browse domains
nf domains -v

# List blocks in a domain
nf domain-blocks crypto --limit 10 -v

# Search for blocks
nf search "validate email" -v

# Execute a block
nf exec to_uppercase --input text="hello world"

# Execute with JSON input
nf exec calculate_gas_fee --json '{"gas_limit": 21000, "gas_price_gwei": 30.5}'

# Get library statistics
nf stats

# Verify audit chain integrity
nf audit

API Key Management

from neuropforge import NeuropForge

# Register a new API key (no auth required for this call)
client = NeuropForge(api_key="temp_key")
result = client.register_key(name="My App", email="dev@example.com")
print(result["api_key"])  # Your new API key

# Use the new key
client = NeuropForge(api_key=result["api_key"])

# Get key metadata
info = client.key_info()
print(info)  # {"name": "My App", "email": "dev@example.com", ...}

# Get usage statistics
usage = client.usage()
print(usage)  # {"total_requests": 42, "recent": [...]}

# Rotate key
rotated = client.rotate_key(current_key=result["api_key"])
print(rotated["new_api_key"])

# Revoke key
client.revoke_key()

Configuration

Set your API key via environment variable:

export NEUROP_API_KEY="your_api_key"

Or pass it directly:

client = NeuropForge(api_key="your_api_key")

Custom API endpoint (for self-hosted deployments):

client = NeuropForge(
    api_key="your_api_key",
    base_url="https://your-instance.example.com",
    timeout=60.0
)

API Reference

NeuropForge(api_key, base_url, timeout)

Initialize the sync client. Supports context manager (with).

AsyncNeuropForge(api_key, base_url, timeout)

Initialize the async client. Supports async context manager (async with).

Methods (sync and async)

Method Description Returns
execute(block_name, **inputs) Execute a block by exact name ExecutionResult
search(query, limit) Search blocks by natural language List[SearchResult]
domains() List all domains with block counts List[DomainInfo]
domain_blocks(domain, limit) List blocks in a domain List[BlockInfo]
list_blocks(limit, category) List available blocks List[BlockInfo]
health() Check API health dict
stats() Get library statistics dict
audit_chain() Get audit chain info dict
register_key(name, email) Register a new API key dict
rotate_key(current_key) Rotate an existing API key dict
revoke_key() Revoke the current API key dict
key_info() Get current API key metadata dict
usage() Get usage data for current key dict

Data Classes

  • ExecutionResult: success, block_name, result, execution_time_ms, audit_hash
  • SearchResult: name, domain, operation, why_selected
  • BlockInfo: name, category, description, inputs, domain
  • DomainInfo: domain, block_count, description

Exceptions

  • NeuropForgeError: Base exception
  • BlockNotFoundError: Block doesn't exist
  • ExecutionError: Block execution failed
  • AuthenticationError: Invalid or missing API key
  • RateLimitError: Rate limit exceeded

Why Neurop Forge?

  • Deterministic: Same inputs always produce same outputs
  • Auditable: Every execution has a cryptographic audit hash
  • Secure: AI can only execute verified blocks, never arbitrary code
  • Compliant: Designed for SOC 2, HIPAA, PCI-DSS environments
  • Domain-organized: 5 domains for clear separation of concerns

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

neurop_forge_sdk-2.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

neurop_forge_sdk-2.1.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file neurop_forge_sdk-2.1.0.tar.gz.

File metadata

  • Download URL: neurop_forge_sdk-2.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for neurop_forge_sdk-2.1.0.tar.gz
Algorithm Hash digest
SHA256 ac815fa5ff976e0c467d222ff731bed85bff28bb31617a05221449f505decede
MD5 1237b4b30502e0e71e07511bc9ac4eac
BLAKE2b-256 87f9ebe69ea5384137bf0ba1866247639f767327da8b601b5c7e88cb0d908db3

See more details on using hashes here.

File details

Details for the file neurop_forge_sdk-2.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for neurop_forge_sdk-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09db8978a7bb4975d31770b8a55fbf35712105dbf1ad7a8d15149b4b4705d7d9
MD5 e44cde0f115eaf8a4ffe8f95900291c0
BLAKE2b-256 49fabdb875818244f8a097efc0c4303022a5558567388aaa59dafd800610d7fe

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