Developer Documentation

Quick Start Guide

Get EU AI Act compliance logging for your AI application in under 5 minutes.

Works with LangChain, CrewAI, AutoGenPython and TypeScript5-minute integration

Prerequisites

Before you begin, make sure you have:

  • Python 3.8+ or Node.js 18+
  • A Protectron accountSign up free
  • An AI application using LangChain, CrewAI, or custom code

Step-by-Step Integration

1

Create Your Account

Sign up at dashboard.protectron.ai/signup with email or SSO, then verify your email address.

2

Register Your AI System

Click 'Add AI System' in your dashboard, enter a name, select the AI type (Agent, Chain/Pipeline, Chatbot, or Other), and click 'Create System'. You'll receive a System ID.

3

Get Your API Key

Go to Settings → API Keys, create a new key, and copy it immediately. Store it as an environment variable.

# Add to your .env file or shell profile
export PROTECTRON_API_KEY=pk_live_xxxxxxxxxxxxxxxxxxxxxxxx
4

Install the SDK

Install the Protectron SDK for your language.

# Python - Core SDK
pip install protectron

# With LangChain support
pip install protectron[langchain]

# With CrewAI support
pip install protectron[crewai]

# TypeScript / JavaScript
npm install @protectron/sdk
5

Add to Your Application

Add the Protectron callback to your AI application. Here's a LangChain example:

from langchain.agents import create_react_agent, AgentExecutor
from langchain_openai import ChatOpenAI
from protectron.langchain import ProtectronCallback

# Create the Protectron callback
callback = ProtectronCallback(
    system_id="sys_abc123xyz"  # Your system ID from Step 2
)

# Create your agent with the callback
llm = ChatOpenAI(model="gpt-5.2")
agent = create_react_agent(llm, tools, prompt)
executor = AgentExecutor(
    agent=agent, 
    tools=tools, 
    callbacks=[callback]  # Add Protectron here
)

# Run your agent - all actions are automatically logged
result = executor.invoke({"input": "Your query here"})
6

Verify It's Working

Go to dashboard.protectron.ai, select your AI system, and click 'Audit Trail'. You should see events appearing in real-time.

Expected Events

After running your code, you should see events like:

Event TypeDescription
trace_startBeginning of a session/conversation
llm_callEach LLM interaction with input/output
tool_callEach tool/function invocation
agent_actionAgent decisions and actions
trace_endEnd of session

Add Human Oversight Logging (Optional)

For Article 14 compliance, log when humans approve, reject, or override AI actions:

from protectron import Protectron

protectron = Protectron(system_id="sys_abc123xyz")

# When a human approves an AI action
def approve_action(action, approver_email):
    protectron.log_human_approval(
        action_type=action["type"],
        action_details=action["details"],
        approved_by=approver_email
    )
    execute_action(action)

# When a human rejects an AI action
def reject_action(action, approver_email, reason):
    protectron.log_human_rejection(
        action_type=action["type"],
        action_details=action["details"],
        rejected_by=approver_email,
        rejection_reason=reason
    )

# When a human overrides an AI decision
def override_action(original_action, new_action, approver_email, reason):
    protectron.log_human_override(
        original_decision=original_action["type"],
        override_decision=new_action["type"],
        overridden_by=approver_email,
        override_reason=reason
    )
    execute_action(new_action)

What's Being Logged?

By default, Protectron logs:

DataLoggedPurpose
LLM promptsAudit trail of inputs
LLM responsesAudit trail of outputs
Tool callsRecord of AI actions
Tool resultsOutcomes of actions
TimestampsTimeline reconstruction
Session contextGrouping related events
ErrorsFailure tracking

Customize What's Logged

callback = ProtectronCallback(
    system_id="sys_abc123xyz",
    
    # Content options
    log_llm_content=True,      # Set False to log metadata only
    log_tool_inputs=True,      # Log tool parameters
    log_tool_outputs=True,     # Log tool results
    
    # Privacy options
    pii_redaction=True,        # Auto-redact emails, phones, etc.
    hash_user_ids=True,        # Hash user identifiers
    
    # Sampling (for high-volume)
    sample_rate=1.0            # 1.0 = 100%, 0.1 = 10%
)

Summary

StepActionTime
1Create account1 min
2Register AI system1 min
3Get API key30 sec
4Install SDK30 sec
5Add callback2 min
6Verify in dashboard30 sec
Total - Full integration~5 min

You're now logging AI actions for EU AI Act compliance. 🎉

Ready to Get Started?

Create your free account and start logging AI actions in minutes.

✓ 100,000 events free✓ No credit card required✓ 5-minute integration