Docs/Overview/Getting Started

Getting Started

Create a project, generate an API key, and make your first policy-evaluated request in under five minutes.

Beginner5 min readUpdated June 2026
GatewaySDK
$pip install governance-ai
SDK Reference

This guide walks you through connecting your first application to the GovernanceAI gateway. You will have a working integration in under five minutes.

PrerequisitesPython 3.9+ or Node.js 18+. The gateway must be running locally (port 8000) or you must have a GovernanceAI Cloud endpoint URL.

1. Install the SDK

1

Install

Install the GovernanceAI client library for your language.
pip install governance-ai

2. Create an organization and project

2

Create your organization

Log in to the dashboard and create an organization. Organizations are the top-level billing and access-control boundary.
3

Create a project

Inside your organization, create a project. A project maps to a single application or environment (e.g. production, staging). Each project has its own API keys and security profiles.

3. Generate an API key

4

Create an API key

Navigate to Project → API Keys → New Key. Copy the key — it will not be shown again. Store it in an environment variable:
export GOVERNANCE_API_KEY="gov_live_xxxxxxxxxxxx"

4. Make your first request

5

Send an evaluated prompt

from governance_ai import GovernanceClient

client = GovernanceClient(api_key="gov_live_xxxx")

result = client.evaluate(
    prompt="Summarize the latest earnings report.",
    provider="openai",
    model="gpt-4o",
    security_profile="strict",
)

print(result.decision)       # "allow" | "block" | "warn"
print(result.risk_score)     # 0.0 – 1.0
print(result.response)       # model output (if allowed)

Understanding the response

Every evaluation returns a structured decision object:

{
  "decision": "allow",
  "risk_score": 0.03,
  "flags": [],
  "policy_matched": null,
  "trace_id": "trc_8f3a9d",
  "latency_ms": 14,
  "response": {
    "content": "Q1 revenue grew 18% YoY..."
  }
}
Trace IDsEvery response includes a trace_id. Use this in the Observability dashboard to replay and inspect the full evaluation chain for any request.

Next steps

You are now sending policy-evaluated requests. From here you can configure security profiles, add SDK middleware to your existing AI framework, or explore the full API reference.

Related documentation