Tool Use Loop
person concept tool org talk claim — click a node to jump to its page; hover an arrow for the relation
A tool use loop is the core execution pattern in agentic AI systems where an agent repeatedly calls external tools, processes their outputs, and decides whether to continue or terminate — typically implemented as a while True construct in Python.
Basic Structure
Frank Coyle (UC Berkeley) illustrates the pattern with its simplest form: a classic Python while True loop that drives the agent's repeated tool invocations until some exit condition is met. ↗
Validation Architecture Within the Loop
Coyle argues that the tool use loop requires validation at two distinct boundaries:
- Input boundary: Pydantic should be used to validate parameter types before a tool is called — ensuring the agent passes well-formed arguments.
- Output boundary: An ontology reasoner should validate the results returned by the tool — ensuring the output is semantically coherent and consistent with the system's knowledge model.
He summarizes this as "Pydantic at the door, ontology at the ledger," positioning the loop as the natural enforcement point for both syntactic and semantic correctness in agentic systems. ↗
This dual-validation framing reflects a broader thesis: that pure type-checking (as Pydantic provides) is insufficient for agents operating over rich, relational data, and that ontology reasoners are needed to catch errors that pass syntactic validation but violate domain semantics.