DetectionResult

The DetectionResult object contains the outcome of the agent detection process. It’s returned by the AgentDetector.finalizeDetection() and AgentDetector.getCurrentDetectionResult() methods and provides information about whether the current session is classified as an AI agent.

Properties

isAgent
boolean
required

Indicates whether the current session is classified as an AI agent based on the default threshold (0.5).

  • true: The session is classified as an AI agent (confidence >= 0.5)
  • false: The session is classified as a human user (confidence < 0.5)
confidence
number
required

The predicted probability/confidence from the detection model, ranging from 0 to 1.

  • Higher values (closer to 1) indicate higher likelihood of being an AI agent
  • Lower values (closer to 0) indicate higher likelihood of being a human user

This value represents the model’s calculated probability that the session is from an AI agent.

features
Record<string, any>

The combined, preprocessed features used for scoring.

This property contains the feature values after preprocessing (standardization, one-hot encoding, etc.) that were fed into the model. It can be useful for debugging or understanding the model’s decision, especially when debug: true is enabled in the init options.

Example Result

// Example detection result
{
  isAgent: true,
  confidence: 0.87,
  // features object contains preprocessed values
  features: {
    mouse_move_speed_mean: 1.23, // Standardized value
    has_touch_screen: 0, // Boolean converted to number
    browser_name_chrome: 1, // One-hot encoded category
    browser_name_firefox: 0,
    // ... other preprocessed features
  }
}

Using the Result

// detector instance created and initialized
AgentDetector.init();

// Later, get the detection result
async function checkAgent() {
  const result = await AgentDetector.finalizeDetection();
  
  if (result.isAgent) {
    console.log('AI agent detected with confidence:', result.confidence);
    // Handle agent scenario
  } else {
    console.log('Human user detected with confidence:', result.confidence);
    // Handle human scenario
  }
}

Interpretation Guidelines

When interpreting detection results, consider the following guidelines:

Next Steps