Agent ArchitectureRuntime and effect recoveryPrincipal
How can large numeric tool identifiers be rounded before authorization or execution?
By Amit Kumar2 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A tool call contains account ID 9007199254740993 as a JSON number. A JavaScript gateway parses it and updates an adjacent existing account. Trace the representation failure, design lossless identifier contracts across language hops, and explain how to bind approval and authorization to the exact identifier actually sent.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
An agent's tool call contains account ID 9007199254740993 as a JSON number. A JavaScript gateway parses it into a Number, which cannot represent that integer exactly. It can become 9007199254740992 before the downstream service ever sees it. Both IDs might exist. The model supplied the correct digits, the JSON parsed, the schema said “integer,” and the wrong account was updated.
JavaScript's largest safe integer is 2^53 - 1. RFC 8259 calls out this range as the interoperable integer range for implementations with binary64 numbers. The issue is not that JSON's text syntax has a 53-bit limit. It is that some readers immediately coerce a numeric literal into a type that loses precision. MDN's Number documentation gives the exact boundary.
Identifiers should usually be strings at external tool boundaries. They are labels, not quantities to add or average. Accept a decimal string, validate its syntax and namespace, and pass it through without numeric conversion. If a legacy provider insists on a 64-bit numeric field, parse losslessly into an appropriate integer type after validation and serialize using a library that preserves the value. Do not call BigInt(JSON.parse(...).account_id) after the parser has already rounded it.
I would trace raw model tool-call bytes, gateway parsed value, authorization lookup key and provider request bytes for both adjacent IDs around the boundary. Make the executor authorize the exact canonical identifier it sends, not a string representation captured before a lossy conversion. Add a contract test through every language hop with values just below and above 2^53, including a valid neighboring account. If the authorization check used the original ID but the provider saw the rounded one, this becomes a cross-account security incident as well as data corruption.
The pushback is that JSON Schema's integer type should protect us. It classifies mathematical integer values, including some JSON spellings such as 1.0. It does not make every runtime's numeric representation lossless. The system invariant is exact identity from approval through authorization and execution.
Related questions
Keep practising agent architecture
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux