perfecXion.ai

Quick Start Guide

Get perfecX Agent up and running in your AI application in under 5 minutes.

Prerequisites

  • Python 3.8+ or Node.js 16+
  • An AI agent framework (LangChain, AutoGPT, CrewAI, or Semantic Kernel)
  • A perfecX Agent API key (sign up at perfecxion.ai)

Step 1: Install the SDK

Python

pip install perfecxion-agent

Node.js

npm install @perfecxion/agent

Step 2: Initialize perfecX Agent

Python Example

from perfecxion_agent import PerfecXAgent
from langchain.agents import create_react_agent

# Initialize perfecX Agent
px_agent = PerfecXAgent(
    api_key="your-api-key",
    environment="production"
)

# Wrap your existing agent
my_agent = create_react_agent(...)
secure_agent = px_agent.wrap(my_agent)

# Enable real-time monitoring
px_agent.enable_monitoring(
    detect_anomalies=True,
    protect_memory=True,
    enforce_policies=True
)

Node.js Example

import { PerfecXAgent } from '@perfecxion/agent';
import { createAgent } from 'langchain/agents';

// Initialize perfecX Agent
const pxAgent = new PerfecXAgent({
    apiKey: 'your-api-key',
    environment: 'production'
});

// Wrap your existing agent
const myAgent = createAgent(...);
const secureAgent = pxAgent.wrap(myAgent);

// Enable real-time monitoring
pxAgent.enableMonitoring({
    detectAnomalies: true,
    protectMemory: true,
    enforcePolicies: true
});

Step 3: Configure Security Policies

# Define security policies
px_agent.set_policies({
    "max_execution_time": 300,  # 5 minutes
    "allowed_tools": ["web_search", "calculator", "file_reader"],
    "forbidden_patterns": ["rm -rf", "DELETE FROM", "DROP TABLE"],
    "memory_encryption": True,
    "require_authentication": True
})

# Set up alerts
px_agent.set_alerts({
    "anomaly_threshold": 0.8,
    "notification_channels": ["email", "slack"],
    "alert_on": ["policy_violation", "anomaly_detected", "memory_tampering"]
})

Step 4: Monitor Your Agents

Once integrated, perfecX Agent provides real-time monitoring through our dashboard:

Behavioral Analytics

Track agent behavior patterns and detect anomalies

Security Events

Real-time alerts for policy violations and threats

Performance Metrics

Monitor response times and resource usage

Audit Trails

Complete logs of all agent activities

# Access monitoring data programmatically
metrics = px_agent.get_metrics(
    agent_id="my-agent-001",
    time_range="last_hour"
)

print(f"Anomaly Score: {metrics.anomaly_score}")
print(f"Policy Violations: {metrics.violations_count}")
print(f"Average Response Time: {metrics.avg_response_time}ms")

Need Help?

Our team is here to help you get started with perfecX Agent.