A retrieval loop needs a limit before it starts another operation. Action admission decides whether a proposed search or read fits the remaining allowances. Counting after execution can report an overrun, but it cannot prevent the operation that caused it.
This runner tracks admitted steps, searches, reads and requested source-text bytes. It reserves the applicable allowance before calling a tool. If an admitted operation fails, its attempt still counts; otherwise repeated failures could appear to consume nothing.
When you need this. Use admission checks when a policy can request another search or read and the caller must bound those operations before they happen.
Follow one example. The scripted policy proposes reading an issued passage handle. Before the read runs, the runner takes the expected UTF-8 byte count from the handle’s metadata and compares the new total with the source-byte allowance. If the read would exceed the allowance, the trace records it as denied with invoked: false. Keep that denied decision apart from a tool call that was admitted and then failed.
You will put this gate around the existing offline policy and inspect the cases that restrict each limit. No model agent runs here. Source bytes count the UTF-8 bytes of requested read text. They are not model tokens, provider cost or total process memory.
Admit the action before spending the tool budget
- Check action and source-byte allowances.
- Reserve and execute an admitted call.
- Record counters and the tool result.
- Do not invoke an over-budget action.
- Stop after a tool failure.
Check the next action before calling the tool
Limits holds allowances for all admitted steps, searches, reads and source bytes. Its explicit constructor checks reject invalid types and values. A type annotation alone would not validate a supplied number.
The runner first validates an action’s tool name and argument shape. A search costs zero source bytes in this lab. For a read, the runner validates the issued handle and takes the expected byte count from its metadata. It does not call the read to learn its cost. Take each action’s cost from data the runner already holds; a tool whose output size is unknown before the call needs a different admission mechanism.
The runner compares the proposed counters with every allowance. If a limit would be exceeded, the result is limited and the trace records a denied action with invoked: false. This ordering is the mechanism: reading first and counting afterwards cannot prevent that read.
Count admitted attempts even when they fail
Before the runner calls an admitted tool, it adds one step, one search or read, and the planned source bytes to the counters. A tool error does not reset those counters. Reserve the allowance before the call, and keep it reserved when the call fails.
The runner checks returned read text against the payload bound to the handle. It records validated delivered bytes separately from reserved bytes. If the payload changed, validation fails and the text never reaches the policy. The runner also refuses an action it already ran; a search that differs only in query case or an omitted default k counts as a repeat. A new query is a distinct action and uses the remaining budgets.
Invalid limits. Limits rejects booleans, negative values and values above the supported caps when it is created. Denied call. If a valid next action would cross a configured allowance, the runner records it and does not call that tool. Tool failure. The controlled fault is raised after a real local search runs, so that search counts as an admitted, failed attempt.
Inspect each terminal state and its counters
The normal run, each restricted-limit run and the deliberate tool fault use the same pinned corpus and question. Controller status describes execution: completed means the policy returned no further action, limited means admission refused an action, and failed means validation, policy or tool execution failed. Inspect the policy’s own stop reason separately; no terminal state grades an answer.
| Configured case | Controller status | Reason | Admitted steps | Reserved source bytes | Validated delivered bytes |
|---|---|---|---|---|---|
| within_limits | completed | policy_complete | 4 | 378 | 378 |
| step_limit | limited | max_steps | 2 | 154 | 154 |
| search_limit | limited | max_searches | 2 | 154 | 154 |
| read_limit | limited | max_reads | 3 | 154 | 154 |
| source_byte_limit | limited | max_source_bytes | 3 | 154 | 154 |
The fault’s reason is RuntimeError: controlled_after_search_fault. Its raw trace keeps the attempted search. The lab injects this error on purpose to show the accounting rule; it is not a measured failure rate.
Execute the bounded local runner
Download the retrieval-limits lab. The package includes the runner, the scripted policy, the search and read tools from the earlier labs, the fixed corpus and the failure tests.
"""Admission limits for an offline scripted tool controller, not a model agent."""
import copy
from dataclasses import asdict,dataclass
import json
import re
@dataclass(frozen=True)
class Limits:
max_steps:int=6
max_searches:int=2
max_reads:int=2
max_source_bytes:int=4096
def __post_init__(self):
for key,value in asdict(self).items():
maximum=16_777_216 if key=='max_source_bytes' else 100
if type(value) is not int or not 0<=value<=maximum:raise ValueError('invalid_'+key)
def action_cost(tools,action):
if not isinstance(action,dict) or set(action)!={'tool','arguments'}:raise ValueError('invalid_action_schema')
tool=action['tool'];arguments=action['arguments']
if not isinstance(tool,str) or tool not in ('search','read'):raise ValueError('unknown_tool')
if not isinstance(arguments,dict):raise ValueError('invalid_arguments')
if tool=='search':
if not {'query','version'}<=set(arguments) or set(arguments)-{'query','version','k'}:raise ValueError('invalid_search_arguments')
if not isinstance(arguments['query'],str) or re.fullmatch(r'[A-Za-z0-9]{1,64}',arguments['query']) is None:raise ValueError('invalid_search_query')
if not isinstance(arguments['version'],str) or re.fullmatch(r'[0-9]+\.[0-9]+',arguments['version']) is None:raise ValueError('invalid_search_version')
if type(arguments.get('k',2)) is not int or not 1<=arguments.get('k',2)<=10:raise ValueError('invalid_search_k')
return 0
if set(arguments)!={'handle'} or not isinstance(arguments['handle'],dict):raise ValueError('invalid_read_arguments')
cost=tools.read_cost(arguments['handle'])
if type(cost) is not int or cost<0:raise ValueError('invalid_read_cost')
return cost
def run_limited(tools,policy,limits=Limits()):
"""Validate, reserve, then invoke. Corpus setup is outside these counters."""
if not isinstance(limits,Limits):raise ValueError('invalid_limits')
usage={'steps':0,'searches':0,'reads':0,'reserved_source_bytes':0,'delivered_source_bytes':0}
observations=[];trace=[];seen=set()
status='completed';reason='policy_complete'
while True:
try:
action=policy(copy.deepcopy(observations))
if action is None:break
cost=action_cost(tools,action)
canonical=copy.deepcopy(action)
if action['tool']=='search':canonical['arguments']={'query':action['arguments']['query'].lower(),'version':action['arguments']['version'],'k':action['arguments'].get('k',2)}
fingerprint=json.dumps(canonical,sort_keys=True,separators=(',',':'),allow_nan=False)
if fingerprint in seen:raise ValueError('repeated_action')
except Exception as error:
status='failed';reason=type(error).__name__+': '+str(error)
trace.append({'decision':'refused','reason':reason,'invoked':False});break
tool=action['tool']
checks=[('max_steps',usage['steps']+1,limits.max_steps),('max_searches',usage['searches']+(tool=='search'),limits.max_searches),('max_reads',usage['reads']+(tool=='read'),limits.max_reads),('max_source_bytes',usage['reserved_source_bytes']+cost,limits.max_source_bytes)]
denied=next((name for name,requested,maximum in checks if requested>maximum),None)
if denied:
status='limited';reason=denied
trace.append({'action':copy.deepcopy(action),'decision':'denied','reason':denied,'invoked':False,'preflight_source_bytes':cost});break
seen.add(fingerprint)
usage['steps']+=1;usage['searches']+=int(tool=='search');usage['reads']+=int(tool=='read');usage['reserved_source_bytes']+=cost
event={'action':copy.deepcopy(action),'decision':'executed','invoked':True,'reserved_source_bytes':cost}
try:
result=tools.search(**action['arguments']) if tool=='search' else tools.read(action['arguments']['handle'])
if tool=='read':
result=tools.validate_read(result,action['arguments']['handle'])
if not isinstance(result,dict) or not isinstance(result.get('text'),str):raise ValueError('invalid_read_result')
received=len(result['text'].encode('utf-8'));usage['delivered_source_bytes']+=received
if received!=cost:raise ValueError('read_size_contract_changed')
event['status']='succeeded';event['result']=copy.deepcopy(result)
observations.append({'tool':tool,'arguments':copy.deepcopy(action['arguments']),'result':copy.deepcopy(result)})
except Exception as error:
status='failed';reason=type(error).__name__+': '+str(error)
event['status']='failed';event['reason']=reason
event['usage_after']=dict(usage);trace.append(event)
if status=='failed':break
return {'controller_status':status,'terminal_reason':reason,'limits':asdict(limits),'usage':usage,'trace':trace,'observations':observations,'scope':'Offline scripted tool policy. Corpus initialization is outside action counters. Source bytes are reserved read-text UTF-8 bytes, not disk I/O or model tokens.'}python run.py --output scratch-result.json
python -m unittest discover -v{
"cases": {
"read_limit": "limited",
"search_limit": "limited",
"source_byte_limit": "limited",
"step_limit": "limited",
"within_limits": "completed"
},
"execution_mode": "offline-scripted-controller-limits",
"model_called": false
}This program is a local CLI that keeps its counters in memory. It loads the corpus and builds the index before the action loop starts. The limits do not cover policy-callback computation, process memory, disk I/O, model tokens or wall-clock time. A step counter cannot interrupt a blocked callback; that needs an execution timeout or a process boundary. No HTTP deployment, concurrency admission or cancellation integration was measured.
View the complete local execution JSON
{
"execution_mode": "offline-scripted-controller-limits",
"model_called": false,
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"question": "Will write_text replace the contents of an existing file?",
"version": "3.12",
"cases": [
{
"case_id": "within_limits",
"policy_terminal_status": "completed",
"policy_reason": "configured_context_marker_found",
"result": {
"controller_status": "completed",
"terminal_reason": "policy_complete",
"limits": {
"max_steps": 6,
"max_searches": 2,
"max_reads": 2,
"max_source_bytes": 4096
},
"usage": {
"steps": 4,
"searches": 2,
"reads": 2,
"reserved_source_bytes": 378,
"delivered_source_bytes": 378
},
"trace": [
{
"action": {
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 0,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
},
"usage_after": {
"steps": 1,
"searches": 1,
"reads": 0,
"reserved_source_bytes": 0,
"delivered_source_bytes": 0
}
},
{
"action": {
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 154,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
},
"usage_after": {
"steps": 2,
"searches": 1,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
}
},
{
"action": {
"tool": "search",
"arguments": {
"query": "overwritten",
"version": "3.12",
"k": 2
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 0,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"query": "overwritten",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
]
},
"usage_after": {
"steps": 3,
"searches": 2,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
}
},
{
"action": {
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 224,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75",
"text": "Path.write_text(data, encoding=None, errors=None, newline=None) writes text to a file and closes it. Set encoding=\"utf-8\" to select UTF-8. An existing file is overwritten. The method returns the number of characters written.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.write_text",
"read_request_id": "a9ec642e4ed3206ac85e5dd03d4de9ff57de3167e134079eafe4a31de23cec67",
"result_sha256": "662c96d3b972224ac1549f9a6c3ad495b3ed885b6db477d52aeb7527ec1dbbb7"
},
"usage_after": {
"steps": 4,
"searches": 2,
"reads": 2,
"reserved_source_bytes": 378,
"delivered_source_bytes": 378
}
}
],
"observations": [
{
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
}
},
{
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
}
},
{
"tool": "search",
"arguments": {
"query": "overwritten",
"version": "3.12",
"k": 2
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"query": "overwritten",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
]
}
},
{
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75",
"text": "Path.write_text(data, encoding=None, errors=None, newline=None) writes text to a file and closes it. Set encoding=\"utf-8\" to select UTF-8. An existing file is overwritten. The method returns the number of characters written.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.write_text",
"read_request_id": "a9ec642e4ed3206ac85e5dd03d4de9ff57de3167e134079eafe4a31de23cec67",
"result_sha256": "662c96d3b972224ac1549f9a6c3ad495b3ed885b6db477d52aeb7527ec1dbbb7"
}
}
],
"scope": "Offline scripted tool policy. Corpus initialization is outside action counters. Source bytes are reserved read-text UTF-8 bytes, not disk I/O or model tokens."
}
},
{
"case_id": "step_limit",
"policy_terminal_status": null,
"policy_reason": null,
"result": {
"controller_status": "limited",
"terminal_reason": "max_steps",
"limits": {
"max_steps": 2,
"max_searches": 2,
"max_reads": 2,
"max_source_bytes": 4096
},
"usage": {
"steps": 2,
"searches": 1,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
},
"trace": [
{
"action": {
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 0,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
},
"usage_after": {
"steps": 1,
"searches": 1,
"reads": 0,
"reserved_source_bytes": 0,
"delivered_source_bytes": 0
}
},
{
"action": {
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 154,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
},
"usage_after": {
"steps": 2,
"searches": 1,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
}
},
{
"action": {
"tool": "search",
"arguments": {
"query": "overwritten",
"version": "3.12",
"k": 2
}
},
"decision": "denied",
"reason": "max_steps",
"invoked": false,
"preflight_source_bytes": 0
}
],
"observations": [
{
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
}
},
{
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
}
}
],
"scope": "Offline scripted tool policy. Corpus initialization is outside action counters. Source bytes are reserved read-text UTF-8 bytes, not disk I/O or model tokens."
}
},
{
"case_id": "search_limit",
"policy_terminal_status": null,
"policy_reason": null,
"result": {
"controller_status": "limited",
"terminal_reason": "max_searches",
"limits": {
"max_steps": 6,
"max_searches": 1,
"max_reads": 2,
"max_source_bytes": 4096
},
"usage": {
"steps": 2,
"searches": 1,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
},
"trace": [
{
"action": {
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 0,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
},
"usage_after": {
"steps": 1,
"searches": 1,
"reads": 0,
"reserved_source_bytes": 0,
"delivered_source_bytes": 0
}
},
{
"action": {
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 154,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
},
"usage_after": {
"steps": 2,
"searches": 1,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
}
},
{
"action": {
"tool": "search",
"arguments": {
"query": "overwritten",
"version": "3.12",
"k": 2
}
},
"decision": "denied",
"reason": "max_searches",
"invoked": false,
"preflight_source_bytes": 0
}
],
"observations": [
{
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
}
},
{
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
}
}
],
"scope": "Offline scripted tool policy. Corpus initialization is outside action counters. Source bytes are reserved read-text UTF-8 bytes, not disk I/O or model tokens."
}
},
{
"case_id": "read_limit",
"policy_terminal_status": null,
"policy_reason": null,
"result": {
"controller_status": "limited",
"terminal_reason": "max_reads",
"limits": {
"max_steps": 6,
"max_searches": 2,
"max_reads": 1,
"max_source_bytes": 4096
},
"usage": {
"steps": 3,
"searches": 2,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
},
"trace": [
{
"action": {
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 0,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
},
"usage_after": {
"steps": 1,
"searches": 1,
"reads": 0,
"reserved_source_bytes": 0,
"delivered_source_bytes": 0
}
},
{
"action": {
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 154,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
},
"usage_after": {
"steps": 2,
"searches": 1,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
}
},
{
"action": {
"tool": "search",
"arguments": {
"query": "overwritten",
"version": "3.12",
"k": 2
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 0,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"query": "overwritten",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
]
},
"usage_after": {
"steps": 3,
"searches": 2,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
}
},
{
"action": {
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
}
},
"decision": "denied",
"reason": "max_reads",
"invoked": false,
"preflight_source_bytes": 224
}
],
"observations": [
{
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
}
},
{
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
}
},
{
"tool": "search",
"arguments": {
"query": "overwritten",
"version": "3.12",
"k": 2
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"query": "overwritten",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
]
}
}
],
"scope": "Offline scripted tool policy. Corpus initialization is outside action counters. Source bytes are reserved read-text UTF-8 bytes, not disk I/O or model tokens."
}
},
{
"case_id": "source_byte_limit",
"policy_terminal_status": null,
"policy_reason": null,
"result": {
"controller_status": "limited",
"terminal_reason": "max_source_bytes",
"limits": {
"max_steps": 6,
"max_searches": 2,
"max_reads": 2,
"max_source_bytes": 200
},
"usage": {
"steps": 3,
"searches": 2,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
},
"trace": [
{
"action": {
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 0,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
},
"usage_after": {
"steps": 1,
"searches": 1,
"reads": 0,
"reserved_source_bytes": 0,
"delivered_source_bytes": 0
}
},
{
"action": {
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 154,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
},
"usage_after": {
"steps": 2,
"searches": 1,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
}
},
{
"action": {
"tool": "search",
"arguments": {
"query": "overwritten",
"version": "3.12",
"k": 2
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 0,
"status": "succeeded",
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"query": "overwritten",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
]
},
"usage_after": {
"steps": 3,
"searches": 2,
"reads": 1,
"reserved_source_bytes": 154,
"delivered_source_bytes": 154
}
},
{
"action": {
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
}
},
"decision": "denied",
"reason": "max_source_bytes",
"invoked": false,
"preflight_source_bytes": 224
}
],
"observations": [
{
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"query": "text",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
},
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -1.320388349514563e-06,
"rank": 2,
"read_token": "397d6f236743e576b50940b06d3df84a0712dc67157f5efdeb544448555729f1"
}
]
}
},
{
"tool": "read",
"arguments": {
"handle": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124"
}
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "3f33383e706e36449e22c380704d880d5e2b8a4b1f6b779b8aa54206e072ad5f",
"passage_id": "c737db948e8111ae00e3442d8a22c80c876e43446dc1ee176ffe8ce142a41900",
"source_id": "path-read",
"version": "3.12",
"document_revision": "b58385b9bf597a951c16c035653d639929924e53eae3e5ada255afd6ee1592f2",
"source_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"start_line": 1,
"end_line": 1,
"text_sha256": "dc097ca63486ace45279f412ea266bf754fcd2f0b1153f5d763ce905dafbc2c0",
"byte_count": 154,
"native_score": -1.4220532319391636e-06,
"rank": 1,
"read_token": "72abbf5e0022ef780447ed8c2322b711cac8b4971d817a440bc02dfa28b07124",
"text": "Path.read_text(encoding=None, errors=None) opens a file, returns its text as a string and closes the file. Set encoding=\"utf-8\" when reading a UTF-8 file.",
"url": "https://docs.python.org/3.12/library/pathlib.html#pathlib.Path.read_text",
"read_request_id": "b2ce4d1e809a197df6c864261264b583737b1f41c59f8a4b6e353911b84c5bfe",
"result_sha256": "2d855cfa0b4f7e90c3711783b7779709f3b964760fd789d0d65b11f9b3604ac5"
}
},
{
"tool": "search",
"arguments": {
"query": "overwritten",
"version": "3.12",
"k": 2
},
"result": {
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"query": "overwritten",
"version": "3.12",
"k": 2,
"results": [
{
"corpus_id": "0615d22a3315e97c0a88c6c566c546877304f5a28a97e83f68dd36881d4bbd0e",
"search_request_id": "aeffc68efdee46b8d23c597f651143424c575c0c1a4699ab08a48734d011f127",
"passage_id": "c66643a4609c6ee157458bf4353f7446b9c6a200a3ef453846d6a18d5b5069a7",
"source_id": "path-write",
"version": "3.12",
"document_revision": "28c6349eaf80b629322edb310bb871dc45a04af9fad3b752bc75d12f0d7314e7",
"source_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"start_line": 1,
"end_line": 1,
"text_sha256": "a48b4b9f763cd6309ebe32af19c5a814adcf810c2259683da9f328ccee46948e",
"byte_count": 224,
"native_score": -0.7992166451067193,
"rank": 1,
"read_token": "08b866d8cf00533f3484aac4d78ac512bd4df8767c9ea11fbd2e817eeeb1dd75"
}
]
}
}
],
"scope": "Offline scripted tool policy. Corpus initialization is outside action counters. Source bytes are reserved read-text UTF-8 bytes, not disk I/O or model tokens."
}
}
],
"controlled_tool_failure": {
"scope": "deliberate fault after actual local search; not a reliability measurement",
"result": {
"controller_status": "failed",
"terminal_reason": "RuntimeError: controlled_after_search_fault",
"limits": {
"max_steps": 6,
"max_searches": 2,
"max_reads": 2,
"max_source_bytes": 4096
},
"usage": {
"steps": 1,
"searches": 1,
"reads": 0,
"reserved_source_bytes": 0,
"delivered_source_bytes": 0
},
"trace": [
{
"action": {
"tool": "search",
"arguments": {
"query": "text",
"version": "3.12",
"k": 2
}
},
"decision": "executed",
"invoked": true,
"reserved_source_bytes": 0,
"status": "failed",
"reason": "RuntimeError: controlled_after_search_fault",
"usage_after": {
"steps": 1,
"searches": 1,
"reads": 0,
"reserved_source_bytes": 0,
"delivered_source_bytes": 0
}
}
],
"observations": [],
"scope": "Offline scripted tool policy. Corpus initialization is outside action counters. Source bytes are reserved read-text UTF-8 bytes, not disk I/O or model tokens."
}
},
"limit": "Counts cover admitted tool attempts and validated read-text bytes. Corpus initialization, policy callback computation, wall time, model tokens and inference costs are outside this contract. No model agent or generated answer."
}
The CLI summary shows the completed normal run and four limited runs. The full JSON also keeps the controlled tool failure and its admitted-attempt counters.
Verify that a denied action never ran
Compare the step-limited trace with the normal trace. Locate the last admitted operation and the next denied action. Confirm that the denied action has no successful observation and did not increment the admitted counters. Then inspect the controlled tool failure and explain why its admitted search still consumes a step.
Read the explanation
The budget covers admitted tool actions and reserved read-text bytes, not process memory or wall-clock execution.
What’s next
Continue with Compare Agents and Pipelines.
References
Python dataclasses, checked on 23 October 2026, describes generated methods and the limits of annotation and frozen-instance behavior. This lab implements the explicit validation and admission rules. Python unittest documents the assertion mechanisms the tests use to check refused configurations and tool failures.