The interview problem

Practice prompt

An agent may pause for hours between planning a tool call and executing it. Design a tool registry that survives a breaking schema release without silently changing the requested action.

Original practice, not a reported company interview. All worked numbers are illustrative. Interview date: not applicable. Written October 3, 2026.

1. Scope and assumptions

Assume tools can create business records. Separate syntactic validity, semantic compatibility and authorization. A valid JSON object does not establish that its units or meaning match the plan. Retain old contracts for a bounded workflow lifetime.

2. Architecture and decisions

Plan → pin contract digest → validate arguments → authorize action → dispatch pinned handler → record outcome

Store an immutable tool name, version, schema digest and handler binding in each execution envelope. Resolve the binding before showing a tool to the model, then persist that identity with its arguments. Revalidate at execution and reject an unavailable version with an explicit replan state. Do not transparently reinterpret old arguments against the newest schema.

For compatible migrations, implement a reviewed adapter that produces a new envelope and preserves the original for audit. A currency field becoming mandatory is not safely filled from a changing tenant default. Keep authorization live even when the schema is pinned: revoked access must still prevent dispatch. Bind idempotency to the business operation, not merely the schema version, so an adapter cannot create a duplicate effect.

3. Work through the example

A v1 timeout of 5 means seconds; v2 uses milliseconds. Copying the integer changes a 5,000 ms deadline to 5 ms, a 1,000-fold reduction. An explicit adapter multiplies by 1,000 and checks range. Test 0, fractional values and maximum values as well as the happy path.

4. Failure cases and trade-offs

An old handler can remain compatible but become insecure; retire it and force replanning rather than preserve availability at any cost. Reject unknown fields where silently ignoring them could discard a constraint. Strict schemas improve detection but do not prove semantic equivalence. Keeping multiple versions costs operational effort; a short maximum workflow lifetime limits that cost.

5. Validation and acceptance

Replay saved envelopes against their pinned contracts. Include the same valid JSON under two different versions, a revoked caller and a retired handler. Measure version rejection rate and workflows awaiting replan. Release only when existing supported envelopes retain their documented effects.

6. Follow-ups and self-review

How would you roll back the registry without rolling back a completed payment? A strong answer separates immutable contract identity, current authorization, migration semantics and deduplication.

Sources and related practice

JSON Schema object validation documents required and additional properties; the versioned execution protocol here is an original design.

Read the primary technical reference

Reference retrieved October 3, 2026. Retrieval date is not an interview or source publication date. The reference supports the named concept; scenario, architecture, examples and rubric are original.

Continue with Design a coding-agent execution platform; Integrate an AI workflow with an unreliable legacy API.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.