Tool admission decides whether an exact proposed call may run now. After the runtime exposes eligible tools and the agent selects one, admission rechecks current authority, argument provenance, and state freshness. A tool can be eligible yet rejected for a particular call. section 6.3.1
At the execution boundary, admission should:
- Recheck the selected tool against the current role, task stage, and granted effects. section 6.3.3 section 10.7.2
- Validate a stable argument snapshot, including exact application types, and compare protected values with runtime-resolved evidence. section 6.3.3
- Bind freshness to the same object and business version, rather than accepting a model-supplied timestamp. section 6.3.3
Schema validation can catch malformed structure, but it cannot establish that a protected value is true, current, or permitted. Admission compares values with evidence; it does not fetch or repair that evidence. section 6.3.3 section 10.7.2
Listing 6.7 Admission checks for one selected tool call
class AdmissionError(ValueError):
pass
@dataclass(frozen=True)
class AdmittedCall:
spec: ToolSpec
contract: ActionContract
arguments_json: str
provenance: tuple[tuple[str, str], ...]
state_read_at: datetime | None
def arguments(self) -> dict[str, Any]:
return json.loads(self.arguments_json)
class CommitStore:
def __init__(self) -> None:
self._digests: dict[str, str] = {}
self._lock = Lock()
def reserve(self, commit_id: str, digest: str) -> str:
with self._lock: #A
current = self._digests.get(commit_id)
if current is None:
self._digests[commit_id] = digest
return "new"
if current != digest: #B
raise AdmissionError("commit identity changed arguments")
return "repeat"
def release(self, commit_id: str, digest: str) -> None:
with self._lock:
if self._digests.get(commit_id) == digest:
del self._digests[commit_id]
def digest_for(self, commit_id: str) -> str | None:
with self._lock:
return self._digests.get(commit_id)
def canonical_arguments(
arguments: Mapping[str, Any],
) -> str:
try:
document = json.dumps(
dict(arguments),
allow_nan=False,
separators=(",", ":"),
sort_keys=True,
)
except (TypeError, ValueError) as error:
raise AdmissionError("arguments must be JSON values") from error
return document
def request_digest(spec: ToolSpec, arguments_json: str) -> str:
request = json.dumps(
{
"tool": spec.name,
"effect": spec.effect,
"arguments": json.loads(arguments_json),
},
separators=(",", ":"),
sort_keys=True,
)
return sha256(request.encode("utf-8")).hexdigest()
def admit(
registry: ToolRegistry,
intent: ToolIntent,
context: DispatchContext,
) -> AdmittedCall:
eligible = {item.name: item for item in registry.eligible(context)}
spec = eligible.get(intent.tool_name) #C
if spec is None:
raise AdmissionError("tool is not eligible in this context")
document = canonical_arguments(intent.arguments)
digest = request_digest(spec, document)
arguments = json.loads(document) #D
try:
spec.validate_arguments(arguments)
except (TypeError, ValueError) as error:
raise AdmissionError("tool arguments are invalid") from error
provenance: list[tuple[str, str]] = []
for name in spec.protected_args: #E
trusted = context.trusted_values.get(name)
if trusted is None or arguments.get(name) != trusted.value:
raise AdmissionError(f"{name} is not runtime-bound")
if not trusted.source_ref or not trusted.state_version:
raise AdmissionError(
f"trusted evidence is incomplete for {name}"
)
provenance.append((name, trusted.source_ref))
state = (
context.trusted_values.get(spec.state_arg)
if spec.state_arg is not None
else None
)
if spec.state_arg is not None and state is None:
raise AdmissionError("trusted state basis is missing")
if spec.max_state_age_seconds is not None: #F
if state is None:
raise AdmissionError("fresh state is required")
if state.read_at.utcoffset() is None:
raise AdmissionError("state timestamp needs a timezone")
if context.now.utcoffset() is None:
raise AdmissionError("runtime timestamp needs a timezone")
age = (context.now - state.read_at).total_seconds()
if age < 0 or age > spec.max_state_age_seconds:
raise AdmissionError("state snapshot is stale")
if spec.mutates_state and not context.commit_id:
raise AdmissionError("commit identity is required")
target = str(arguments.get(spec.target_arg, "unknown"))
contract = ActionContract(
effect=spec.effect,
target=target,
state_version=(state.state_version if state else "not-required"),
commit_id=context.commit_id or "read-only",
request_digest=digest,
acceptance_labels=spec.acceptance_labels,
)
return AdmittedCall(
spec=spec,
contract=contract,
arguments_json=document,
provenance=tuple(provenance),
state_read_at=(state.read_at if state else None),
)
The admission listing defines an immutable admitted call and a commit store for state-changing requests. section 6.3.3
Admission must sit on the only execution path available to the agent. Direct runner imports, unrestricted shell commands, or alternate API tools can bypass an advisory dispatcher. Fallback interfaces need equivalent authority checks and a record of which interface produced the effect. section 6.3.3 section 6.3.4
For a state-changing call, reserve a commit identity against the admitted request digest. A matching repeat returns an unknown state for verification rather than executing again; a changed request under the same identity is rejected. Production reservation must be durable and atomic. A timeout also leaves the outcome unknown: query by commit identity before deciding whether retry is safe. section 6.3.3
Importing a salary template
The host binds template and tenant identifiers from a trusted match receipt into protected import arguments. Dispatch admits the call before guarded execution; the import runner then passes prechecks, and an independent postcheck reads back the salary group. The domain adapter must authenticate the principal and validate receipt ownership. section 10.7.2
Admission is not containment or outcome verification. A sandbox can limit what a running process reaches, while an independent postcheck determines whether the intended effect occurred. A postcheck can detect a duplicate payment, but it cannot undo a transfer merely by marking the task failed. section 6.5.2 section 6.5.1
