Skip to main content
The MeshAI class is the main entry point for the SDK. All operations (agent management, telemetry, cost, anomalies, and governance) are methods on this class.

Constructor

Parameters

string
required
Your MeshAI API key (msh_...). Can also be set via MESHAI_API_KEY environment variable.
string
Name of the agent this client represents. Required for register(), start_heartbeat(), and track_usage().
string
default:"https://api.meshai.dev"
MeshAI API base URL. Override for self-hosted or staging deployments. Can also be set via MESHAI_BASE_URL.
string
default:"production"
Agent environment. One of production, staging, or dev. Can also be set via MESHAI_ENVIRONMENT.
integer
default:"30"
Seconds between automatic heartbeats when start_heartbeat() is called. Can also be set via MESHAI_HEARTBEAT_INTERVAL.
integer
default:"10"
HTTP request timeout in seconds. Can also be set via MESHAI_TIMEOUT.
boolean
default:"false"
If true, automatically calls register() on initialization. Requires agent_name to be set.

Properties

Example

Method Overview