Assistant confirms a command from the values it set, without a second round

run_turn takes answer_tools: false ends the turn once the tools have
answered. The assistant node uses it and says what was set ("Kitchen light
off, living room light off."), which saves one model round, about 1.1 s on
the P100. A turn without a call still streams the model's own words.

rebuild-frontend keeps the running stack's FRONTEND_HOST, so the token
issuer no longer flips between the LAN address and app.localhost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ljdk7nDaguh9Uhi3zhcSjn
This commit is contained in:
Melvin Strobl
2026-10-20 08:26:14 +02:00
co-authored by Claude Opus 5.5
parent 75e257d9e4
commit 5235ac59c2
5 changed files with 59 additions and 28 deletions
+6 -1
View File
@@ -138,13 +138,16 @@ async def run_turn(
call_tool: ToolCaller,
extra: dict[str, Any] | None = None,
timeout: float | httpx.Timeout = 120.0,
answer_tools: bool = True,
) -> AsyncIterator[dict[str, Any]]:
"""One user turn, yielding progress events as it goes.
A round's text arrives as ``delta`` events while the model writes it, and
once more whole as ``message`` when the round is done. A round is appended
to *messages* only once every tool in it has answered, so a turn cut off
part-way leaves a transcript the provider still accepts.
part-way leaves a transcript the provider still accepts. With
*answer_tools* false the turn ends once its tools have answered, for a
caller that words what they did itself.
"""
messages.append({"role": "user", "content": text})
head = {"role": "system", "content": system}
@@ -193,6 +196,8 @@ async def run_turn(
yield {"type": "tool_result", "name": name, **summarize(result)}
messages.append(assistant)
messages.extend(answers)
if not answer_tools:
return
yield {
"type": "error",
"detail": f"Stopped after {config.max_rounds} rounds of tool calls.",