At Quillfern Parcels. This is the system from chapter 10 of the Quillfern story, "A support assistant that can act": Support answers the same refund and tracking questions all day. An assistant could help, but one that can issue refunds must not be talked into the wrong one.
What the model simplifies
The agent calls the tools in order; each model turn takes 900 ms; a tool slower than the timeout times out and is retried, and is assumed to be just as slow again, as a struggling dependency is. Every model turn and tool call is a step. The context window holds a 1,500-token system prompt, the history, the retrieved text, a 200-token question, and 1,000 tokens kept for the answer. Every number on this page comes from one shared set of calculations, which the simulation questions use too, so a question can never disagree with what the simulator shows.
The drills, written out
A slow tool makes the agent give up
- Healthy state. The assistant searches the order, gets the invoice, reads the refund policy, and answers in 5.5 s, in 7 steps.
- Trigger. The invoicing system is busy with month-end runs and takes 4.5 seconds to answer.
- What is affected. Every refund question, since each one needs the invoice.
- Symptoms. After a long wait the assistant says it cannot check the refund right now. Customers ask again, which adds more load.
- Metrics. The invoice tool is called twice per question, timing out at 3 seconds each time; the customer waits 8.1 s for an answer that says it failed.
- Logs. The agent's trace shows the timeouts and the retry.
step 1 +900 ms model decides to call search_orders
step 2 +1.2 s search_orders answered in 300 ms
step 3 +2.1 s model decides to call get_invoice
step 4 +5.1 s get_invoice timed out after 3000 ms; retrying
step 5 +8.1 s get_invoice timed out after 3000 ms
step 5 +8.1 s get_invoice failed 2 times: the agent reports the failure instead of guessing
- Reasoning. The timeout is shorter than the tool now takes, and the retry repeats the same slow call. Retrying a slow dependency adds load and time but cannot make it faster. The agent did the right thing in the end: it reported the failure instead of guessing.
- Mitigation. Raise this tool's timeout to 6 seconds, above its real worst case, and stop retrying it.
- Recovery. The assistant answers again, in 8.8 s with 3 tool calls.
- Prevention. Set each tool's timeout from its measured latency, retry only errors that are likely to pass, cap steps and cost per question, and tell the customer when an answer will take longer.
Too much retrieved text overflows the context
- Healthy state. The retrieval step adds 6,000 tokens of policy text; with the prompt, history, question, and room for the answer, 11,700 of 32,768 tokens are used.
- Trigger. Someone sets retrieval to return the 40 best matches "to be thorough": 30,000 tokens.
- What is affected. Every question that reads the refund policy.
- Symptoms. The model API rejects the request as too long, or the framework silently cuts the oldest text, which includes the instructions.
- Metrics. The prompt needs 35,700 tokens: 2,932 over the window. The input tokens, which are what each question costs, grow 3.2 times.
- Logs. The API error says so.
400 invalid_request: prompt is too long: 34,700 tokens + 1000 max_tokens > 32768
- Reasoning. More retrieved text is not more knowledge: the window is a budget for instructions, history, evidence, and the answer together.
- Mitigation. Retrieve 20 candidates, re-rank them, and keep the best 8 chunks: 8,000 tokens.
- Recovery. The prompt fits with 19,068 tokens to spare, with 37% of the input tokens of the oversized prompt.
- Prevention. Count tokens before each call, give every part of the prompt a budget, summarise long histories, and test retrieval settings against an evaluation set.
Learn it properly
All simulators · Curriculum map