Install
bytesandbrains is published on crates.io.
A single dependency line pulls the framework facade, which re-exports every
public surface across the six workspace crates.
Toolchain
The crate targets the stable Rust toolchain. The minimum supported version is 1.86. Check yours:
rustc --version
# rustc 1.86.0 (...) or newer.
Update if needed:
rustup update stable
Add the dependency
In a fresh project:
cargo new my_node
cd my_node
cargo add bytesandbrains
In an existing Cargo.toml:
[dependencies]
bytesandbrains = "0.3"
cargo add resolves the latest 0.3.x release on crates.io and pins it into
Cargo.toml. The default feature set enables cpu-backend, which surfaces the
reference CpuBackend at bytesandbrains::ops::backends::cpu::CpuBackend. The
first chapter example in Getting Started depends on
it.
Other published features:
tracing-otel: opt-in OpenTelemetry exporter for the engine’stracing::spans. Constructors live atbytesandbrains::telemetry::otel.test-components: ships the bundledKademliaHandtest component plus the engine’sinstall_graph_for_test/op_ref_atintrospection seams. Useful for integration tests that exercise the framework’s reference protocols.
For a no-default-features build, supply your own Backend impl and bind it at
compile time:
[dependencies]
bytesandbrains = { version = "0.3", default-features = false }
use bytesandbrains::Compiler;
// `MyBackend` is your own concrete: `#[derive(bb::Concrete, bb::Backend)]`
// then implement the `bb::Backend` Contract trait. See the Roles chapter.
let _compiler = Compiler::new().bind_backend::<MyBackend>("compute");
Verify the install
A one-file program that confirms the framework compiles and links:
use bytesandbrains::ops::backends::cpu::CpuBackend;
fn main() {
let _backend = CpuBackend::default();
println!("bytesandbrains compiled and linked.");
}
cargo run prints the message. The next chapter walks one example end to end.
The crate family in 0.3
The umbrella bytesandbrains crate re-exports the workspace surface. You
almost never depend on the inner crates directly.
| Crate | What it ships |
|---|---|
bytesandbrains | The framework facade. Re-exports the six workspace crates. The default cpu-backend feature surfaces CpuBackend at ops::backends::cpu::CpuBackend. |
bb-ir | Foundation: ONNX-flavored ModelProto, GraphProto, NodeProto, the TypeNode polymorphism tree, the Storage trait, the wire envelope. |
bb-runtime | Engine, Node, role-runtime traits, completion handles, the seven user-facing Contract traits (Backend, Index, Aggregator, Model, DataSource, Codec, PeerSelector). |
bb-dsl | Module trait, Graph recorder, syscalls. |
bb-compiler | The canonical compilation pipeline + Compiler driver + CompileError. |
bb-derive | Proc-macros: #[derive(bb::Concrete)], #[derive(bb::<Role>)], register_op!{}, register_protocol!{}. |
bb-ops | Every concrete component the framework ships: CpuBackend, FedAvg, the GlobalRegistry peer-sampling protocols, the wire transport. |
Built-in transports (bb-libp2p, bb-http) are not part of 0.3. Standalone
transport crates ship in a later release.
License
bytesandbrains is dual-licensed under AGPL-3.0-or-later and a commercial
license. Open-source use under the AGPL applies for most projects. Commercial
deployments that need an alternative see the license page.
Build from source (contributors)
Contributors and anyone who wants to track main between releases can clone
the workspace and depend on a path or a git revision instead of crates.io.
Clone:
git clone https://github.com/Bytes-Brains/bytesandbrains
cd bytesandbrains
cargo test --workspace --features test-components
Path dependency from a sibling project:
[dependencies]
bytesandbrains = { path = "../bytesandbrains" }
Or pin to a tag:
[dependencies]
bytesandbrains = { git = "https://github.com/Bytes-Brains/bytesandbrains", tag = "v0.3.0" }
The per-commit gate the workspace expects is documented in CLAUDE.md:
cargo fmt, cargo test --workspace --features test-components,
cargo clippy -- -D warnings, cargo doc,
cargo check --no-default-features, and cargo deny check.