Solutions to common problems and issues you may encounter when using the Agent Governance SDK.
`ValidationError: apiKey is required`
apiKey
passed to the AgentMonitor
constructor was undefined
or an empty string.Solution:AGENT_GOVERNANCE_API_KEY
is correctly set in your environment (.env
file, server configuration, etc.).dotenv
) before you initialize the AgentMonitor
.AGENT_GOVERNANCE_API_KEY
) or the apiKey
property in the constructor.`Failed to register agent: HTTP 401 Unauthorized`
`Invalid configuration: endpoint: Invalid endpoint URL format`
endpoint
URL provided in the configuration is not a valid URL.Solution:http://
or https://
and is a well-formed URL.endpoint
property from your configuration entirely, and it will default to https://api.aiagentshouse.com
.Events are not appearing on the dashboard
shutdown()
or flush()
: The SDK batches events and sends them periodically. If your script finishes executing before a batch is sent, the events will be lost. Ensure you call await monitor.shutdown()
at the end of your script or application lifecycle. For long-running services, this should be part of your graceful shutdown logic.enableLogging: true
and logLevel: 'debug'
in your monitor configuration. This will print detailed logs from the SDK to your console, showing you when events are added to the batch and when flushes are attempted.High memory usage in my application
batchSize
combined with a long flushInterval
can cause many events to be held in memory. Consider lowering these values.monitor.shutdown()
is being called when your application exits. Otherwise, the final batch of events will remain in memory until the process is killed.Compliance violations are not being detected
enableComplianceChecks
: The most common reason is that enableComplianceChecks
is either false
or not set in the AgentMonitor
configuration. It must be explicitly set to true
.agent_response
events. Ensure you are using monitor.trackAgentResponse()
or an automated wrapper that calls it. Compliance checks do not run on user messages by default.complianceEngine
instance and that their isActive
property is true
.Getting too many false positive violations
\b
) to prevent matching substrings within larger words.monitor.complianceEngine.setRuleActive('rule-id-here', false)
.Wrapped client throws an error or doesn't work
openai
or @anthropic-ai/sdk
) is compatible with the version of the Agent Governance SDK you are using. Check our release notes for any known compatibility issues.AnthropicAgentMonitor
and wrapAnthropic
for the Anthropic client).await monitor.registerAgent(agentInfo)
before you wrap the client and start making calls.Tool calls or function calls are not being tracked
tool_use
(for Anthropic) or function_call
(for OpenAI) content block.messages.create
for Anthropic, chat.completions.create
for OpenAI).hello@aiagentshouse.com
with the relevant logs and a description of the problem.