# Terminal-Bench: Evaluating AI Agents | Stanford CS329Z Guest Lecture with Alex Shaw & Ryan Marten

## Executive summary

This lecture introduces the paradigm shift from deductive software engineering to inductive agentic AI. As AI agents become increasingly stochastic, traditional code inspection is insufficient; therefore, empirical evaluation (Evals) has become the 'source of truth.' Terminal-Bench and the Harbor framework provide the necessary infrastructure and methodology to measure how well agents accomplish complex, real-world tasks in a terminal environment, focusing on the critical components of task design, verification, and preventing reward hacking.

## Key takeaways

- Evals as the Source of Truth: Because agents introduce a stochastic element, the behavior of the resulting system cannot be fully deduced from the code. Consequently, outputs and empirical evaluations must be used to understand what a program can and cannot do.
- The Inductive Development Cycle: The new digital technology development life cycle starts with an objective, requires a robust evaluation method, and is highly iterative (experimentation and optimization), contrasting with the linear, deductive cycle of traditional software engineering.
- Terminal-Bench and Harbor: Terminal-Bench is a frontier evaluation that measures agents solving hard, long-horizon tasks in a terminal environment. Harbor is the open-source framework designed to formalize and automate these agent evaluations (eval-driven development).
- Task Components: A complete agent task is defined by three parts: the Instruction (the prompt), the Environment (the simulated distribution, often a Dockerfile), and the Test/Verifier (the grading logic).

## Technical details

- Agent Evaluation Methodology: Agent evaluations are fundamentally empirical. A task is a single test with defined inputs and success criteria (the verifier). A trial is a single attempt. A trajectory is the complete record of the agent's actions, tool calls, and reasoning.
- Infrastructure and Sandboxing: Harbor ensures task independence by requiring that every trial is independent, preventing shared state or resources. This is achieved using specialized infrastructure like Neo Cloud Sandbox providers to spin up fresh container or VM instances for each trial.
- Verifier Design and Challenges: The verifier is often treated as a classifier. Key challenges include ensuring a complete one-to-one mapping between requirements and the verifier, preventing reward hacking (where agents are rewarded for non-intended outcomes), and managing the trade-off between programmatic checks and fuzzy subjective verification (e.g., using an LLM judge).
- Task Realism and Scope: Tasks are designed to simulate real-world distributions. Realism can be achieved by modeling 'messy' environments (e.g., scattered files) or by using sophisticated infrastructure like Docker Compose to simulate microservices.

## Practical implications

- Companies must shift focus from merely writing specifications to becoming expert evaluators, defining the correct decision boundaries for their verifiers.
- The full set of trial traces, not just a single score, must be reported to provide high-dimensional insight into agent behavior and identify reward hacks.
- The process of building and maintaining these benchmarks requires rigorous quality assurance (QA), including static analysis and 'red teaming' the task to find flaws.

## Topics

Agentic AI, Evaluation Engineering, Build Systems, LLMs, Software Testing, CI/CD, Terminal-Bench, Harbor, SWE-bench

Source: https://www.youtube.com/watch?v=7GW-9ug2nvw
