---
title: "Break chatbot speed limits with speculative tool calls"
description: "incident.io cut its incident chatbot's response latency by about 50% (saving 2-3s per interaction) by speculatively executing LLM tool calls in both directions."
url: "https://swe.quest/articles/break-chatbot-speed-limits-with-speculative-tool-calls-83dbf2c2a180290f"
canonical: "https://incident.io/blog/speculative-tool-calling"
source: "incident.io"
published: "2025-03-25"
difficulty: "medium"
kind: "Case study"
reading_minutes: 10
tags: ["ai-agents","llms","performance","go"]
---

# Break chatbot speed limits with speculative tool calls

A post on [incident.io](https://swe.quest/sources/incident-io.md), published 2025-03-25, 10 min read, Case study. Original: [https://incident.io/blog/speculative-tool-calling](https://incident.io/blog/speculative-tool-calling)

## Summary

incident.io cut its incident chatbot's response latency by about 50% (saving 2-3s per interaction) by speculatively executing LLM tool calls in both directions. Tools are started in parallel with the main chat prompt when simple keyword matching suggests they will be needed, and the follow-up chat prompt is run optimistically by assuming the tool succeeded, then re-run on error. Side effects are prevented with a Go write barrier: speculative tools do all their LLM 'thinking' but block before writing until the main prompt confirms the call, otherwise the context is cancelled. The tradeoff is occasional wasted LLM spend, which effectively lets the team buy speed with money.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Go](https://swe.quest/tags/go.md) (Languages)

## Prerequisites

- LLM tool calling ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- Go context cancellation ([easy posts on Go](https://swe.quest/tags/go.md?difficulty=easy))

## Keywords

incident.io, speculative tool calling, WriteBarrier, Go

## Related posts

- [AI Agent Latency 101: How do I speed up my AI agent?](https://swe.quest/articles/ai-agent-latency-101-how-do-i-speed-up-my-ai-agent-62a7a640683900cd.md): LangChain · 2026-08-26 · Easy · 5 min read · AI agents, Performance engineering, LLMs
  AI agent latency can be cut in five ways: find the bottleneck first (e.g. with per-step tracing and a waterfall view), reduce perceived latency through UX, make fewer LLM calls, make each call faster, and run calls in parallel.
- [Speeding up agentic workflows with WebSockets in the Responses API](https://swe.quest/articles/speeding-up-agentic-workflows-with-websockets-in-the-responses-api-7a1ff127c7fc35a3.md): OpenAI · 2026-04-22 · Medium · 6 min read · AI agents, API design, Performance engineering, Inference & serving, Real-time systems
  OpenAI cut end-to-end latency of agentic loops on the Responses API by about 40% by adding a WebSocket mode that keeps a persistent connection with a connection-scoped in-memory cache of prior response state.
- [We used GPT-4 during a hackathon—here's what we learned](https://swe.quest/articles/we-used-gpt-4-during-a-hackathon-here-s-what-we-learned-8311f49bf32b65c6.md): incident.io · 2023-07-25 · Medium · 9 min read · LLMs, Product engineering
  A two-day hackathon at incident.io prototyped GPT-3.5/GPT-4 features: incident handover summaries generated from full Slack channels, a reply-with-❓ jargon explainer, and natural-language incident filters.
- [2,000 robots walk into a shop...](https://swe.quest/articles/2-000-robots-walk-into-a-shop-197e6155a91a1c15.md): Shopify Engineering · 2026-02-27 · Hard · 8 min read · Inference & serving, AI agents, LLMs, Performance engineering, Hardware
  SimGym runs simulated A/B tests on Shopify storefronts by sending up to 2,000 concurrent LLM-driven shopper agents through Browserbase cloud browsers.
- [Optimizing LLM prompts for low latency](https://swe.quest/articles/optimizing-llm-prompts-for-low-latency-a98e3093827ae50c.md): incident.io · 2025-03-25 · Medium · 9 min read · LLMs, Performance engineering, Inference & serving
  incident.io cut latency of an LLM prompt that plans Grafana dashboards for incident investigations from 11s to under 2.3s without changing its behaviour, mainly by shrinking output tokens.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
