The switchover from Python to Rust-backed types is complete (Milestones 1-5).
from amplifier_core import AmplifierSessionnow returns the Rust-backedRustSessionfrom amplifier_core.session import AmplifierSessionstill returns the pure-Python typefrom amplifier_core import HookRegistryreturnsRustHookRegistryfrom amplifier_core import CancellationTokenreturnsRustCancellationTokenfrom amplifier_core import ModuleCoordinatorreturns a thin Python subclass ofRustCoordinator
All 384 Python tests pass, covering:
- 196 original Python unit tests (
tests/) - 188 bridge, switchover, and dogfood validation tests (
bindings/python/tests/)
The Rust kernel also has its own test suite (190+ tests via cargo test).
# Clone and switch to the rust-core branch
git clone https://github.com/microsoft/amplifier-core.git
cd amplifier-core
git checkout rust-core
# Install Rust toolchain (required for building from source)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Build and install the Rust-backed wheel
pip install maturin
maturin develop
# Verify it works
python -c "from amplifier_core import AmplifierSession; print('Rust core loaded successfully')"
python -c "from amplifier_core._engine import RUST_AVAILABLE; print(f'Rust available: {RUST_AVAILABLE}')"The amplifier-core package now includes a Rust-compiled extension module (_engine) that provides high-performance implementations of Session, Coordinator, HookRegistry, and CancellationToken. Top-level imports return the Rust-backed types; submodule paths still give the pure-Python implementations.
| Import path | Returns |
|---|---|
from amplifier_core import AmplifierSession |
RustSession (Rust-backed) |
from amplifier_core.session import AmplifierSession |
Python AmplifierSession |
from amplifier_core import HookRegistry |
RustHookRegistry |
from amplifier_core.hooks import HookRegistry |
Python HookRegistry |
from amplifier_core import CancellationToken |
RustCancellationToken |
from amplifier_core import ModuleCoordinator |
Python subclass of RustCoordinator |
- All 61 public symbols in
amplifier_core - All Pydantic models, Protocol interfaces, module loader, validation framework
- The API surface is identical — the Rust types expose the same methods and properties
- Rust types are the default at the top-level import
RUST_AVAILABLEflag isTruewhen the Rust extension is loaded- Dogfood validation tests confirm real Foundation usage patterns work end-to-end
# Rust kernel tests
cargo test -p amplifier-core
# All Python tests (original + bridge + dogfood)
uv run pytest tests/ bindings/python/tests/ -v
# Just the dogfood validation tests
uv run pytest bindings/python/tests/test_dogfood_validation.py -v
# Everything together
cargo test -p amplifier-core && uv run pytest tests/ bindings/python/tests/ -vIf you encounter any issues:
- Check if the issue reproduces with the Python-only version (main branch)
- Include the output of
python -c "import amplifier_core._engine; print(amplifier_core._engine.__version__)" - Include your platform info (OS, Python version, Rust version)