Proper configuration is key to leveraging the full power of the Agent Governance SDK. This guide provides a central reference for all configuration options, helping you tailor the monitor for optimal performance, data accuracy, and cost-efficiency across different environments.

Main Configuration (AgentMonitorConfig)

This object is passed to the AgentMonitor constructor and controls the core behavior of the SDK, such as authentication, batching, and logging.
apiKey
string
required
Your Agent Governance API key. This is used to authenticate with the platform. It’s highly recommended to load this from an environment variable (process.env.AGENT_GOVERNANCE_API_KEY).
organizationId
string
required
Your organization’s unique identifier in the Agent Governance platform. This should also be loaded from an environment variable.
endpoint
string
default:"https://api.aiagentshouse.com"
The API endpoint for the Agent Governance platform. Only change this if you have a dedicated or on-premise instance.
environment
'production' | 'staging' | 'development'
default:"production"
The environment your application is running in. This helps you filter and analyze data in the dashboard.
batchSize
number
default:"100"
The number of events to collect in memory before sending them to the API. A larger size is more efficient for high-volume applications but uses more memory and has higher data loss risk on crash. Range: 1–1000.
flushInterval
number
default:"5000"
The maximum time in milliseconds the SDK will wait before sending a batch of events, even if batchSize has not been reached. Minimum: 100.
enableComplianceChecks
boolean
default:"true"
Set to true to activate the real-time, offline Compliance Engine to scan agent responses for violations.
enableLogging
boolean
default:"true"
Set to true to enable detailed logging from the SDK to your console. It’s recommended to set this to false in production.
logLevel
'debug' | 'info' | 'warn' | 'error'
default:"info"
The minimum log level to output when enableLogging is true. Use 'debug' for verbose troubleshooting.
retryAttempts
number
default:"3"
The number of times the SDK will retry sending a batch of events if the network request fails. Range: 0–10.
retryDelay
number
default:"1000"
The base delay in milliseconds between retry attempts. The SDK uses exponential backoff.

Agent Registration (AgentInfo)

This object is passed to the monitor.registerAgent() method to define the profile and settings for each of your AI agents.
id
string
required
A unique identifier for the agent within your organization (e.g., personal-banking-assistant-v2).
name
string
required
A human-readable name for the agent that will be displayed on the dashboard.
category
AgentCategory
required
The type of agent. Can be 'persona', 'tool_calling', 'workflow', or 'autonomous'.
specialty
BankingSpecialty
The agent’s area of expertise within banking, such as 'personal_banking' or 'fraud_detection'. This helps with specialized analytics.
version
string
required
The version of your agent (e.g., '1.2.0'). This is crucial for tracking performance and compliance across different agent versions.
llmProvider
string
required
The name of the LLM provider (e.g., 'anthropic', 'openai').
model
string
required
The specific model the agent is using (e.g., 'claude-3-5-sonnet-20241022').
description
string
required
A brief description of the agent’s purpose and capabilities.
complianceSettings
object
An object to configure which categories of compliance checks are active for this specific agent.

Configuration Examples by Environment

It’s a best practice to use different configurations for your various environments.
// Optimized for immediate feedback and easy debugging
const devMonitor = new AgentMonitor({
apiKey: process.env.AGENT_GOVERNANCE_API_KEY,
organizationId: process.env.AGENT_GOVERNANCE_ORG_ID,
environment: 'development',
enableLogging: true,
logLevel: 'debug',
batchSize: 5,         // Small batches for quick sending
flushInterval: 1000,  // Frequent flushes
enableComplianceChecks: true,
retryAttempts: 1      // Fail fast
});

Security Best Practices

Never hardcode your apiKey or organizationId in your source code. Always use environment variables (e.g., process.env) or a dedicated secret management service (like AWS Secrets Manager, HashiCorp Vault, or Doppler) to handle sensitive credentials. This prevents accidental exposure in version control systems.
// Recommended way to initialize
import dotenv from 'dotenv';
dotenv.config();

const monitor = new AgentMonitor({
  apiKey: process.env.AGENT_GOVERNANCE_API_KEY,
  organizationId: process.env.AGENT_GOVERNANCE_ORG_ID,
  // ... other settings
});