Sonnet 5.5 / Opus 5.5: streamed text after a tool_result arrives in one burst at the end of the turn
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 43/100
Direzione di ricerca
Start with the messages.stream event handling and tests for content_block_delta in this SDK, then compare the captured event timings for Sonnet 5.5 and Sonnet 5. The reproduction script and request IDs are provided in the issue. Done means determining whether the SDK changes or delays these events and documenting or fixing the behavior supported by the evidence.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
With claude-sonnet-5-5 (and claude-opus-5-5), when a turn follows a tool_result, all of its text_delta events arrive within a few milliseconds of each other at the end of the turn. They are not streamed while the text is generated. The same turn on claude-sonnet-5 streams normally, and so does Sonnet 5.5 when no tool result precedes the turn. For a chat interface this means several seconds of blank screen before every answer that uses a tool.
We couldn't find a setting in the docs that changes this. Anthropic's support chat could neither confirm whether it is intended nor pass it on, so we're raising it here. If this repo is the wrong place for API behaviour, please point us to the right one.
Environment
anthropicPython SDK 1.8.0, Python 3.12, macOSmessages.streamwith one client tool,output_config.effort: "medium", adaptive thinking (the default)
Measurements
Timings are from the request start to each text_delta, for a ~150-word answer:
| Request | Text deltas | First text | First to last |
|---|---|---|---|
| Sonnet 5.5, no tools in the request | 120 | 0.93 s | 4.1 s |
| Sonnet 5.5, tools present, answered without a tool | 80 | 1.03 s | 2.7 s |
Sonnet 5.5, turn after a tool_result |
78-105 | 3.2-4.3 s | 3-6 ms |
... with thinking.display: "updates" (beta) |
95 | 3.8 s | 5 ms |
... with thinking: {type: "between_tools"} |
86 | 3.8 s | 6 ms |
... with tool_choice: {type: "none"} |
88 | 5.6 s | 6 ms |
... through beta.messages.tool_runner(..., stream=True) |
107 | 6.3 s | 5 ms |
Opus 5.5, turn after a tool_result |
65 | 5.2 s | 5 ms |
Sonnet 5, turn after a tool_result |
71-83 | 0.47-0.72 s | 3.5-4.1 s |
Request IDs (26 Nov 2026, about 13:12 UTC; same prompt, tool and tool result):
- Sonnet 5.5, burst: answer turn
req_011ChRbaHRkLM7bHj6jPWq36(78 deltas, first at 3.21 s, all within 5 ms); tool turnreq_011ChRbaEF1ZaodZwXc15MKu. - Sonnet 5, streams: answer turn
req_011ChRbaaj4ibt2FetmyJ9iG(71 deltas, first at 0.72 s, spread over 3.54 s); tool turnreq_011ChRbaXFhozQVeET8t265a.
Our guess is that the API holds post-tool text until it knows whether the text is a progress update (returned as a thinking block on these models) or the final answer. If so, it would be useful to stream the text once that is decided, or to have a request setting for interfaces where a person watches the answer arrive.
Reproduction
import json, time, anthropic
c = anthropic.Anthropic()
tools = [{"name": "get_rate", "description": "Induction of labour rate for an NHS trust.",
"input_schema": {"type": "object", "properties": {"trust": {"type": "string"}}, "required": ["trust"]}}]
Q = "What is Southampton's induction of labour rate? Use the tool, then explain it in about 150 words."
def run(model, msgs):
t0, marks = time.monotonic(), []
with c.messages.stream(model=model, max_tokens=4000, output_config={"effort": "medium"},
tools=tools, messages=msgs) as s:
for ev in s:
if ev.type == "content_block_delta" and ev.delta.type == "text_delta":
marks.append(round((time.monotonic() - t0) * 1000))
return s.get_final_message(), marks
for model in ("claude-sonnet-5-5", "claude-sonnet-5"):
msgs = [{"role": "user", "content": Q}]
m, _ = run(model, msgs)
tu = next(b for b in m.content if b.type == "tool_use")
msgs += [{"role": "assistant", "content": m.content},
{"role": "user", "content": [{"type": "tool_result", "tool_use_id": tu.id,
"content": json.dumps({"rate": 25.8, "births": 5550})}]}]
m2, marks = run(model, msgs)
print(model, "deltas", len(marks), "first_ms", marks[0], "spread_ms", marks[-1] - marks[0])
Expected: the deltas on the answer turn are spread over the generation time (as on claude-sonnet-5).
Actual on claude-sonnet-5-5: the spread is about 5 ms, at the end of the turn.
Questions
- Is this intended on Sonnet 5.5 and Opus 5.5?
- Is a setting planned, or available, that streams the final answer's text as it is generated after a tool call?
- Lingua principale
- Python
- Stelle
- 4.1k
- Fork
- 915
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di anthropics/anthropic-sdk-python
-
beta_tool validation errors reach the model as "Invalid arguments for function X" with no detailForse già presa @mangeshraut712 l’ha presa 32 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
anthropics/anthropic-sdk-python#2033 · 3 commenti ·
-
`AnthropicBedrock` 2.x sends `anthropic_version: 2026-10-21`, which Bedrock rejects for Claude Sonnet 4.5, Opus 4.5 and Opus 4.6Forse già presa @charan-rathore l’ha presa 36 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
anthropics/anthropic-sdk-python#2031 · 1 commento ·
-
Three symlink tests in test_agent_toolset.py are missing the needs_symlinks markerForse già presa @okxint l’ha presa 82 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
anthropics/anthropic-sdk-python#1915 · 3 commenti ·
-
Messages.parse (and AsyncMessages.parse) don't take cache_control?Forse già presa @AlphaFDE l’ha presa 86 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
anthropics/anthropic-sdk-python#1907 · 2 commenti ·
-
Windows: os.fchmod in credential write-back bricks the OAuth refresh tokenForse già presa @OllieinCanada l’ha presa 98 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
anthropics/anthropic-sdk-python#1868 · 1 commento ·
Tutte le issue di anthropics/anthropic-sdk-python
Issue simili
-
bug harness
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
mruangutai/harness#2687 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modal-labs/modal-client#4158 ·
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
The-Swarm-Corporation/swarms-rs#168 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
linuxserver/docker-healthchecks#137 · 1 commento ·