MeshGuardGoRustSDK

MeshGuard Go and Rust SDKs: Governance in Every Language

MG

MeshGuard

2026-04-29 · 2 min read

Your Agent Fleet Doesn't Run on One Language

The teams building AI agents today are not standardizing on a single runtime. Data science teams ship Python. Platform teams write Go. Performance-critical inference pipelines run Rust. Frontend orchestration layers use JavaScript. Enterprise integrations lean on .NET.

Until today, MeshGuard's SDK coverage meant that Go and Rust teams had to call our REST API directly, writing their own retry logic, serialization, and error handling. That friction slowed adoption and left governance gaps in the parts of the stack that often need it most.

Today we are releasing first-class Go and Rust SDKs alongside our existing Python, JavaScript, and .NET libraries. Every language now gets the same feature set: agent registration, policy evaluation, audit logging, and real-time event streaming.

Go SDK

Install with a single module import:

go get github.com/meshguard/meshguard-go@latest

Register an agent and evaluate a policy in a few lines:

package main

import (
    "context"
    "log"

    meshguard "github.com/meshguard/meshguard-go"
)

func main() {
    client := meshguard.NewClient("mg_api_key_here")

    agent, err := client.Agents.Register(context.Background(), &meshguard.AgentInput{
        Name:        "data-pipeline-agent",
        Environment: "production",
    })
    if err != nil {
        log.Fatal(err)
    }

    decision, err := client.Policies.Evaluate(context.Background(), &meshguard.EvalRequest{
        AgentID: agent.ID,
        Action:  "read_database",
        Resource: "customers_table",
    })
    if err != nil {
        log.Fatal(err)
    }

    log.Printf("Policy decision: %s (reason: %s)", decision.Effect, decision.Reason)
}

The Go SDK uses standard context.Context for cancellation and timeouts, returns concrete error types for programmatic handling, and supports structured logging via slog.

Rust SDK

Add meshguard to your Cargo.toml:

[dependencies]
meshguard = "1.0"
tokio = { version = "1", features = ["full"] }

The Rust SDK is fully async, built on tokio and reqwest:

use meshguard::{Client, AgentInput, EvalRequest};

#[tokio::main]
async fn main() -> Result<(), meshguard::Error> {
    let client = Client::new("mg_api_key_here");

    let agent = client.agents().register(&AgentInput {
        name: "inference-router".into(),
        environment: "production".into(),
        ..Default::default()
    }).await?;

    let decision = client.policies().evaluate(&EvalRequest {
        agent_id: agent.id.clone(),
        action: "invoke_model".into(),
        resource: "gpt-4-turbo".into(),
        ..Default::default()
    }).await?;

    println!("Decision: {:?} — {}", decision.effect, decision.reason);
    Ok(())
}

Every type implements Serialize, Deserialize, Clone, and Debug. Error handling uses a single meshguard::Error enum with variants for network, authentication, validation, and policy errors.

Consistent Across Languages

Regardless of which SDK you use, the developer experience follows the same pattern:

  1. Initialize a client with your API key.
  2. Register agents with a name, environment, and optional labels.
  3. Evaluate policies by specifying the agent, action, and target resource.
  4. Stream audit events for real-time observability.

API parity is enforced at the spec level. When we ship a new feature to one SDK, the others follow within the same release cycle.

Get Started

Both SDKs are available now:

  • Go: go get github.com/meshguard/meshguard-go
  • Rust: cargo add meshguard
  • Full documentation at docs.meshguard.app/sdks

If your team runs agents across multiple languages, a single MeshGuard workspace gives you unified governance, a single policy engine, and a consolidated audit trail, regardless of the runtime underneath.

Related Posts