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.1.tar.gz (12.7 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.1-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nullbridge-1.0.1.tar.gz
  • Upload date:
  • Size: 12.7 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.1.tar.gz
Algorithm Hash digest
SHA256 976beeb33b4811d880187c1b15927ccd095e2e3826b718f1f97b86cd5149b1df
MD5 82a6d631f9fca2689e67b93a5063a9c7
BLAKE2b-256 3d1f184c622bea449de98c9e82aaa60cfdf677316863f1f04bd5422b95e66eb8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nullbridge-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c47eecd49dfeead98171cdddef25ab494f7348344cf1787379d37f4158a3b55a
MD5 0984c41a7e9ae7a90cf23e37904743f8
BLAKE2b-256 bfe42be0aac1c6fb86dcfade794bb6eabefa91871deccf4608f2a2721372ddea

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