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
Your MeshAI API key (
msh_...). Can also be set via MESHAI_API_KEY environment variable.Name of the agent this client represents. Required for
register(), start_heartbeat(), and track_usage().MeshAI API base URL. Override for self-hosted or staging deployments. Can also be set via
MESHAI_BASE_URL.Agent environment. One of
production, staging, or dev. Can also be set via MESHAI_ENVIRONMENT.Seconds between automatic heartbeats when
start_heartbeat() is called. Can also be set via MESHAI_HEARTBEAT_INTERVAL.HTTP request timeout in seconds. Can also be set via
MESHAI_TIMEOUT.If
true, automatically calls register() on initialization. Requires agent_name to be set.Properties
| Property | Type | Description | |
|---|---|---|---|
client.agent_id | `str | None` | The agent ID after registration |
client.agent_name | `str | None` | The agent name |
client.is_registered | bool | Whether the agent has been registered |
Example
Method Overview
| Category | Methods |
|---|---|
| Agents | register(), list_agents(), get_agent(), update_agent(), delete_agent() |
| Telemetry | heartbeat(), start_heartbeat(), track_usage() |
| Cost | get_cost_summary(), get_cost_by_agent(), get_cost_by_model() |
| Anomalies | list_anomalies(), get_anomaly(), acknowledge_anomaly(), resolve_anomaly(), get_anomaly_summary() |
| Governance | classify_risk(), create_policy(), list_approvals(), decide_approval(), list_audit_events() |
| Compliance | get_readiness_score(), get_fria(), get_transparency_card(), create_incident() |
| Billing | get_billing_info() |

