Platform Security Observability FinOps Compliance Evaluations AI Gateway Shadow AI
Solutions Enterprise AI Governance Custom Agent Security Financial Services Healthcare Technology
Docs Blog Book a Demo

Getting Started

Installation

Detailed installation instructions for the Saf3AI SDK.

Installation

This guide covers detailed installation instructions for the Saf3AI Python SDK.

Python SDK

Requirements

  • Python 3.9 or higher
  • pip (or your preferred package manager)

Install via pip

pip install saf3ai-sdk

Verify installation

import saf3ai_sdk
print("Saf3AI SDK installed successfully!")

Environment Variables

Configure your environment with the following variables. Create a .env file in your project root:

# Required: Collector endpoint for telemetry
SAF3AI_COLLECTOR_AGENT=https://your-collector-endpoint.com

# Required: Service name for your agent
SAF3AI_SERVICE_NAME=my-agent

# Required for security scanning
SAF3AI_API_KEY=your-api-key-here
SAF3AI_API_KEY_HEADER=X-API-Key
SAF3AI_API_ENDPOINT=https://your-scanner-endpoint.com

The SDK will automatically read these variables when initialized:

import os
from dotenv import load_dotenv
from saf3ai_sdk import init

# Load environment variables
load_dotenv()

# Initialize SDK - reads from environment
init(
    service_name=os.getenv("SAF3AI_SERVICE_NAME", "my-agent"),
    framework="adk",  # or "langchain", "rest"
    agent_id="unique-agent-id",
    api_key=os.getenv("SAF3AI_API_KEY"),
    safeai_collector_agent=os.getenv("SAF3AI_COLLECTOR_AGENT"),
)

Docker

For containerized deployments:

FROM python:3.11-slim

# Install SDK
RUN pip install saf3ai-sdk

# Your application
COPY . /app
WORKDIR /app

CMD ["python", "main.py"]

Self-Hosted Deployment

For enterprise customers running Saf3AI on-premises, configure the endpoints in your environment:

SAF3AI_COLLECTOR_AGENT=https://saf3ai.your-company.internal:4318
SAF3AI_API_ENDPOINT=https://saf3ai-scanner.your-company.internal

Proxy Configuration

If you’re behind a corporate proxy:

# Set proxy environment variables
export HTTP_PROXY=http://proxy.company.com:8080
export HTTPS_PROXY=http://proxy.company.com:8080

Upgrading

pip install --upgrade saf3ai-sdk

Uninstalling

pip uninstall saf3ai-sdk

Next Steps