Your Agent Is Still Thinking. Its Next Read Could Already Be Running.
Predict a likely read while the model thinks, keep the result quarantined, and reuse it only after an exact, authorized, fresh tool-call match. Speculation saves waiting time—not permission checks.
On this page
An agent is answering a customer question. You already know it will probably read the refund policy, but the model is still generating the tool call.
So the application waits.
The model finishes. Then the lookup begins. Then the model waits again.
That wait is not always necessary.
Speculative tool execution starts a likely read while the model is still deciding. If the model later asks for that exact read, the result is ready—or at least partway through. If it chooses something else, the speculative result is discarded.
The idea is not to let a predictor make decisions for the agent. The model's committed tool call remains the source of truth.
This is not ordinary parallel tool calling
I already covered running independent, committed tool calls concurrently. That optimization begins *after* the model has selected the calls.
Speculation starts earlier, before a call is confirmed.
For example, imagine a policy lookup takes 500 ms and the model needs another 400 ms to finish deciding. Sequential execution exposes both waits. Starting the read after the first 100 ms can hide much of the lookup behind model generation.
Those timings are illustrative, not a promised speedup. It only works when the next call is predictable, its arguments are available, and the tool can run safely before commitment.
PASTE and the Speculative Actions research explore this same opportunity: predict likely future operations, execute them early, and reuse only work that matches the authoritative trajectory.
Speculate on reads, not consequences
My default policy is deliberately restrictive. Start with side-effect-free internal retrieval, policy lookup, document fetch, or computation. Do not speculate on issuing refunds, sending emails, updating records, creating tickets, or invoking a tool just because its name starts with get.
Even a read can have observable effects: usage charges, rate-limit consumption, audit logs, or a disclosure to an external API. The *Ghost Tool Calls* research makes the privacy issue explicit: an abandoned speculative request cannot be unsent to a third party.
Eligibility therefore needs two checks: is the operation safe to discard, and is it acceptable to send these arguments to this destination before the user-facing plan is committed?
A real executor should use an explicit allowlist, not an LLM's guess that a tool is read-only.
Keep speculative results outside the conversation
The runtime has one strict rule: a predicted result must not be fed back into the model until the model actually commits to the corresponding call.
If the prediction misses, cancel it when possible and proceed with the normal tool execution. If it matches while still running, wait on that in-flight call instead of launching a duplicate.
For result reuse, the tool name alone is not enough. Compare the complete validated arguments and their execution context: tenant, permissions, data version, and freshness window. An old cached policy for another tenant is not a latency optimization; it is an incident.
Here is the smallest useful shape of that contract.
type ReadCall = { tool: "get_policy"; tenantId: string; policyId: string; authVersion: string; dataVersion: string;};type Ticket = { call: ReadCall; startedAt: number; result: Promise<string>; cancel: () => void;};function sameCall(a: ReadCall, b: ReadCall) { return a.tool === b.tool && a.tenantId === b.tenantId && a.policyId === b.policyId && a.authVersion === b.authVersion && a.dataVersion === b.dataVersion;}The predictor can launch an eligible read in a quarantined task. The confirmed call goes through the same authorization policy as an ordinary call, even when its result is waiting.
async function resolveCall( committed: ReadCall, ticket: Ticket | null, canReadNow: (call: ReadCall) => Promise<boolean>, execute: (call: ReadCall) => Promise<string>,) { const authorized = await canReadNow(committed); if (!authorized) throw new Error("Not authorized"); const reusable = ticket && sameCall(ticket.call, committed) && Date.now() - ticket.startedAt < 1_500; if (!reusable) { ticket?.cancel(); return execute(committed); } return ticket.result; // reuse the in-flight result}These are illustrative wrappers; the production launcher must enforce read-only eligibility and issue-time privacy before creating Ticket, and the store must honor the data-version boundary. A speculative failure should follow the same error/retry policy as a normal tool call rather than silently becoming a fabricated success.
A hit rate is not enough
Speculation can make a system slower if background reads compete with real requests for database connections, API quota, or workers.
I would start with one speculative call per turn, a small TTL, cancellable tasks, and lower priority than confirmed work. Only increase the budget when measurements justify it.
Track four numbers together: prediction hit rate, latency saved on hits, wasted calls on misses, and p95 latency for non-speculative work. Also compare final task quality against the speculation-disabled baseline. A faster average means little if the real calls now queue behind guesses.
It is worth remembering that speculative execution and the early retrieval in a real-time voice agent share an idea but not an execution guarantee. Voice prefetch often warms likely context from a partial utterance. Tool speculation predicts a concrete future call and must confirm its full invocation before reuse.
When I would leave it off
Do not add speculation to every agent. It is a good fit for repeated workflows with predictable read patterns and expensive I/O. It is a poor fit when tool arguments are usually unknown until the model finishes, calls are cheap, data becomes stale quickly, or the speculative request itself leaks sensitive intent.
And if the full set of independent calls is already known, use ordinary bounded parallelism. There is no reason to predict what has already been decided.
The takeaway
Speculative execution is a scheduling optimization, not a new source of authority.
Predict an eligible future read. Start it while the model thinks. Keep its result isolated. Reuse it only when the final call, arguments, tenant, permissions, data version, and freshness all match. Otherwise discard it and follow the normal path.
Let the agent work ahead. Do not let it act ahead.
References
KEEP READING
Related engineering notes
A Failover Route Is Not a Recovery Path: Proving Independence in AI Infrastructure
Two LLM providers can share the same failure domain. Build an evidence-backed recovery graph that checks cloud, networking, identity, control-plane and capacity dependencies before admitting fallback routes, then test correlated outages without weakening safety.
Read articleAn Eval Platform Sunset Can Erase Your Release Evidence: Build an Evidence-Escrow Migration Gate
When a hosted LLM evaluation platform retires, switching runners is not enough. Preserve the historical evidence, reconstruct grader semantics, validate scoring parity, and enforce a fail-closed release gate that survives the service shutdown.
Read articleWhen the Package Runs Before Your App: Quarantining AI Framework Releases
The 2026 agent-framework PyPI compromise exposed a blind spot in AI build pipelines: Python startup hooks execute before application imports. Design an artifact-quarantine gate, inspect wheels without installing them, separate credentials, and recover from suspected exposure.
Read article