Rust Guide

Rust is the Forge reference implementation. Read this tab when you want the earliest runtime behavior, the clearest conformance signal, and the most direct path to WASM, identity, auth, tools, providers, and release-gate internals.

Language perspective

Rust users should think of Forge as a crate family first and a convenience SDK second. The important boundary is not one package name; it is the ANVIL contract implemented across crates with tests that other SDKs follow.

Primary surfaces:

  • forge-rs/crates/forge-core
  • forge-rs/crates/forge-agent
  • forge-rs/crates/forge-identity
  • forge-rs/crates/forge-auth
  • forge-rs/crates/forge-mcp
  • forge-rs/conformance

Follow this path

  1. Start with Quickstart to run an identity-bound agent.
  2. Read Agents and Generation together.
  3. Add Tools and Capabilities.
  4. Read WASM and WASI before deploying portable modules.
  5. Use Conformance Suite before treating behavior as stable.
cargo test --workspace
python3 tools/release_gate.py --root .

Contract focus

Contract Rust reading lens
Identity Treat forge-identity as the source of truth for key derivation, OAS documents, glyphs, and lineage proofs.
Capability Treat forge-auth and ACT verification as runtime hot-path security code.
Tools Keep Tier 2 tools behind explicit scopes and approval policy.
Telemetry Verify span names and audit entry structure against conformance fixtures.
WASM Assume Rust changes first when deterministic crypto or host-boundary behavior changes.

The ANVIL contract

The behavioral contract Rust anchors for every SDK.

WASM and WASI

How Rust becomes the portable module shared by the other languages.

Provider contract

How direct and gateway providers satisfy the same runtime surface.

Release gate

The final source of truth for production readiness.

Current guidance

Use Rust when you need reference behavior, conformance work, low-level runtime debugging, or production deployment confidence. Do not infer readiness from crate presence alone; use the release gate.