Forge
Forge is the reference implementation of ANVIL — the open contract for accountable, portable AI agents.
Build agents that hold a cryptographic identity from birth, run a tool loop under capability-scoped authority, stream tokens natively from any provider, and compile to WASM so the same binary runs on your laptop, in a Hives flight, or pinned to a Sigil chain.
use forge::prelude::*;
let agent = StreamingToolLoopAgent::new(
AgentConfig::new("research", "anthropic:claude-sonnet-4-5-20250929")
.with_system_prompt("You are a research analyst.")
.with_tool_registry(&tools),
StreamingLoopConfig::default(),
model,
tools,
AutoApprove::shared(),
);
let output = agent.run("Summarise the last 7 days of forge-rs commits.").await?;
for record in output.tool_invocations() {
println!("{:?} {} ({}ms)", record.status, record.tool_name, record.duration_ms);
}
println!("{}", output.text());
Six SDKs, one contract
Rust →
The reference implementation. ANVIL conformance lives here.
TypeScript →
Browser, Node.js, Deno, and Bun — first-class web.
Go →
Cloud-native services and high-throughput backends.
Python →
Data, ML, and orchestration workflows.
Swift →
Apple-platform agent experiences.
Kotlin →
Android and JVM agent workflows.
All non-Rust SDKs share a Rust-WASM crypto module so signature, hash, and lineage operations are bit-identical across languages.
What ANVIL guarantees
Every Forge agent satisfies eight contracts:
- Identity — bound to an OAS DID with verifiable lineage to a human root.
- Capability — every tool call is gated by an Arsenal Agent Capability Token.
- Tool — three-tier classification (read / write / execute) with explicit approval.
- Health — six-state lifecycle (booting → ready → busy → degraded → draining → stopped).
- Communication — structured request/response with content-addressed payloads.
- Collaboration — multi-agent coordination primitives.
- Telemetry — W3C Trace Context, Prometheus, OpenTelemetry by default.
- Generation — provider-agnostic LLM access with native per-token streaming.
Read the full ANVIL specification.
Where to go next
Quickstart →
Build, sign, and run your first Forge agent in 5 minutes.
Architecture →
How the 32 Forge crates fit together.
The ANVIL contract →
The eight contracts every ANVIL-compliant SDK must implement.
Streaming →
Real per-token streaming via `LanguageModel::stream_chunks`.
Harness bridge →
Drop a Forge agent into a Codex-style terminal in 10 lines.
Provider matrix →
What each LLM provider supports across the contract.