Skip to content

Levaj2000/AI-Identity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

688 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Identity

CI PyPI - langchain-ai-identity License

Identity, governance, and forensic accountability for AI agents.

Each agent gets a cryptographic identity, enforceable policies, compliance-ready audit logs, and tamper-evident forensic trails. The design constraint the whole system is built around: trusting AI Identity evidence must never require trusting AI Identity. Everything a relying party needs to check our records independently is openly licensed and runs offline.

Verify our claims without asking us

The audit records are Merkle-batched and the signed checkpoints are published, so you can confirm the evidence is real before you talk to anyone here.

# 1. Pull a signed checkpoint from the public feed — no auth, no account
curl -s "https://api.ai-identity.co/evidence-anchor/checkpoints?limit=1"

# 2. Verify an exported audit chain offline — zero dependencies, MIT licensed
python3 cli/ai_identity_verify.py chain export.json

# 3. Verify a Merkle inclusion proof against a signed checkpoint
python3 cli/ai_identity_verify.py inclusion-proof bundle.json

The checkpoint history is also mirrored to the evidence-anchor-mirror branch of this repo every six hours, with append-only enforcement — a rewritten batch, a vanished root, or a mutated envelope fails the run rather than overwriting the record. A checkpoint that verifies offline but is absent from the public feed is the tamper signal.

Standards

The record formats are not ours to define, so we contributed them upstream:

  • OCSF — the attestation object and record_integrity profile are merged into OCSF 1.9. This repo is the reference implementation that produced them; the emitter writes the merged shape.
  • CPEX — the OCSF audit plugin is contributed to IBM's CPEX gateway under Apache-2.0.
  • CoSAI WS4 — the CMF ↔ OCSF cross-map and interop material lives in docs/cosai-ws4-ocsf-mapping/.
URL
Dashboard ai-identity.co
API Docs api.ai-identity.co/docs
Checkpoint feed api.ai-identity.co/evidence-anchor/checkpoints

Integrations

LangChain

AI Identity provides a drop-in LangChain integration, available as a standalone PyPI package:

pip install langchain-ai-identity
from langchain_ai_identity import create_ai_identity_agent

agent = create_ai_identity_agent(
    tools=[...],
    agent_id="<your-agent-uuid>",
    ai_identity_api_key="aid_sk_...",
    openai_api_key="sk-...",
)
result = agent.invoke({"input": "What is the latest news on AI safety?"})

Every LLM call is authenticated, policy-checked, and logged with a tamper-evident audit trail. See the langchain-ai-identity PyPI page for full documentation.

Offline Forensic Verification (CLI)

Auditors and incident responders can verify audit chain integrity offline — no network access or vendor trust required:

python3 cli/ai_identity_verify.py chain export.json

The CLI is a single-file, zero-dependency Python script that independently verifies HMAC-SHA256 hash chains exported from AI Identity.

Architecture

ai-identity/
├── api/          # FastAPI API server — identity service, admin API (port 8001)
├── gateway/      # FastAPI proxy gateway — request routing & policy enforcement (port 8002)
├── common/       # Shared code — DB models, auth, config, schemas
├── dashboard/    # React + TypeScript + Tailwind — agent management UI
├── sdk/          # Client SDKs — Python, TypeScript, LangChain integration
├── cli/          # Offline forensic verification CLI
├── alembic/      # Database migrations
├── scripts/      # Dev scripts — seed data, migrations
└── pyproject.toml

Components

  1. Identity Service (api/) — Agent CRUD, API key issuance (aid_sk_ prefix), key rotation, capabilities management
  2. Proxy Gateway (gateway/) — Authenticates agent keys, evaluates policies, forwards or blocks requests, logs decisions
  3. Shared Library (common/) — SQLAlchemy models, Pydantic schemas, auth utilities, config — imported by both api/ and gateway/
  4. Dashboard (dashboard/) — React SPA for agent management, policy editor, live traffic feed, spend charts
  5. SDKs (sdk/) — Python and TypeScript client libraries, plus the LangChain integration
  6. Forensic CLI (cli/) — Standalone offline audit chain verifier for DFIR and compliance

Quick Start

Docker (recommended)

git clone https://github.com/Levaj2000/AI-Identity.git
cd AI-Identity
make setup   # generates .env with security keys
make up      # builds and starts api + gateway + postgres

Services start at localhost:8001 (API), localhost:8002 (Gateway).

Run make help to see all available commands (migrate, seed, logs, shell, etc.).

Manual Setup

Prerequisites: Python 3.11+, Node.js 18+, PostgreSQL

# 1. Create virtual environment
python -m venv .venv
source .venv/bin/activate

# 2. Install dependencies
pip install -r api/requirements.txt
pip install -r gateway/requirements.txt
pip install -e common/

# 3. Copy environment variables
cp .env.example .env
# Edit .env with your database URL and secrets

# 4. Start the API server (port 8001)
uvicorn api.app.main:app --reload --port 8001

# 5. Start the gateway (port 8002) — in a separate terminal
uvicorn gateway.app.main:app --reload --port 8002

Dashboard

cd dashboard
cp .env.example .env     # defaults to localhost:8001 API
npm install && npm run dev

The dashboard is deployed to ai-identity.co via Vercel. PR preview deploys are automatic.

Running Tests

# All tests
pytest

# API tests only
pytest api/tests/

# Gateway tests only
pytest gateway/tests/

API Keys

Agent API keys use the aid_sk_ prefix with SHA-256 hashed storage and a show-once pattern. Keys are only displayed once at creation time.

Key rotation supports a 24-hour grace period — both old and new keys work during the transition.

Tech Stack

  • Backend: Python 3.11, FastAPI, SQLAlchemy, Alembic, Pydantic
  • Database: PostgreSQL (Neon)
  • Frontend: React 19, TypeScript, Vite, Tailwind CSS
  • Forensics: HMAC-SHA256 hash-chained audit logs, offline CLI verifier
  • Integrations: LangChain (PyPI)
  • CI/CD: GitHub Actions, Ruff (lint + format), pytest (1,000+ tests)
  • Deployment: GKE Autopilot (API + Gateway), Vercel (Dashboard), GitHub Actions CI/CD with Cloud Build

License

Platform: proprietary — the API, gateway, dashboard, Mandate Service, and shared libraries are all rights reserved. The repository is public so the code can be audited, not reused.

Verification and integration surfaces: permissive — trusting AI Identity evidence must never require trusting AI Identity, so everything a relying party needs to verify our records independently is openly licensed:

Component License
cli/ — offline verifier (ships in every Case File bundle) + audit review CLI MIT
sdk/langchain/ — LangChain SDK (PyPI) MIT
CPEX OCSF audit plugin — contributed upstream to IBM's CPEX gateway Apache-2.0

Record formats follow open standards: our schema contributions are merged upstream in ocsf/ocsf-schema (OCSF 1.9). See LICENSE for the full terms.

About

Verifiable identity and tamper-evident OCSF audit records for AI agents — signed event chains, offline verification, agent mandates.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages