import aqit re-exports aquin.sdk. The CLI is argv/print over this package.
Import
import aqit
aqit.train.run("recipe.yaml")
aqit.eval.custom(prompts="probes.jsonl")
aqit.inspect.trace(prompt="Hello", layer=8)
aqit.patch.steer(feature_idx=42, strength=2.0)
Equivalent:
from aquin import sdk
sdk.session.load_model("meta-llama/Llama-3.2-1B-Instruct")
import aquin stays light: Run, init, SDK, and AquinError load lazily so python -m aquin does not import torch.
Namespaces
| Module | Job |
| aqit.train | Recipe train + show(run_id) |
| aqit.eval | consistency / suppress / boundary / custom / confidence / red_team |
| aqit.inspect | diffs, trace, layer, attention, perturbation, weight, umap |
| aqit.patch | steer / sweep / multi_steer / save_vector |
| aqit.sae | load / train / align / stats / feature_* |
| aqit.session | load_model / unload / prompt / status |
| aqit.data | capture_activations / replay / features_compare |
| aqit.simulate | forecast train / list / replay / compare |
| aqit.AquinError | SDK failure ({"error": ...}) |
Session
import aqit
aqit.session.load_model("meta-llama/Llama-3.2-1B-Instruct")
print(aqit.session.active_model())
aqit.session.prompt("Hello")
snap = aqit.session.status()
aqit.session.unload()
Eval
aqit.eval.custom(prompts="probes.jsonl")
aqit.eval.consistency(query="...", templates="templates.json")
aqit.eval.suppress(topics="topics.json")
aqit.eval.boundary(...)
aqit.eval.confidence(...)
aqit.eval.red_team()
Keyword arguments match the CLI flags of the same verb (passed through aquin.sdk._runtime.invoke).
Inspect
aqit.inspect.trace(prompt="Hello", layer=8)
aqit.inspect.diff_weight(checkpoint="path/to/ckpt")
aqit.inspect.diff_sae(checkpoint="path/to/ckpt", prompts="probes.jsonl")
aqit.inspect.diff_residue(checkpoint="path/to/ckpt")
aqit.inspect.attention(prompt="Hello")
aqit.inspect.layer(prompts="probes.json")
Patch
aqit.patch.steer(feature_idx=42, strength=2.0)
aqit.patch.steer(feature_idx=42, save="vector.pt")
aqit.patch.sweep(feature_idx=42, strengths="0,1,2,4", prompt="Hello")
Errors
aquin.sdk._runtime.AquinError is raised when a tool returns {"error": ...} or fails to run. The original payload is on .result.
Runtime contract
build_ctx / prepare_compute / invoke:
- Resolve the active Hugging Face model id.
- Apply loader_shim and start the local engine server if needed.
- Call the named tool (registry / daemon / in-process).
- Return a JSON-shaped dict.
That is why CLI and SDK stay in lockstep: they share the tool name (run_full_inspection, run_steer_and_show, …).