A complete guide to configuring the Agent Governance SDK for your specific environment and needs.
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.
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).
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.
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.
Copy
// Recommended way to initializeimport 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});