We built a small runnable mock check for an agent-trace relationship that a schema check does not cover: a tool-call ID exists, but belongs to another trace.
In this illustrative contract, IDs are scoped to a trace. A and B can both use call-17; C declares call-18 but its result points to call-17. A global set of call IDs accepts every result. Checking (trace_id, tool_call_id) finds the wrong association.
This standard-library snippet includes six call/result events:
events = [
("A", "call", "call-17"), ("A", "result", "call-17"),
("B", "call", "call-17"), ("B", "result", "call-17"),
("C", "call", "call-18"), ("C", "result", "call-17"),
]
global_ids = {call for trace, kind, call in events if kind == "call"}
assert all(call in global_ids for trace, kind, call in events if kind == "result")
seen, bad = set(), []
for trace, kind, call in events:
key = (trace, call)
if kind == "call":
seen.add(key)
elif key not in seen:
bad.append(key)
assert bad == [("C", "call-17")]
print(bad)
Expected output: [("C", "call-17")]. Calls precede results in this explicit mock order. This is not a universal rule: real producers may use global IDs, nested runs, retries or out-of-order records. The example does not implement a complete trainer validator or model-security check.
The full runnable walkthrough and 40-second illustration write and reopen JSONL, Parquet and Arrow IPC files, add one user record per trace (nine records per format), and preserve source-file/row information. Each format finds the same one wrong link. Source hashes remain unchanged. It uses small in-memory fixtures; no large-file performance or bounded-memory claim.
Disclosure: we are the RowCove team, developers of a commercial local data workspace. Text and illustrations are AI-assisted; the snippet and three-format reference were executed. All data is generated mock data. The example is independently usable with Python/PyArrow and requires no purchase. It is distinct from our earlier exact-numeric-ID/shard inspection example: this one checks the relationship between IDs, not numeric precision.