01 / TWO PIECES WORKING TOGETHER
What is a harness versus an LLM?
The LLM predicts tokens. The harness is the software around it: it prepares messages, offers tools, checks requests, runs allowed actions, returns results, and decides when the process stops.
Together, a model and a harness that lets it choose actions form the kind of agent we use in VCC. A chat app can have a simple wrapper. An agent harness adds a loop where the model can request actions, observe what happened, and choose the next step.
The harness runs the tools and returns their results to the LLM
This example follows one calculator task. The LLM requests the operation; the harness checks and executes it. A task can repeat the tool cycle several times before the model supplies a final answer.
Swipe or scroll sideways to view the whole diagram.
A harness may include a router. It could use simple rules, a trained classifier, or another model call to choose a tool, workflow, or specialist. A separate classifier is one possible design; a harness does not have to contain one.
QUESTION If an LLM writes “I read your file,” which evidence would show the file was actually read?
02 / FOLLOW ONE REQUEST
How tool calls work
The model requests are scripted for this browser demo. The router uses visible rules, and the calculator really executes JavaScript. The downloaded harness below makes actual LLM requests in your VCC terminal.
- Step through the arithmetic task. Point out the model’s requested operation, the harness’s argument check, and the actual tool result.
- Try the notes task. The harness retrieves a fixed class note, then provides it as data for the next model turn.
- Try the unknown tool and repeated-step cases. Explain why the harness stops.
03 / ASSIGNMENT
Build your own harness around an LLM.
Use the VibeCodeCentral app to build a small harness, then run it with the classroom LLM in your terminal. Start with a calculator because its result is easy to check.
- Open VCC Projects ↗ and create My first harness. Stay in VCC sandbox.
- In Build & activity, give Ask agent the build prompt below. Wait for its checks.
- Open coding workspace → Start workspace → Bash. Use
pwdto confirm the project folder. Bash runs commands; the OpenCode tab takes instructions to the coding agent. - Run the offline fixture first, then one real model run. Inspect the trace before changing anything.
- Change the system prompt or add one small read-only tool. Predict the effect, rerun, and compare.
Build my Lesson 5 harness in a new lesson5 folder without changing the starter app. Use Node.js 20+ and no added packages. Download the two class starter files from /lab/agents/downloads/harness.mjs and /lab/agents/downloads/tools.mjs into that folder and inspect them. Preserve --offline as a clearly labeled fixed 17 × 23 fixture. The live mode must use the existing VCC gateway at http://models.vcc/v1/chat/completions and the classroom model from /etc/opencode.json, without personal API keys. Keep system/user/assistant/tool roles and tool_call_id links. Expose only calculate, validate names and numeric arguments, return tool errors, stop after four model requests, and set an output limit. Log the requested tool, actual result, final answer, and provider usage if available. Add meaningful tests for arithmetic, division by zero, invalid inputs, and the stop limit using a fake model endpoint. Run those tests and the existing project tests/build. Tell me the Bash commands and files changed.
Get the starter directly
You can inspect and copy the files, or use these commands in your project’s Bash terminal. Use a fresh project/folder so existing work is preserved.
mkdir lesson5 cd lesson5 curl -fSLO /lab/agents/downloads/harness.mjs curl -fSLO /lab/agents/downloads/tools.mjs node harness.mjs --offline node harness.mjs "Use the calculator to multiply 17 by 23, then explain the result."
Download harness.mjs · Download tools.mjs. Keep the two files in the same folder. The live command works inside a running VCC workspace; a laptop terminal does not have the internal classroom gateway.
04 / CHECK YOUR HARNESS
What the harness controls
The harness checks a tool request before executing it
Tool schemas describe the available functions. The harness still validates the actual name and arguments, and applies its own request and output limits.
Swipe or scroll sideways to view the whole diagram.
In a successful live run, find these pieces in the terminal:
- Harness: packages system and user messages plus a tool schema.
- Model: returns a structured request for
calculatewith operation and numbers. - Harness: validates the name and arguments, executes the JavaScript function, and attaches the result to the matching tool call ID.
- Model: reads that result and writes a final answer.
- Harness: stops on final text or its request limit.
Try division by zero and an unsupported tool name in your tests. Check that neither runs an arbitrary command. For the loop test, use a fake model that always requests another tool; it should stop at the configured cap.
If you add a class-notes tool, keep its data in a fixed text string first. The tool result should identify where that note came from. The harness should decide which functions are allowed; generated text should never be evaluated as arbitrary JavaScript.
05 / SUBMISSION
Review and submission
Turn in: your harness files or Git commit, a live trace showing 17 × 23 = 391 from the tool, one error-handling test, one stop-limit test, and a short explanation of your change.
Finish in VCC: inspect git diff, run the relevant tests/build, commit a version you can explain, then select Save checkpoint and Save and stop.
Review: If we kept the same LLM but removed its harness, which abilities would disappear? Name one place where your harness, rather than the LLM, makes a decision.
Instructor notes & sources
Allow about 5–10 minutes for the opening model, 15 for the browser investigation, 20–25 for the VCC activity, and 5 for the review questions. Students can work in pairs and compare their answers. Provision VCC access before class. The demos need no sign-in, API key, or paid inference. If class AI is unavailable, students can inspect demos, run the offline harness, and write expected traces; the live assignment still needs a later model run.
Assess the prediction, trace, and explanation along with the result. The small models, invented player data, fixed chat replies, and scripted browser requests are labeled at the point of use.
Further reading: Attention Is All You Need · Chat templates · Agent workflows and routing · Switch Transformers.