Oğuz Erol Full-Page Visual System Explainers
02 / 10 All Explainers (10) oguzerol.com Türkçe

What Is an AI Harness? 6 Core Building Blocks

The six infrastructure primitives wrapping a language model from incoming request to verified execution.

Context (Input + Rules)
Model: Proposes the next step
Harness: Checks, runs, and records everything around it
1 · Agent Loop

Iterates in bounded turns until a stop condition fires

Request: Where is order #8814?
Turn 1
Model
Tool: get_order(#8814)
Result: delivered, parcel #2 open
Turn 2
Model: writes draft reply
Draft ready
Draft Reply
Ends when: reply ready · approval needed · step limit hit
Look for an explicit stop rule: reply ready, human approval needed, or max steps reached.
2 · Tool Calling

The model never executes tools directly; the harness validates every call

Model
Asks: get_order, id: #8814
Reads: delivered
Replies: #8814 delivered
↓ To schema check ↑ Result back to model
Harness
Validates arguments & schema ✓
Executes the order tool
Test: If the model produces malformed arguments, the harness rejects them before execution.
3 · Context Management

Selects and compacts history so active context stays inside the token limit

Window Limit
Before
Instructions
Old Chat
Tool Results
↓ Compact
After
Instructions
Chat Summary
Latest Result
Free Space
Trap: If summarization drops order #8814, the agent loses critical state!
4 · Checkpointing

Persists step state so crashes or handoffs resume instead of restarting

No checkpoint
(1) Read order (2) Draft reply Crash (3) Check (4) Send
✕ Restarts from step 1
With checkpoint
(1) Read order (2) Saved: #8814 delivered Crash (3) Check (4) Send
✓ Safely resumes at step 2
Why it matters: Survives worker crashes and human handoffs without re-running steps.
5 · Permissions & Sandboxing

Draws hard boundaries around tool permissions and code execution

Tool Request
Permission Check
Allowed Read order
Ask user Change delivery address
Blocked Issue direct refund
Sandbox

Isolated area where agent code runs

API keys stay outside the sandbox
Ask: Is the limit enforced by platform code, or only requested in a prompt?
6 · Guardrails

Multi-stage policy checks before any message or action leaves the system

Customer message
Input check
Agent proposes action
Action check
Drafted reply
Output check
Human approval
Waiting Approved & sent ✓
Guardrails are a safety net, never a 100% guarantee on their own.
End-to-End Request Lifecycle
1
Request
2
Context
3
Loop
4
Permit
5
Tool
6
Save
7
Approve
8
Reply Sent