← Back to Blog
Tutorial · SDK · Integration

Integrating Governance in 5 Minutes with the Python SDK

Step-by-step guide to installing the EVE Governance SDK, making your first verification call, and handling veto responses in your AI pipeline.

D
Integrating Governance in 5 Minutes with the Python SDK

Adding governance to an existing AI application shouldn't require rearchitecting your entire stack. The EVE Governance Python SDK is designed to be a single function call between your model's output and your user's screen. In this guide, we'll go from zero to a fully governed AI pipeline in under five minutes.

Step 1: Install the SDK

The SDK is published on PyPI and has zero heavy dependencies. Install it with pip:

# Install the EVE CoreGuard SDK
pip install eve-coreguard

The package includes the governance client, response types, and helper utilities. It requires Python 3.9+ and has zero required dependencies — it uses only the Python standard library for HTTP transport, and integrates with OpenAI, Anthropic, Google, Hugging Face, or any custom model pipeline.

Step 2: Initialize the Client

You'll need an API key from your EVE AI Core dashboard. The client handles authentication, connection pooling, and automatic retry with exponential backoff.

from eve_coreguard import CoreGuardClient

# Initialize with your API key
client = CoreGuardClient(
    api_key="eve_sk_your_api_key_here"
)

API keys: Generate your key at api.eveaicore.com/dashboard. Keys are scoped to your organization and include rate limits based on your plan tier. Free tier includes 10,000 verification calls per month.

Step 3: Verify an AI Output

The core API is a single method: verify(). Pass in the AI's output text, the model's confidence, and the content domain, and get back a structured governance result from the 8-stage enforcement pipeline.

# Verify an AI-generated response
result = client.verify(
    ai_output="Based on clinical trials, this medication reduces symptoms by 73%.",
    confidence=0.9,
    domain="medical"
)

print(result.blocked)  # True / False (a veto fired)
print(result.crd)      # 0.0 - 1.0 (Confidence-Reality Divergence score)
print(result.veto.type)    # "pass", "hard_veto", "charter", ...
print(result.veto.reason)  # human-readable explanation when blocked

Step 4: Handle the Verdict

The verify() method returns a VerifyResult with a binary disposition plus the full evidence chain:

(For action/decision governance — where an output can be modified rather than only allowed or blocked — use client.evaluate(), which returns an ALLOWED / MODIFIED / BLOCKED decision certificate.)

if result.blocked:
    # Do not send. Log the reason and regenerate.
    log_governance_event(
        reason=result.veto.reason,
        veto_type=result.veto.type,
        crd=result.crd
    )
    # Optionally regenerate with stricter prompting
    regenerated = regenerate(user_query)

else:
    # Cleared the pipeline — safe to send
    send_to_user(ai_output)
    print(f"CRD score: {result.crd}")

Complete Working Example

Here's a complete example that wraps an OpenAI call with EVE governance:

from openai import OpenAI
from eve_coreguard import CoreGuardClient

openai_client = OpenAI(api_key="sk-...")
gov_client = CoreGuardClient(api_key="eve_sk_...")

def governed_chat(user_message: str) -> str:
    # 1. Generate with your model
    completion = openai_client.chat.completions.create(
        model="gpt-4",
        messages=[{"role": "user", "content": user_message}]
    )
    ai_output = completion.choices[0].message.content

    # 2. Verify with EVE governance
    result = gov_client.verify(
        ai_output=ai_output,
        domain="general"
    )

    # 3. Handle the disposition
    if result.blocked:
        return "I need to rephrase that. Let me try again."
    else:
        return ai_output

# Use it
response = governed_chat("What medication should I take for headaches?")
print(response)

That's it. Three lines of governance code wrapping your existing AI pipeline. The SDK handles charter evaluation, CRD scoring, evidence lookup, and verdict generation — all in a single API call that typically completes in under 50 milliseconds.

What Happens Behind the Scenes

When you call verify(), the SDK sends the text and context to the EVE governance API. On the server side, the request passes through the full Three-Plane Architecture:

The result object includes the blocked/passed disposition, the CRD score, the veto type and reason, the per-stage evidence chain, and a verification ID for audit trail queries. Full API documentation is available at api.eveaicore.com.

Five minutes from install to governed AI. No architecture changes required.

End
Python SDK Tutorial AI Governance Integration Quick Start API Developer Tools