#!/usr/bin/env bash # pi17-basalt-qwen4-35b-a3b-nvfp4-mt4096-5090 entrypoint. Runs inside the container; takes no arguments. # 127.0.0.1:9000 basalt serve: Qwen4-35B-A3B NVFP4 (kaushikvira), CONTEXT ctx (default 262144) # 127.0.0.1:4096 cli_shim.py: `pi -p --mode json` once per prompt, with a command watchdog (TOOL_TIMEOUT_S, 600 s) # 0.0.0.0:$M64_PORT agent_gateway.py: the agent.session API set -eu export HOME=/scratch/home WORK_DIR=/scratch/work SHIM_HOMES=/scratch/homes mkdir -p "$HOME" "$WORK_DIR/sessions" "$SHIM_HOMES" /scratch/cache export XDG_CACHE_HOME=/scratch/cache CTX=${CONTEXT:-262144} # Basalt's v2 config: engine flags, one model entry, the server on loopback. cat > /scratch/basalt_config.json <> "$M64_STATUS" /opt/basalt/bin/basalt serve --config /scratch/basalt_config.json & LLM_PID=$! export AGENT_HARNESS=pi export AGENT_HARNESS_TITLE="pi coding agent 1.7.0 (earendil-works/pi)" export AGENT_MODEL=qwen4-35b-a3b-nvfp4-basalt UPSTREAM_MODEL=qwen4-35b-a3b-nvfp4-basalt export AGENT_CONTEXT=$CTX AGENT_VISION=1 # The airbench checkup harness's settings (checkup.py output_cap / compaction_reserve) at 262144. export AGENT_MAX_OUT=32768 if [ "$CTX" -ge 262144 ]; then export AGENT_COMPACTION_RESERVE=65536; else export AGENT_COMPACTION_RESERVE=49152; fi export TOOL_TIMEOUT_S=${TOOL_TIMEOUT_S:-600} export LLM_BASE_URL=http://127.0.0.1:9000/v1 export RELAY_URL=http://127.0.0.1:9000 # the gateway's health check: basalt's /health export NODE_USE_ENV_PROXY=1 /opt/gateway/bin/python3 -u /capsule/cli_shim.py & SHIM_PID=$! alive() { [ -r "/proc/$1/stat" ] && [ "$(cut -d')' -f2 "/proc/$1/stat" | cut -d' ' -f2)" != Z ]; } ( while alive "$LLM_PID" && alive "$SHIM_PID"; do sleep 5; done echo '{"phase":"error","detail":"basalt or the pi shim exited"}' >> "$M64_STATUS" kill -TERM $$ ) & exec /opt/gateway/bin/python3 /capsule/agent_gateway.py