Architecture

How the 32 Forge crates fit together.

Architecture

Forge is structured as a layered runtime, not a monolithic library. The reference Rust implementation ships as 32 crates organised into seven layers.

Layers

┌─────────────────────────────────────────────────────────────┐
│   forge-sdk            (single-import surface)              │
├─────────────────────────────────────────────────────────────┤
│   forge-agent          forge-collab    forge-comm           │
│   ── tool loop         ── multi-agent  ── A2A messaging     │
├─────────────────────────────────────────────────────────────┤
│   forge-tool           forge-generate  forge-mcp            │
│   ── registry/exec     ── stream_text  ── MCP client/server │
├─────────────────────────────────────────────────────────────┤
│   forge-provider-*     (anthropic / openai / google /       │
│                         litellm / foundry / codex /         │
│                         claude-code / bedrock / cohere /    │
│                         azure / xai / deepseek / mistral)   │
├─────────────────────────────────────────────────────────────┤
│   forge-identity       forge-auth      forge-settings       │
│   ── OAS DID + HMR     ── Arsenal ACT  ── settings introspect│
├─────────────────────────────────────────────────────────────┤
│   forge-core                                                │
│   ── LanguageModel + ChunkStream + StreamChunk + types      │
├─────────────────────────────────────────────────────────────┤
│   forge-telemetry      forge-error     forge-wasm           │
│   ── tracing + OTel    ── ForgeError   ── WASM runtime      │
└─────────────────────────────────────────────────────────────┘

Crate map

Core (3)

  • forge-coreLanguageModel trait, StreamChunk, ChunkStream, ModelMessage, ToolDefinition, Usage, FinishReason. No I/O.
  • forge-error — single ForgeError type, ForgeResult alias.
  • forge-telemetrytracing + OpenTelemetry initialiser.

Identity & authorization (3)

  • forge-identitydid:oas resolution, HMR/MHR creation, lineage verification, glyph derivation.
  • forge-auth — Arsenal ACT verification (verify_act), capability scoping, delegation chains.
  • forge-settings — provider settings introspection — what each provider needs to start, what's configured, what's missing.

Agent runtime (4)

  • forge-agentAgent trait, AgentConfig, StreamingToolLoopAgent, ToolLoopAgent, AgentEvent, ToolInvocationRecord, AgentLoopObserver.
  • forge-toolToolRegistry, ToolExecutor, three-tier classification (read / write / execute), approval handlers.
  • forge-comm — agent-to-agent message envelope.
  • forge-collab — multi-agent coordination primitives.

Generation (1)

  • forge-generatestream_text, stream_text_chunks, stream_object, generate_object. Built on top of forge-core::LanguageModel.

MCP (1)

  • forge-mcp — Model Context Protocol client and server.

Providers (13)

The provider crates split into two families:

Native streaming (per-token from the upstream wire):

  • forge-provider-anthropic
  • forge-provider-openai
  • forge-provider-google

Buffered shims (wait for the full response, then chunk it):

  • forge-provider-litellm
  • forge-provider-foundry
  • forge-provider-codex (Codex CLI bridge)
  • forge-provider-claude-code (Claude Code CLI bridge)
  • forge-provider-bedrock
  • forge-provider-cohere
  • forge-provider-azure
  • forge-provider-xai
  • forge-provider-deepseek
  • forge-provider-mistral

Both families implement the same LanguageModel trait — switching providers is a one-line change. See Provider Capability Matrix.

x402 micropayments (1)

  • forge-agent402 — agent-side x402 wallet + per-call settlement.

Surface (1)

  • forge-sdk — re-exports everything above as a single crate. Most consumers import only this:
    use forge::prelude::*;
    

Coding & tooling (5)

  • forge-coding-* — coding-platform subscription bridge (Claude, Cursor, etc.).

Memory & workflow (3)

  • forge-memory-* — agent memory adapters.
  • forge-workflow — durable workflow primitives.

Runtime (2)

  • forge-wasm — WASM execution surface (Wasmtime).
  • forge-runtime-host — host bindings for WASM-compiled agents.

Bridges

Three official bridge crates connect Forge to other L1fe systems:

  • harness-sdk-forge — drop a Forge agent into a Codex-style TUI. See Harness integration.
  • forge-flowers — bridge to the Flowers durable workflow engine in Aut0. See Aut0 integration.
  • arise-bridge — bridge to the ARISE distributed GPU marketplace.