Agentic AI
From a bare API call to a harness: tools, context, guardrails, verification, and an autonomous loop.
NCRM LLMs course - 2026
Basic API call: one request, one response, no harness
{
"id": "gen-1730000000-Xa9",
"provider": "OpenAI",
"model": "openai/gpt-4o-mini",
"object": "chat.completion",
"created": 1730000000,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "An LLM API call sends your text straight to a model on a remote server and returns its generated response as plain data: no chat interface, no memory, no tools. For a survey researcher, it means you can script model outputs and log every parameter, rather than clicking through a chatbot you cannot reproduce."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 22,
"completion_tokens": 72,
"total_tokens": 94
}
}
The important absence: no memory, no tools, no loop, no verification. The call ends when generation stops.
Embedd the API call in a workflow
What if the LLM had autonomy?
The user names the desired outcome, not the steps.
The LLM is the brain. It reasons about the next action.
What does the brain need to get there? A harness that turns reasoning into bounded work.
loop + tools + checks
The surrounding software starts deciding what the model can see, remember, do, and verify.
The agent loop
Same loop shape; heavier machinery inside each turn.
The brain, the tools, the memory, and the runtime
We give the LLM a browser. Is a tool enough to accomplish the task?
Use a browser to open Hacker News, upvote a target story, handle login if needed, and only claim success when the trace proves the upvote landed.
If a model can use a browser, maybe it can accomplish the task.
A browser-capable agent can still report success without evidence. It reaches a login or redirect, infers success, and says the work is done.

A comprehensive harness
Every tool has two parts: a schema for the LLM and code for the harness
The loop stops in exactly two places
Verification reads the trace
The harness can handle known failures without asking the model to improvise. A login redirect is repaired by harness_auto_login and recorded as a trace event. The model still decides what to do next; the brittle operational step is deterministic code.
Guardrails ask "should this run continue?"
Verification asks "did it succeed?"
Catch too many steps, forbidden actions, unsafe file changes, or missing approval. They stop structurally bad runs before they spiral. They do not make the final answer true.
Guardrails: structural failure
You need both. A run can obey every guardrail and still be semantically wrong.
Testing the harness
browser tools: yes
harness verifier: no
auto-login: no
Can claim success after /vote redirect.
browser tools: yes
harness verifier: yes
auto-login: yes
Passes only when trace proves success.
When failure modes are missing tools...
What is the mean of stflife (life satisfaction) for Germany?; memory kept 3 item(s)query_data("stflife", "DE")7.20Suggested reveal: everything off; then Verify + Guardrail; then Tools + Verify. The fix is a missing capability, not a better pep talk.
Testing the harness
Optional: npm run trace:md -- --latest turns the JSON trace into a readable walkthrough.
Everything we talked about, falling into one system
The LLM, tools, a planning loop, context engineering, a sandbox, memory, an orchestration layer, and a serving layer — the scaffolding that wraps an LLM to make it useful for real work, not just answering one prompt.

The registry is the action surface
Long runs fail through compounding errors




Cognition, "A Theory of Building Long-running Agents."
Guardrails sit outside the model and stay deterministic when the boundary matters
One harness, multiple agents?
Surface risk without stopping low-risk work.
Limit iterations, messages, spend, and time so a bad loop cannot run away.
The real lever is the runtime (& permissions)

Based on Paul Goldsmith-Pinkham, "Permissions, Sandboxes, and Autonomous Agents."
The call ends when the goal is checked, not when the model stops talking
The model says, "done."
The harness checks the actual final state against the goal.
A test, a query, a browser check, a structured scorer, or a human approval gate. Whatever turns "success" into a deterministic predicate the model cannot narrate away.
Which part of the harness do we actually control?
If we use existing software — Claude Code, Codex, Cursor — we only control part of the harness. That configurable part has a name for each piece.
Configurable surfaces
Skills, progressive disclosure, commands, hooks, MCPs, plugins — the parts of the harness you configure.
Commands, skills, MCP: three layers that compose
System prompt = instinct. AGENTS.md = project README. Tools/MCP = hands. RAG = library. Skills = the runbook.
A skill is a prompt? o.O
Context bloat? Metadata first, full skill on demand.
A command is deterministic; a skill is a suggestion
A user-initiated shortcut. You type /command, the tool injects the prompt, and the agent executes it. Commands are for ergonomics, so keep them stable.
The agent decides whether it needs that context and loads it when appropriate. Skills are for policy; they need to be reviewable.
The strongest pattern: keep complex, long-lived instructions as skills; use commands as ergonomic shortcuts to trigger any combination of them. Update a skill and you change behaviour without a new incantation; update a command and you change the incantation itself.
Event-driven automations that fire before or after tool executions

MCP is a wrapped API...

Client · server · tools · API. Build one with FastMCP: a name, instructions, then @mcp.tool / @mcp.resource / @mcp.prompt.
Plugins bundle skills, subagents, commands, hooks, and MCPs as one installable unit
From vertically integrated to primitives: Claude to Pi, OpenCode, and Letta
The question becomes concrete: which part of the harness are we changing, and which part is hidden inside the product?
Vertical product
Fast start, but loop, memory, tools, and verification are mostly bundled.
Controlled workflow
Explicit nodes, inspectable transitions, and bounded autonomy.
Primitive harness
More exposed control over models, memory, tools, runtime, and local workflow.
What changes when we use skills?
Load a playbook on demand.
Run checks around tools.
Start repeatable workflows.
What changes when we use skills?
Rethinking what we learnt
Agents make us reconsider context, prompting, and the human in the loop.
grep > semantic search. Is the vector database still needed? Is RAG dead?
Prompt engineering is (sort of) dead: what matters is skills and workflows
Human in the loop? The /goal is to remove it
The model is the brain.
The product is the loop, the tools, the context, the environment, and the checks, everything except the weights.