Skip to content

feat(inference): add managed llama.cpp and native NIM services - #14611

Merged
cv merged 19 commits into
v1from
prekshi/14556-llama-cpp-nim
Nov 19, 2026
Merged

cv merged 19 commits into
v1from
prekshi/14556-llama-cpp-nim

Conversation

@prekshivyas

@prekshivyas prekshivyas commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Add managed llama.cpp and native NVIDIA NIM services to v1 so deployments can own model startup, readiness, inference routing and retained storage alongside their agents.

Problem

V0 users of llama.cpp or NIM need a managed inference lifecycle in v1. Generic containers do not provide pinned model acquisition, capacity admission, retained inference credentials or protected NGC credential delivery.

Part of #14556. Technical ownership and release timing remain maintainer decisions; this draft does not close the issue.

Change

  • Add typed llamaCpp and nim services, runtime contracts, installers and provider lifecycle coverage.
  • Acquire one immutable GGUF with size/SHA-256 verification; reuse the shared snapshot verification record on warm starts. Use upstream llama.cpp's digest-pinned b12375 CUDA server image.
  • Keep native inference authentication. Deliver llama.cpp's key by file. For NIM, mount the operator's NGC file read-only, authenticate native vLLM inference, and isolate its listener behind a private network and route filter. Keep NIM opt-in.
  • Share runtime locks, supervision, single-GPU memory admission and installer composition. Keep NIM's credential/network-specific inputs and streaming credential filter with NIM.
  • Replace the 17 GB maintained GPU fixture with a pinned 2.50 GB Qwen3-4B GGUF and move redundant unchanged-apply and graph assertions into non-GPU provider integration.
  • Regenerate schema/reference/provider artifacts. Read and validate intent formats 29 and 30; upgrade format 29 on the next successful save without changing resource identities or pending recovery state. Unsupported formats remain refused. Document the backup procedure and the older CLI's inability to read format 30.

The initial scope is one model on one CUDA GPU. Distributed inference is outside V0 parity. Other models/profiles, cross-host restoration and general agent/tool reliability need separate qualification.

Beyond CI

Source-specific Spark/L40S lifecycle, authenticated inference, unchanged reconciliation, teardown and bounded NIM agent results are recorded in #14556's qualification report, together with tested configurations, failures and remaining limits. General agent reliability, default-8K NIM and cross-host restoration remain unqualified.

@copy-pr-bot

copy-pr-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@prekshivyas

Copy link
Copy Markdown
Collaborator Author
Authoring session — opening
Field Status Value Evidence or limit
Harness recorded Codex Desktop; recorded CLI version 0.163.0-alpha.11.1 Root session metadata matches the workspace and branch activity; no inherited fork boundary is recorded.
Skills partial authenticating-entra-device-code; brev-cli; managing-calendar; managing-glean; nemoclaw-contributor-create-pr; reading-meeting-transcripts; test-driven-development; verify-yaml-deployment; write-tests Full-content matches in persisted tool outputs against 49 available skill files; historical changed versions and separate subagent records are not included.
Instruction files partial AGENTS.md; WRITING.md; PULL_REQUEST_TEMPLATE.md; SESSION_REPORT_TEMPLATE.md; contributing/documentation.md Complete-read matches in the root authoring record; other historical guidance versions and separate subagent instructions are not included.
Tool calls partial exec: 1644; followup_task: 3; request_user_input_async: 12; sleep: 74; spawn_agent: 1 Attempted function/custom-tool calls at the persisted root invocation layer, including failures. Exec wrappers and their nested calls are not added together; nested execution and separate subagent calls are not fully recorded at this layer.
Tokens partial input: 328128990; cached input: 324518272; output: 1040144 Last actual token_count cumulative snapshot plus unique response-level usage not yet reflected there, reconciled to the recorded per-thread cumulative counters through the cutoff. All 9 compaction response IDs have usage records; 0 placeholders and 0 counter decreases. Separate subagent usage is excluded; no reasoning subtotal is added again.
Session window recorded 11/17/2026, 11:34:43 PST to 11/18/2026, 10:05:46 PST; 22 h 31 min Whole root session through cutoff, including idle time, initial research, implementation and PR preparation; not a task-only interval. Later publication activity is excluded.
Compactions partial 9 root compaction events Persisted compacted events through cutoff; separate subagent histories are excluded.
Models partial gpt-6.1-sol Recorded root turn-context history; separate subagent model records are excluded.
Reasoning levels partial medium Recorded root turn-context effort history; separate subagent effort records are excluded.

@github-actions

Copy link
Copy Markdown
Contributor

Require the maintained manual NIM case to receive FOUR from the recorded
agent runtime. Reuse the verifier's answer assertion so nonempty unrelated
text no longer passes as a correct arithmetic reply.

Record the scoped OpenShell 0.1.9 L40S qualification in the model guides,
remove stale pending claims, and reference Fabric #679. Keep the utility
model schema gap separate from default-8K context and tool-quality failures.

Beyond CI: exact-source 7250d58 L40S evidence covers native NIM 2.0.12
BF16/llama3_json at 32K and pinned Muse llama.cpp, with auth, export/reapply,
network isolation, bounded restart and retained-storage teardown. Both
maintained transport lifecycles passed; NIM's agent answer was unrelated.
The stricter NIM answer gate has not passed live qualification. No runtime,
image, model, upstream pin or deployment configuration changes here.

Validation: pinned OpenTofu 1.13.9 replay through the unchanged verifier
accepted the saved unrelated reply under the old configuration, rejected
it with answer=FOUR, and accepted FOUR with that assertion. This is verifier
validation, not a live model run. HCL formatting and staged whitespace pass.
Documentation validation: cargo run --locked -p nemoclaw-build -- fern check
passed (0 errors; 2 warnings in each version check), using the
already-installed macOS 15.4 SDK and task-local pinned protoc 36.2.
Comment thread crates/nemoclaw-sdk/tests/compile.rs Resolved
Comment thread image/llama-cpp/Dockerfile Resolved
cv added a commit that referenced this pull request Nov 19, 2026
CI / Images and release staging build a llama.cpp runtime image, `llama-cpp`, for `linux/arm64` and `linux/amd64`: llama.cpp's CUDA 13.5 server image with NemoClaw's supervisor added, as the vLLM and Ollama images add it. No service runs it yet; [#14611](#14611) adds the runtime behavior on top of it.

## Problem

v1 builds and releases runtime images only for vLLM and Ollama, so managed llama.cpp has no image to run.
That image needs CUDA kernels for GB300 (`sm_103`) and GB10 (`sm_121a`) on both architectures, and llama.cpp's non-native CUDA builds gained `sm_103` only with [`fe14cad5`](ggml-org/llama.cpp@fe14cad) ("CUDA: add SM103 SASS to non-native builds").

Part of #14556; [#14611](#14611) adds the service.

## Change

- `image/llama-cpp/Dockerfile` starts from `ghcr.io/ggml-org/llama.cpp:server-cuda13-b12375`, pinned by its multi-platform digest `sha256:c1c63d621e3a87c31680d538a0009ac83d165ef04d13bad84683dbb20c114fbe`.
  `fe14cad5` first shipped in release [b12367](https://github.com/ggml-org/llama.cpp/releases/tag/b12367), but llama.cpp publishes images from daily builds, and [b12375](https://github.com/ggml-org/llama.cpp/releases/tag/b12375) (source `9d25e0014c4b4b316873c01f4938c0e3c687287d`, which contains `fe14cad5`) is the first `server-cuda13` image after it.
  On both architectures its CUDA backend carries machine code for `sm_86`, `sm_89`, `sm_103`, `sm_120a`, and `sm_121a`, and PTX for `sm_75`, `sm_80`, and `sm_90`.
- The image adds the supervisor and retained sources exactly as the Ollama image does. llama.cpp's image keeps no llama.cpp license, so `versions.json` pins llama.cpp's MIT license and the license files of the vendored libraries its server compiles in, and the image keeps them in `/opt/nemoclaw/source/`; [the notice](https://github.com/NVIDIA/NemoClaw/blob/v1/image/llama-cpp/NOTICE.md) records the source, the kernels, and the CUDA and Ubuntu notices the base keeps.
- Bake's `runtimes` group gains the `llama-cpp` target, so release staging builds, scans, joins, and lists it with the vLLM and Ollama images, and the release catalog reserves its name.
- CI / Images gains a `llama.cpp runtime / PLATFORM` job beside the `Build` jobs. It builds the image and runs `llama-server --version` and the supervisor's `--version` in it. It isn't a required check.
- The supervisor gains `--version`, which prints its package version without reading a specification.
- The build guide, notices, release notes, release, testing, and image license docs list the image; CUDA 13.5, like vLLM's CUDA 13.0, needs NVIDIA driver 580 or newer.

The base pin lives in the Dockerfile's `FROM`, as the vLLM and Ollama pins do; Bake can't read `versions.json`.
Left for #14611: the image's `org.nemoclaw.*` labels, the service kind, its schema, and the llama.cpp runtime.
Like the vLLM and Ollama images, the image isn't rebuilt when only the supervisor changes.

## Beyond CI

On a DGX Spark (GB10, driver 580.178.04, Linux ARM64), the image built with `docker buildx bake llama-cpp`. In it, `llama-server --version` reported build 12375, commit `9d25e0014`, the supervisor's `--version` printed `nemoclaw-runtime 0.1.0`, and `llama-server --list-devices` with the GPU listed `CUDA0: NVIDIA GB10`.
`cuobjdump --list-elf` and `--list-ptx` on both platforms' `libggml-cuda.so` showed the architectures above.
Inference on a GPU and the release staging job, which runs only for a tag, are unverified.


Signed-off-by: Carlos Villela <[email protected]>
cv and others added 8 commits November 18, 2026 22:04
…-nim

Signed-off-by: Carlos Villela <[email protected]>

# Conflicts:
#	docker-bake.hcl
#	image/llama-cpp/Dockerfile
#	image/llama-cpp/NOTICE.md
Reuse snapshot verification records and transport for GGUF acquisition. Share writer locks, supervision, single-GPU admission and installer composition while retaining backend-specific credentials and placement.

Keep inference authentication, move refusal probes out of startup readiness, and scope streaming redaction to NIM. Use a 2.50 GB GGUF in the live case and move duplicate assertions to the provider integration layer. Refresh schemas and the persisted format fingerprint.
cv added a commit that referenced this pull request Nov 19, 2026
Moves the managed inference container, storage, and credential lifecycle
out of the vLLM installer into a shared `installers/inference.rs`
module, so later managed inference installers can reuse it. vLLM
documents compile to the same OpenTofu resources, dependencies, and
errors.

## Problem

The vLLM installer owns the placement, process, storage, authentication,
and removal steps that every managed inference runtime needs. #14611
adds llama.cpp and NIM installers that would each repeat those steps.

Part of #14556. Extracted from #14611 so that PR can rebase onto it.

## Change

- `installers/inference.rs` (crate-private): `address`, `Runtime`,
`specification`, `install`, `remove`, and `credential_source`, moved
from the vLLM installer.
- `installers/vllm/mod.rs` calls the shared functions instead of its own
copies.
- Leaves out the llama.cpp and NIM installers, registry arms, schemas,
and documentation from #14611.

Co-authored-by: Prekshi Vyas <[email protected]>
cv added a commit that referenced this pull request Nov 19, 2026
Moves vLLM's backend supervision, output capture, writer lock, and
credential loading into the runtime's shared `execution` module, so
later managed runtimes reuse them instead of copying vLLM's. Runtime
behavior, error messages, and forwarded backend output don't change.

## Problem

The vLLM runtime owns its writer lock, memory sampler and readiness
task, route-filter supervision, output capture, and credential loading,
and Ollama repeats the writer lock. A new managed runtime, such as the
llama.cpp and NIM runtimes in #14611, would copy them again.

Part of #14556. Extracted from #14611, which can rebase onto this
change.

## Change

- `execution::lock` opens a lock file and takes its exclusive writer
lock with the caller's error messages; vLLM's storage and credential
locks and Ollama's storage lock use it.
- `execution::serve` runs the memory sampler and readiness task,
supervises the backend with or without a route filter, and explains its
exit from its output.
- `execution::supervisor::with_filter` is vLLM's route-filter
supervision, moved from `vllm/runtime/routes.rs`.
- `execution::output::Output` is vLLM's output capture, moved from
`vllm/runtime/process.rs`; it still redacts the one bearer key.
- `vllm/runtime/authentication.rs` moves unchanged to
`execution/authentication.rs`.

Ollama keeps its own sampler loop, because its readiness failures feed
the sample stream. Streaming output filtering, which only NIM needs,
stays in #14611.

---------

Co-authored-by: Prekshi Vyas <[email protected]>
cv added 2 commits November 19, 2026 02:39
Keep v1's shared inference installer and backend supervision code from #14646 and #14647, with this branch's llama.cpp and NIM additions on top. Output keeps the streaming filter NIM uses, and the intent record fingerprint covers v1's widened Ollama proxy engine.
@prekshivyas
prekshivyas marked this pull request as ready for review November 19, 2026 17:03
@cv cv assigned cv and prekshivyas Nov 19, 2026
@cv
cv enabled auto-merge (squash) November 19, 2026 18:07
@cv
cv merged commit 3d8641a into v1 Nov 19, 2026
83 of 86 checks passed
@cv
cv deleted the prekshi/14556-llama-cpp-nim branch November 19, 2026 18:31
cv added a commit that referenced this pull request Nov 19, 2026
Set RECORD_FORMAT to 31, above v1's 30, with the recomputed fingerprint.

Remove #14611's intent format 29 to 30 compatibility path, per the rule
that v1 keeps no state compatibility code before 0.1.0: the
compatible_previous check in Store::load, its format 29 tests, and the
upgrade guidance in docs/build-deploy/state.md and
docs/references/compatibility.md. A record in any other format, including
29 and 30, is refused like any other version.

The release note since rc11 now names record version 31.

v1's new llama.cpp and NIM Docker cases use the target shape:
spec.gateway.target.docker with port 17695, as the vLLM case does.
cv pushed a commit that referenced this pull request Nov 20, 2026
)

Each gateway selects its backend with one tagged `target`, which holds only what NemoClaw uses to install or reach the gateway there: `docker` or `podman` (an engine socket, an integer `port`, `networkCIDR` and `imagePullPolicy`), or `kubernetes` or `openshift` (the cluster target, authentication and `expose`). `runtime.provider` and the flat `endpoint`, `engine`, `networkCIDR`, `imagePullPolicy` and `kubernetes` fields are gone, a managed Kubernetes or OpenShift gateway without `expose` names no endpoint or port, and the intent record moves to version 31, so existing deployments need to be created again.

## Problem

Before this change, `gateway.runtime.provider`, the presence of `gateway.kubernetes` and the flat engine fields had to agree, through conditionals on the managed gateway and four root rules. Editors offered Docker's socket and a local HTTP endpoint on a Kubernetes gateway, a Kubernetes document had to author a loopback port that nothing bound, and plan bound that port as identity. `runtime.provider: openshift` was a flag on the Kubernetes shape that also decided whether `expose.route` applied.

Resolves #13829; #14588 tracks the chart settings a document still can't reach.

## Change

Following [cv's decisions](#13829 (comment)):

- **Document shape:** `gateway.target` is a `oneOf` of single-key objects, one Rust enum per management mode (`ManagedTarget`, `ExternalTarget`); omitting it still selects Docker with its defaults. Docker and Podman share one Rust struct and Kubernetes and OpenShift another, and the schema gives each target its own definition: Docker's `engine` defaults to Docker's socket and its `imagePullPolicy` takes `IfNotPresent` or `Never`; Podman requires `engine` and also takes `Always`; only `openshift`'s `expose` takes `route`. A violation reports its target's rule, and the root rules on `imagePullPolicy` and `kubernetes` are gone; the sandbox image, managed service and sandbox-cap rules key on a `kubernetes` or `openshift` target.
- **Ports and endpoints:** Docker and Podman take an integer `port` from 1024 through 65535, default 17681, instead of `endpoint`. A published cluster gateway's endpoint moves to `expose.endpoint`. Without `expose`, a cluster gateway has no endpoint: the Kubernetes resources no longer take `endpoint`, each command forwards a free local port, plan and apply print `OpenShell gateway: not published; …`, and JSON results leave out `connection.gatewayEndpoint`. The `openshell_gateway` data source takes `endpoint` only when `kubernetes` isn't set. OpenShell objects and Fabric agents on such a gateway carry an empty endpoint, which apply and refresh now accept: a carried field holds the configuration as written and is never observed, so an empty one is no longer an incomplete observation.
- **Pull Secrets:** `imagePullSecrets` is removed. Sandbox pods' pull Secrets go in OpenShell's `openshell.drivers.kubernetes.image_pull_secrets`, which NemoClaw no longer rejects in `config`. The gateway and certgen pods get none; they pull OpenShell's public images, and the limits page records the case of an authenticated mirror.
- **OpenShift:** `target.openshift` replaces `runtime.provider: openshift` and still passes the chart the two values that unset the gateway's UID and fsGroup, until ai-openshell/openshell#5483; then only those values go.
- **Plan:** plan and apply refuse a changed target on an existing deployment before they read or change anything, as they refuse a changed endpoint or exposure.
- **State:** the intent record moves to version 31, and the format 29 to 30 upgrade from #14611 is removed, because v1 keeps no state compatibility code before 0.1.0: a release refuses state in any other format.
- **Onboarding:** the journey asks `/spec/gateway/target` instead of the runtime, and the engine question and the suggested agent images follow the chosen target's engine.
- **Messages:** errors that named `spec.gateway.runtime.provider`, `spec.gateway.endpoint`, `spec.gateway.engine` or `spec.gateway.networkCIDR` name the target's fields.
- **Examples, docs and tests:** every example, case and fixture uses the new shape, the docs and the generated reference describe it, and the usage guide lists the edits that author a document for another target. A test applies only those edits to every example for each of the eight targets and parses the result; the unexposed kind case gains an unchanged plan.

Left out: a chart-values passthrough (cv's decision 2), and moving a live deployment to another target, which needs a new deployment. V0's `config export` still writes `runtime` and `endpoint`; the V0 migration skill replaces them with the `docker` target.

## Beyond CI

- **OpenShift Local:** `openshift-oidc` passed by hand at 575a9e4, twice, on one OpenShift Local 4.22.14 node (CRC 2.64.0, linux/amd64) with Agent Sandbox 1.0.3, using this branch's bundle and an OpenClaw image built from it: apply, a reply from each agent through the Route, an unchanged plan, and a destroy that kept only the gateway's storage, in 161 s and 76 s.
  - The `openshift` target gave the chart null `runAsUser` and `fsGroup`. OpenShift wrote the namespace's range, `1000720000/10000`, and admitted the gateway, both sandboxes and their supervisors under `restricted-v2`, each running as UID 1000720000 with `fsGroup` 1000720000.
  - The chart's pass-through Route served `https://<namespace>.apps-crc.testing:443`. The sandboxes pulled the agent image from the cluster's registry with the Secret that `openshell.drivers.kubernetes.image_pull_secrets` names, and the gateway pod got no such Secret.
  - Only this one amd64 node has run it, and no CI job runs `openshift-oidc`.

Signed-off-by: Hai Nguyen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Carlos Villela <[email protected]>
cv added a commit that referenced this pull request Nov 20, 2026
#14716)

The v1 release notes record what reached `v0.1.0-rc12` as that release
candidate's own changes and breaking changes, record what reached `v1`
after its tag, and add the managed llama.cpp service to the support
matrix. The release guide lists the `llama-cpp` package that staging
requires.

## Problem

`docs/about/release-notes.md` listed everything after `v0.1.0-rc11` as
unreleased, although `v0.1.0-rc12` is tagged at
1636069. Three user-visible changes in
it had no note: #14567, #14611, and #14594. The onboarding line from
#14598 and #14652 sat under rc11, although both merged after its tag.
The support matrix didn't list managed llama.cpp or its GPU case.

Staging `v0.1.0-rc12` first failed because
`ghcr.io/nvidia/nemoclaw/v1/llama-cpp` didn't exist: #14636 added the
image to staging, but `internal-docs/contributing/releases.md` doesn't
list its package among those a maintainer creates.

## Change

- Relabel "Changes Since v0.1.0-rc11" and "Breaking Changes Since
v0.1.0-rc11" as "Changes in v0.1.0-rc12" and "Breaking Changes in
v0.1.0-rc12", between the `v0.1.0-rc11` and `v0.1.0-rc12` tags, and
point the two links to them.
- Add "Changes Since v0.1.0-rc12" with what merged after the tag: the
Fabric `v0.7.0` pin (#14714), and apply pulling and reading every agent
image before it creates the gateway, with plan and the onboarding review
reporting an absent image (#14701). #14706, #14709, and #14717 change
only documentation. Add an empty "Breaking Changes Since v0.1.0-rc12".
- Add notes to rc12's changes:
- #14567: `spec.sandboxes.<name>.gpus` requests GPUs for an agent's
tools.
- #14611: a `kind: llamaCpp` service serves one pinned GGUF on one CUDA
GPU; `kind: nim` remains a candidate, with #14556's qualification
record.
  - #14594: images keep the license notices their components require.
- Move the line on choosing the one local image that installs the
harness (#14598, #14652) from rc11's section to rc12's.
- Support matrix: llama.cpp and the native NIM candidate in the `docker`
row; Model Services rows for managed llama.cpp, which the
`docker-openclaw-llama-cpp` case runs on the GPU runner, and for native
NIM, qualified by hand; the GPUs text covers llama.cpp and NIM hardware
checks and sandbox `gpus`.
- `internal-docs/contributing/releases.md`: list `llama-cpp` with the
packages a maintainer creates before staging.

Release candidates have no users, so the notes add no migration steps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants