Skip to main content

AI Agent Identity Governance — NullBridge Python SDK

Project description

NullBridge Python SDK

AI Agent Identity Governance for Python — give your AI agents a cryptographic identity, credential vault, behavioral anomaly detection, and kill switch in three lines of code.

Installation

pip install nullbridge

Requires Python 3.8+. Zero external dependencies.

Quick Start

from nullbridge import NullBridge
import os

nb = NullBridge(license_key=os.environ["NULLBRIDGE_LICENSE_KEY"])
nb.init()

# Register your agent
agent = nb.agents.register(
    name="fraud-detector",
    type="llm",
    model="gpt-4o",
    scopes=["read:transactions", "write:alerts"],
    metadata={"team": "risk", "environment": "prod"},
)

# Log actions to the audit trail
agent.log_action("analyze_transaction", {"tx_id": "TX-1234", "amount": 5000})

# Check permissions
if not agent.has_scope("write:alerts"):
    raise PermissionError("Agent not authorized")

# Graceful shutdown
nb.shutdown()

Usage with LangChain

from nullbridge import NullBridge
from langchain.agents import initialize_agent

nb = NullBridge(license_key=os.environ["NULLBRIDGE_LICENSE_KEY"])
nb.init()

agent_identity = nb.agents.register(
    name="langchain-research-agent",
    type="llm",
    model="gpt-4o",
    scopes=["read:web", "write:reports"],
)

# Your normal LangChain agent
lc_agent = initialize_agent(tools, llm, agent="zero-shot-react-description")

# Wrap with NullBridge audit logging
def run_with_governance(query):
    agent_identity.log_action("run_query", {"query": query})
    result = lc_agent.run(query)
    agent_identity.log_action("query_complete", {"result_length": len(result)})
    return result

Usage with CrewAI

from nullbridge import NullBridge
from crewai import Agent, Task, Crew

nb = NullBridge(license_key=os.environ["NULLBRIDGE_LICENSE_KEY"])
nb.init()

# Register each CrewAI agent with NullBridge
researcher_identity = nb.agents.register(
    name="researcher",
    type="llm",
    scopes=["read:web"],
)

writer_identity = nb.agents.register(
    name="writer",
    type="llm",
    scopes=["write:reports"],
)

Context Manager

with NullBridge(license_key="NB-XXXX-XXXX-XXXX-XXXX") as nb:
    agent = nb.agents.register(name="my-agent", type="llm")
    agent.log_action("do_something")
# Automatically shuts down and flushes audit logs

Anomaly Detection

nb.anomaly.on_alert(lambda alert: print(f"Anomaly: {alert['metric']} z={alert['z_score']}"))

# Record metrics — NullBridge builds a baseline and alerts on deviations
nb.anomaly.record(agent.id, "api_calls_per_minute", 14)
nb.anomaly.record(agent.id, "tokens_used", 3200)

Environment Variables

export NULLBRIDGE_LICENSE_KEY=NB-XXXX-XXXX-XXXX-XXXX

License

Proprietary — contact brian@nullbridge.ai for licensing.

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

nullbridge-1.0.0.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

nullbridge-1.0.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file nullbridge-1.0.0.tar.gz.

File metadata

  • Download URL: nullbridge-1.0.0.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for nullbridge-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7a119c60e540aadc71fb12c9af506f69e4a2f0fcd74076d2b4ea2dae55fee9ea
MD5 f5c08208e2eec678982ea9a5cbd92133
BLAKE2b-256 5e7ddef11fd9340d2a5e29462bb30dc8749927afab7e2e9d15884425f409851c

See more details on using hashes here.

File details

Details for the file nullbridge-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nullbridge-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for nullbridge-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c39d4c13b4119e3f279e2599ef7af483edda1194d87cc0d114a9e100644f2bcb
MD5 28aa0d9888b06d468f44327bccae4ae0
BLAKE2b-256 be279438bee17f5cd526c2ce1d825dd3caa07d505fd8eb662781c3f969f4f880

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