AxonFlow SDK for Rust
Evaluating AxonFlow for a real deployment?
Choose the path that fits:
- Self-serve: free 90-day Evaluation License
- Hands-on: Design Partner Program — Enterprise access for the scoped engagement, founder-led architecture and rollout support, and preferential pricing after successful rollout
Priority support, architecture review, incident-readiness review, and roadmap input are included for selected partners. We reply within 48 hours.
Enterprise-grade Rust SDK for the AxonFlow AI governance platform. Add invisible AI governance to your applications with production-ready features including retry logic, caching, fail-open strategy, and debug mode.
How This SDK Fits with AxonFlow
This SDK is a client library for interacting with a running AxonFlow control plane. It is used from application or agent code to send execution context, policies, and requests at runtime.
A deployed AxonFlow platform (self-hosted or cloud) is required for end-to-end AI governance. SDKs alone are not sufficient—the platform and SDKs are designed to be used together.
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
= { = "1", = ["full"] }
Quick Start
Basic Usage (Invisible Governance via Interceptor)
The most common way to use AxonFlow is via an Interceptor. This wraps your existing LLM client (e.g., an OpenAI-compatible client) and automatically applies governance to every call.
use ;
use ;
async
Manual Audit (Gateway Mode)
If you are making LLM calls directly and just want to log them for compliance and cost tracking:
use ;
let axon = new?;
// After your direct LLM call
axon.audit_llm_call.await?;
Examples
The SDK includes several runnable examples demonstrating common integration patterns. You can find them in the examples/ directory.
Running the Examples
Before running the examples, set your AxonFlow credentials as environment variables:
# Optional: defaults to http://localhost:8080
Then use cargo run --example <name> to execute an example:
- Basic Chat Governance:
- Model Context Protocol (MCP) Connectors:
- Multi-Agent Planning (MAP):
- Invisible Governance (Interceptors — OpenAI):
- Invisible Governance (Interceptors — Anthropic):
- Decision Explainability (ADR-043):
# from a recent blocked call or audit row
Advanced Features
Fail-Open Strategy
In Production mode, if the AxonFlow platform is unreachable, the SDK will "fail-open." This ensures your application remains available even if the governance layer is degraded.
Caching
The SDK includes a built-in async cache (powered by moka) with TTL support to reduce latency for redundant requests. Caching is automatically disabled for mutation operations like plan execution.
MCP & MAP Support
The Rust SDK provides full parity for Model Context Protocol (MCP) and Multi-Agent Planning (MAP):
- MCP: List, install, and query Model Context connectors with full policy enforcement.
- MAP: Generate and execute complex multi-agent plans programmatically.
Configuration
let config = AxonFlowConfig ;
Telemetry
The SDK includes a non-blocking background heartbeat that follows the AxonFlow telemetry contract: at most one ping per machine every 7 days to https://checkpoint.getaxonflow.com/v1/ping. Payload is classification-only — SDK version, OS, architecture, runtime version, deployment mode, an endpoint-type bucket (localhost / private_network / remote / unknown), and the deployment's org_id (the ORG_ID env value, or local-dev-org sentinel when unset). The raw URL is never sent.
AXONFLOW_TELEMETRY=off is the sole opt-out lever as of v0.2. There is no programmatic disable on the SDK config — the env-var-only pattern matches HashiCorp's CHECKPOINT_DISABLE, Docker, and Datadog Agent. Sandbox-mode clients (constructed via AxonFlowConfig::sandbox(...)) tag their pings with stream="sandbox" so analytics can distinguish dev/test usage from production heartbeat. DO_NOT_TRACK is intentionally not honored.
Scope of AXONFLOW_TELEMETRY=off
AXONFLOW_TELEMETRY=off disables the SDK heartbeat (version, OS, architecture, deployment org_id). On self-hosted and in-VPC deployments, that heartbeat is the only data the SDK sends to AxonFlow, so setting =off means we receive nothing. On Community SaaS (try.getaxonflow.com) the hosted service also processes operational data — registrations, audit logs, policy enforcement records, workflow state, plan data, and request-header metadata aggregated for usage analytics — as part of running the platform; that operational data flow is governed by the Privacy Policy, not by AXONFLOW_TELEMETRY.
See Telemetry Documentation for full details.
License
This project is licensed under the MIT License - see the LICENSE file for details.