Thomas Piacentini
← Workshop

Project stage

Select the least costly sufficient profile

Original text · English120 min

Stage 3 of 4. Rust. Plan about 2 hours.

Filter insufficient profiles before comparing cost. Respect the configured cost ceiling, break ties by name, and return an explicit no-suitable-profile error. Never downgrade a required isolation control merely because the budget is too small.

pj sandbox ladder 3

Implementation boundary

rust
pub fn select(n:&Needs,candidates:&[Profile],budget:u32)->Result<Profile,Error>

Primary reference: Official reference.

Worked Orchard case

Before coding, review Rust ownership and Result and Docker for AI. Complete stage 2 first.

The cheapest sufficient profile may exceed the allowed budget. When kernel separation is required, budget 4 cannot silently downgrade to a container costing 3.

text
kernel separation required; candidates costs 1,2,3,5
budget 4 -> no sufficient profile
budget 5 -> microvm-fixture

Build and inspect

Filter by capabilities first, then cost, then stable name ordering. Return a limit error if the remaining set is empty.

Implement the stage in your learner workspace. The CLI helpers are provided adapters and import your functions; they do not substitute the reference solution.

bash
python3 scripts/project_test.py sandbox-ladder --stage 3 --path learning-artifacts/sandbox-ladder

Predict the intermediate state above, then run the stage. A fresh stub fails; a passing reference run does not establish completion of your learner workspace.

Investigate next

What should change when two sufficient profiles have the same modeled cost?

Code and artifacts 3
What you take away

Saved in your notebook on this device.

Sources and limits

Reading checkpoints are self-reported. Test results are recorded separately and apply to the executed cases.

AI Engineering from Scratch · 3f9715c · MIT

Download this file ↓