Agents · Qwen4-35B-A3B · llama.cpp · AMD Radeon 8060S · 38 GB VRAM
published by @dh7 on
m64 m64_bc63e0883ee5pi coding agent on Qwen4-35B-A3B UD-Q6_K_XL with MTP drafts, local (llama.cpp Vulkan, AMD Strix Halo). pi coding agent 1.7.0 (earendil-works/pi), driven through `pi -p --mode json`, with Qwen4-35B-A3B (Qwen's 35B-A3B MoE with 20B n-gram embeddings, Unsloth's UD-Q6_K_XL GGUF) served by stock llama.cpp master dd6b0fa (llama-server, built with Vulkan, run on Mesa RADV; Qwen4 support from #33626) in the same container, with the same engine settings as opencode-qwen4-35b-a3b-q6xl-mtp-strixhalo, so the pair differs only in the harness: a more precise quant than the Q4 capsule (mean KLD 0.0247 vs 0.0375) with the 22 GB n-gram table memory-mapped in system RAM at no speed cost, MTP speculative decoding with the model's own head (2 draft tokens, +22-27% generation), 262144-token context with a q8_0 KV cache, pictures on, the model card's thinking-mode sampling. Each session gets an empty directory; the agent can write and run code there, and every tool call is reported. Asks for no network: prompts and code stay on this machine.
Lineage
- parent
- claims m64_2eac365996ff, 29% shared files
- derived from
- no published capsule shares half its files
- children
- none
Files
7 files- human/
- index.html10.4 KB
- agent_gateway.py12.8 KB
- AGENT.md6.4 KB
- capsule.toml2.4 KB
- cli_shim.py17.8 KB
- Dockerfile3.9 KB
- start.shexec3.7 KB
AGENT.md
pi coding agent (Qwen4-35B-A3B UD-Q6_K_XL with MTP on llama.cpp Vulkan, local, AMD Strix Halo)
This service is a coding agent you drive over HTTP. You open a session, send it a task in plain English, and it does the work: it writes files, runs shell commands and reads the results until it is done. Then it replies. The harness is pi 1.7.0 (earendil-works/pi), run in its one-shot JSON mode, once per message. The model is Qwen4-35B-A3B (Qwen's 35B-A3B mixture-of-experts model with 20B n-gram embeddings; Unsloth's UD-Q6_K_XL GGUF, with MTP speculative decoding), served by llama.cpp (Vulkan, Mesa RADV) on an AMD Strix Halo GPU (Radeon 8060S) in the same container: prompts and code stay on this machine.
Each session works in its own empty directory, and you can list, download and upload its
files. The agent runs in a sandbox, as a non-root user. It has no network unless the person
who served it granted some (then every connection is logged: network in GET /status), so
give it work that needs no downloads. Python 3, node 22, git, ripgrep, jq and a C toolchain are
installed.
You cannot choose the model, tools or system prompt. You send only message text and files.
Security note
- Sessions are not isolated from each other. Every session runs as the same user, in the same container, so an agent in one session can read and change other sessions' files. Use one running service per person or project, not per session.
Base URL: {{BASE_URL}}
Quick start
SID=$(curl -s -X POST {{BASE_URL}}/v1/sessions {{AUTH}} \
-H "Content-Type: application/json" -d '{}' | jq -r .id)
curl -s -X POST {{BASE_URL}}/v1/sessions/$SID/messages {{AUTH}} \
-H "Content-Type: application/json" \
-d '{"text": "write hello.py that prints hi and run it"}' | jq '{text, elapsed_s, tools: [.tools[] | {tool, status}]}'
curl -s {{BASE_URL}}/v1/sessions/$SID/files {{AUTH}}
curl -s "{{BASE_URL}}/v1/sessions/$SID/files?path=hello.py" {{AUTH}}
Routes
POST /v1/sessions
Creates a session with a fresh empty directory. The body is optional: {"title": "..."}.
Returns 201 with {"id": "ses_...", "title": ..., "created": <unix time>}.
POST /v1/sessions/{id}/messages
Sends one task or follow-up to the session. The agent remembers earlier messages in the
same session (pi's --continue).
text(string, required): what to do.wait(bool, defaulttrue): withtrue, the request blocks until the agent's turn is over. That can take a few seconds or several minutes, so set your client timeout to at least 10 minutes. Withfalse, it returns202at once; follow the turn on the events stream, whoseturn.endevent carries the same fields as the reply below.
Reply (with wait: true):
{"role": "assistant", "text": "Created hello.py ... it prints: hi",
"tools": [{"tool": "write", "status": "completed", "input": {...}, "output": "..."},
{"tool": "bash", "status": "completed", "input": {"command": "python3 hello.py"}, "output": "hi\n"}],
"exit_code": 0, "elapsed_s": 6.2}
tools lists every tool call in the turn, and each output is cut to 4000 characters.
A non-zero exit_code means pi itself failed (for example, the model ran out of context);
the reply then carries an error string with the end of pi's error output.
A second message to a session whose turn is still running returns 409.
GET /v1/sessions/{id}/events
Server-sent events for this session, one data: JSON line each:
{"type": "turn.start", "text": ...}, then one {"type": "output", "line": ...} per line pi
prints (each line is one of pi's own JSON events: messages, tool_execution_start,
tool_execution_end, ...), then {"type": "turn.end", ...} with the same fields as the
wait: true reply. The stream stays open; close it when you are done.
curl -sN {{BASE_URL}}/v1/sessions/$SID/events {{AUTH}}
GET /v1/sessions/{id}/files[?path=...]
With no path, or a directory path, it lists entries:
{"path": ".", "entries": [{"name": "hello.py", "type": "file", "size": 12}]}.
type is file, dir or other (a FIFO, socket or device).
A file path returns the file's bytes as a download (Content-Disposition: attachment).
The agent wrote these bytes, so they are never served as a web page: the type is
text/plain, image/png, image/jpeg, image/gif or image/webp when the extension
says so, and application/octet-stream for everything else (.py, .html, .svg...).
A path that leaves the session directory, contains a NUL byte, or names something other
than a regular file or directory returns 400. A missing path returns 404.
PUT /v1/sessions/{id}/files?path=...
Uploads the raw request body to path in the session directory, creating parent
directories as needed. 400 if path exists and is not a regular file. Returns 201 with
{"written": "data/input.csv", "bytes": 1234}.
curl -s -X PUT "{{BASE_URL}}/v1/sessions/$SID/files?path=data/input.csv" {{AUTH}} \
--data-binary @input.csv
POST /v1/sessions/{id}/abort
Stops the session's running turn (pi's process is killed). A messages request waiting on
that turn then returns with a non-zero exit_code.
GET /v1/agent
What this agent is: harness, model and sandbox policy.
GET /status
Start-up progress: phase is building, starting, loading, ready or error.
network summarises the sandbox's outbound connections, and lists blocked attempts.
Timings and concurrency
- First start builds the container image and downloads about 18 GB of weights; after that, loading the model takes several minutes (budgeted at 900 s).
- A small task such as the quick start takes seconds to a minute; bigger tasks take minutes, depending on the model's speed and how many steps the agent takes.
- Sessions are independent and can run in parallel. Send one message at a time per session, and wait for the turn to end before you send the next.
- Sessions and their files live only as long as this run of the service. Download what you want to keep.
Errors
401: missing or wrong token. SendAuthorization: Bearer <token>.503withRetry-Afterwhile the service is still starting: wait and retry.404: unknown session id, file not found, or a route this service does not offer.409: the session is still busy with a turn.400: the body is not a JSON object,textis missing, or a path escapes the session.5xxotherwise: retry once, then checkGET /status.
capsule.toml
schema = "m64/capsule@1"description = "pi coding agent on Qwen4-35B-A3B UD-Q6_K_XL with MTP drafts, local (llama.cpp Vulkan, AMD Strix Halo). pi coding agent 1.7.0 (earendil-works/pi), driven through `pi -p --mode json`, with Qwen4-35B-A3B (Qwen's 35B-A3B MoE with 20B n-gram embeddings, Unsloth's UD-Q6_K_XL GGUF) served by stock llama.cpp master dd6b0fa (llama-server, built with Vulkan, run on Mesa RADV; Qwen4 support from #33626) in the same container, with the same engine settings as opencode-qwen4-35b-a3b-q6xl-mtp-strixhalo, so the pair differs only in the harness: a more precise quant than the Q4 capsule (mean KLD 0.0247 vs 0.0375) with the 22 GB n-gram table memory-mapped in system RAM at no speed cost, MTP speculative decoding with the model's own head (2 draft tokens, +22-27% generation), 262144-token context with a q8_0 KV cache, pictures on, the model card's thinking-mode sampling. Each session gets an empty directory; the agent can write and run code there, and every tool call is reported. Asks for no network: prompts and code stay on this machine."kinds = ["agent.session"]authors = ["dh7"]license = "mit"parent = "m64_2eac365996ff4819eec2e2ab73576978a2059a0067b293651a0a0f564597968b"[hardware]platform = "linux-x86_64"gpu = "AMD Radeon 8060S"gpu_count = 1# Unified memory, split by the BIOS (64 GiB VRAM on evo-x2): 30.5 GB of UD-Q6_K_XL transformer weights (with the MTP# head), the 0.9 GB picture reader, a small q8_0 KV cache (10 of 40 layers attend), a 2048-token micro-batch, plus# about 2 GB for the harness and gateway. The 21.8 GB Q8_0 n-gram table stays in system RAM, memory-mapped.vram_gb = 38disk_gb = 55[runtime]sandbox = "container"# No image: the Dockerfile builds llama.cpp master dd6b0fa with Vulkan (Mesa RADV) and adds node 22 + pi 1.7.0.gpu = trueshm_gb = 8internal_port = 9500health = "/health"expected_load_seconds = 300model_name = "qwen4-35b-a3b-ud-q6_k_xl"user = "65534:65534"# Unsloth's UD-Q6_K_XL GGUF (two shards: the transformer weights with the MTP head, then the Q8_0 n-gram table) and# the F16 picture reader, at the same revision as opencode-qwen4-35b-a3b-strixhalo.[[artifacts]]type = "hf"repo = "unsloth/Qwen4-35B-A3B-GGUF"revision = "85a51187d937d87d799be9a10fa30732ee31432c"include = ["README.md", "UD-Q6_K_XL/Qwen4-35B-A3B-UD-Q6_K_XL-00001-of-00002.gguf", "UD-Q6_K_XL/Qwen4-35B-A3B-UD-Q6_K_XL-00002-of-00002.gguf", "mmproj-F16.gguf"]mount = "/weights/qwen4"