Ron Yifeng Wang, Aditya Akella (University of Texas at Austin):
We introduce ext, a safe, extensible, self-improving agent harness inspired by eBPF: agents write policies for their own execution, and a verifier proves each one satisfies the specified rules before it loads.
Our key insight is that we can give agents sufficient flexibility and extensibility to improve their execution through an interface narrow enough to verify every policy. The harness owns the mechanisms and enforces invariants, while agents write policies through typed hooks in a restricted language. Before loading any policy or revision, an SMT verifier (Z3) proves that it satisfies the built-in and operator-specified rules for every valid hook input.
Agents write their policies in a domain-specific language (DSL) we call extLang, which is based on a restricted, loop-free subset of Python. The language supports conditionals, arithmetic, comparisons,
min,max,abs, and constants. Policies can only read the typed state exposed by each hook and return values of the expected type. They cannot modify the harness’s state, access files, or make network calls.Each hook receives a read-only view of execution state. In the example below,
sholds the current run state (context size, budget, steps since compaction, subtask-boundary marks, and accumulated spend), andbdescribes an individual history step. Here is a lightly trimmed policy an agent wrote for itself in our bash-only harness:
def should_compact(s):
if s.ctx_tokens * 100 >= 95 * s.budget: # compact before overflow
return True
if s.steps_since_compact < 2: # no back-to-back thrashing
return False
if s.ctx_tokens * 100 >= 75 * s.budget:
return True
return s.ctx_tokens * 100 >= 55 * s.budget and s.marks_since_compact > 0
def compact_action(b, s):
if b.pinned or b.age <= 1: # keep pinned evidence & last 2 steps
return KEEP
if b.is_error and b.age <= 4: # keep recent failures
return KEEP
if b.age >= 12 or (not b.in_current_subtask and b.output_tokens > 150):
return MASK # command visible, output recallable
return KEEP
def choose_effort(s):
if s.cost_cents * 100 >= 90 * s.cost_budget_cents:
return LOW
if s.consecutive_errors >= 2 or s.recent_errors >= 3:
return HIGH
return MEDIUMWhat is eBPF?
For the uninitiated: eBPF lets Linux users attach small programs to kernel hooks (syscalls, network events, scheduler points) without writing kernel modules. The kernel refuses to load any program its verifier cannot prove will terminate and touch only allowed memory. ext applies the same bargain to agent harnesses: narrow, typed hooks, a restricted policy language, and a prover standing at the gate.
Leave a Reply