Inference Passthrough
Every Kernle user with a working AI application already has a model. Inference passthrough eliminates the need to configure a separate model binding for Kernle — your existing model “just works.”How It Works
Kernle supports two integration patterns, each with its own inference source:| Pattern | Inference Source | Setup Required |
|---|---|---|
| MCP server | Host agent’s model via MCP sampling | None (automatic) |
| Library embedding | Your existing generate() function | One line |
Model Binding Priority
When a tool is called, Kernle binds a model in this order:- Explicit model — if you’ve already called
k.entity.set_model(), that model is used - Persisted config — if you ran
kernle model set, that config is loaded - MCP sampling — if the MCP client supports sampling, the host agent’s model is used
- Capture-only — no model available; memory capture works, inference-dependent features are skipped
MCP Integration (Automatic)
If your MCP client supports thesampling capability (Claude Code, Claude Desktop), Kernle automatically uses the host agent’s model for inference. No configuration needed.
InferenceRequiredError, and inference-dependent features like emotion detection and contradiction finding are skipped.
Library Embedding (CallableModelAdapter)
For Python library users, wrap any(prompt, system) -> str callable:
Message Flattening
CallableModelAdapter flattens the message list into a single prompt string:
ModelProtocol directly instead.
No Model? Capture Still Works
Kernle operates in two tiers when no model is bound:- Capture tier —
raw(),episode(),note()always work without a model - Identity tier —
belief(),value(),goal(),drive(),relationship()require a bound inference model and raiseInferenceRequiredErrorwithout one
| Feature | Without Model |
|---|---|
raw() | Works normally |
episode() | Works normally |
note() | Works normally |
belief(), value(), goal(), drive(), relationship() | Raises InferenceRequiredError |
| Emotion detection | Returns neutral (valence=0, arousal=0) |
| Contradiction detection | Returns empty list |
| Suggestion extraction | Returns empty list |
Exports
CallableModelAdapter is available at the top level:
SamplingModelAdapter is internal to the MCP server and not exported at the package top level. The server instantiates it automatically when sampling is available.