Skip to content
BenWibkingPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ATPI — ALCF Minerva pi drivers

pi (the pi coding agent) wrapper family bound to the ALCF Minerva inference endpoint, in the same spirit as the piago-X wrappers but pointed at Minerva and with automatic Globus token handling.

Endpoint

https://inference-api.alcf.anl.gov/resource_server/minerva/api/v1/*

Standard vLLM verbs: chat/completions, completions, responses, messages (Anthropic-style), embeddings, health, metrics. (embeddings/health/metrics return 404 for these generative models — expected.)

Models

Wrapper Model Notes
atpi → atpi-I bare dispatcher; defaults to inkling-bf16. atpi N ... / atpi I ... route explicitly
atpi-N nemotron-3-ultra reasoning model; tool-use ✅ native
atpi-I inkling-bf16 reasoning model; tool-use ✅ via toolfix proxy (see below); wraps text in `<

Both are tool-capable (OpenAI-style and Anthropic-style, auto + forced tool_choice).

inkling-bf16 tool-call quirk (important)

Direct-tested on 2026-08-03: inkling-bf16 on Minerva intermittently (~35%) emits its tool call as a raw harmony text token in message content:

<|content_invoke_tool_json|>{"name":"write","args":{...}}<|end_message|>

instead of a structured tool_calls field. When that happens, pi treats it as plain text and never executes the tool (measured 0/5 file-writes direct). nemotron-3-ultra does not have this problem (5/5 direct).

Default: atpi-I hits Minerva directly via the minerva provider (accepts the unreliable direct path on inkling). Optional fix: route through a local normalizing proxy (lib/atpi-toolfix-proxy.py, provider minervafix, port 8796) that rewrites the text-token tool call back into a proper tool_calls field — restoring reliable tool execution (5/5 after fix). Opt in with ATPI_PROVIDER=minervafix atpi-I ...; the proxy is auto-started on demand.

Auth

Minerva uses a Globus Bearer token that expires (~daily). The wrappers mint a fresh token on every launch and export it as $MINERVA_TOKEN, which the pi minerva provider's apiKey references.

Token is obtained via, in order:

  1. uvx alcf-ai auth get-access-token (preferred)
  2. legacy fallback: ~/Dropbox/AI-ENVIRONMENT/NEW/inference_auth_token.py get_access_token (known-good for Minerva on CherryRd)

First run auto-installs uv and runs uvx alcf-ai auth login (interactive Globus browser flow). Original manual recipe:

curl -LsSf https://astral.sh/uv/install.sh | sh   # if uv not installed
uvx alcf-ai auth login
export TOKEN=$(uvx alcf-ai auth get-access-token)

Note (2026-08-03): a stale cached alcf-ai credential can return a token that 401s on Minerva (scope mismatch). If that happens the wrappers fall back to the legacy inference_auth_token.py path automatically. A fresh uvx alcf-ai auth login also fixes it.

Install

cd ATPI
./bootstrap.sh              # installs uv+pi if needed, Globus login, wires provider + symlinks
./bootstrap.sh --no-login   # same but skip the interactive login (use legacy token path)

This:

  • ensures uv/uvx and pi
  • runs the first-run Globus login
  • installs a minerva provider into ~/.pi/agent/models.json (apiKey: "$MINERVA_TOKEN", both models)
  • symlinks atpi-N, atpi-I into ~/.local/bin and stages lib/atpi-common.sh

Use

atpi                                  # bare dispatcher -> inkling-bf16 (default)
atpi -p "one-liner please"            # non-interactive on inkling-bf16
atpi N "refactor this"                # route to nemotron-3-ultra
atpi I "refactor this"                # route to inkling-bf16 (explicit)
atpi --help                           # dispatcher help

atpi-I                                # interactive pi on inkling-bf16
atpi-N "refactor this module"         # interactive pi on nemotron-3-ultra
atpi-I -p "one-liner please"          # non-interactive print & exit
atpi-N --model inkling-bf16           # override the model (still Minerva)
atpi-I --provider <name> --model <id>  # escape hatch: pin any pi provider

Env toggles

Var Effect
ATPI_AUTO_UPDATE=0 disable pi package/extension update check
ATPI_SKIP_PROBE=1 skip the per-launch model reachability probe
ATPI_NO_FALLBACK=1 on failure, do NOT fall back at all
ATPI_FALLBACK_PROVIDER=radius free pi built-in gateway used on fallback
ATPI_FORCE_REFRESH=1 force a new token even if MINERVA_TOKEN is set
MINERVA_TOKEN=... supply your own token (skips minting)
ATPI_MODEL=... override default model for the variant

Fallback behavior

If the token cannot be minted or the target model is not reachable on Minerva, the wrapper transparently falls back to the free gateway that pi provides — the built-in radius pi-messages gateway — so you always get a working agent without depending on any Argonne-hosted resource.

The fallback never uses Argo or a liteLLM Argo proxy such as piago. If the fallback provider isn't configured (run pi, then /login radius), the wrapper re-execs plain pi and lets pi's own provider resolution choose a configured provider. Disable fallback entirely with ATPI_NO_FALLBACK=1, or point it at a different provider with ATPI_FALLBACK_PROVIDER=<name>.

Test

./test/test_atpi.sh

Checks: token mint, raw chat for both models, raw tool-call for both models, and a full pi round-trip through atpi-I and atpi-N. Exit 0 iff all pass.

Layout

ATPI/
  bin/
    atpi                       # bare dispatcher (defaults to atpi-I)
    atpi-N                     # nemotron-3-ultra wrapper
    atpi-I                     # inkling-bf16 wrapper
    atpi-install-provider.py   # installs the 'minerva' pi provider
  lib/
    atpi-common.sh             # shared: path setup, update check, bootstrap, token mint, probes
  test/
    test_atpi.sh               # smoke tests
  bootstrap.sh                 # one-shot installer
  README.md

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages