Skip to content

feat(ui): stream GAIA's work as a live timeline of notes, steps and thinking - #5966

Merged
kovtcharov-amd merged 6 commits into
amd:mainfrom
tylerbea:claude/agent-streaming-ui-23c7e2
Oct 28, 2026
Merged

kovtcharov-amd merged 6 commits into
amd:mainfrom
tylerbea:claude/agent-streaming-ui-23c7e2

Conversation

@tylerbea

@tylerbea tylerbea commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

While GAIA worked, the Agent UI folded everything into one collapsed "6 steps · 4 tools" bar and a "Thinking…" line. On an installed GAIA it also dropped the model's reasoning and every step's description. Now each turn streams as a live timeline, the way Claude Code shows its work:

  • Notes the agent writes before a tool call appear in full.
  • Each step shows live with its own icon and timer.
  • Reasoning scrolls by, then folds to "Thought for 8s".
  • Finished steps fold into one line between notes.
  • The last line says what the model is doing ("Reading your request", "Waiting for the model — 'gaia' is using it").

All of this works the same whether the agent runs in-process or as an installed background agent. Older installed agents keep working; they just show no reasoning until they update.

Same question, "Find the README in this folder, read it, and tell me in three bullets what this project is", in the old and new window, on Gemma-4-E4B:

Before (main) After
While it works before, live after, live
Answered before, done after, done

Opening the folded line shows each step, with its own icon and the time each thought took:

after, opened

Closes #5965

  • Thinking for installed GAIA needs agent contract 2.22. /query takes reasoning: true and streams reasoning events. The relay asks only agents at 2.22 or later, so an older one is never sent a field it would 422. The contract spec and the agent package's README, SPEC, SKILL and CHANGELOG move together.
  • The step count moved from the old bar to the line under the answer ("Answered in 40 s · 6 steps"). It is still the agent's own count.

Test plan

  • npx vitest run in src/gaia/apps/webui: 1,929 tests. Under load, 3 ChatView tests timed out (history notice, session panel, transcript). This change doesn't touch them, and they pass alone, on this branch and on the commit before.
  • pytest tests/unit/test_sse_narration.py tests/unit/test_sidecar_relay_fidelity.py tests/unit/test_email_sidecar_relay.py tests/unit/chat/ui/test_relayed_reasoning.py tests/unit/chat/ui/test_relayed_surface.py: 227 passed
  • pytest hub/agents/gaia/python/tests: 814 passed. 4 fail on this Mac without the browser extra and the installed entry point, the same 4 as on main.
  • Before and after comparison of tests/unit/chat/ui, tests/unit/api and related files against main: identical failures, all caused by a running Lemonade tripping the test guard.
  • Live on macOS with Gemma-4-E4B, agent in-process: notes, steps, timers and "Thought for Ns" stream, and finished steps fold.
  • Live with the installed 0.3.1 agent (contract 2.21): steps carry plain descriptions, the live line shows each phase, no reasoning is requested, and reload mid-turn and Stop both work.
  • Live with a contract-2.22 agent from this branch, relayed through a private daemon: reasoning streams and folds the same as in-process.
  • Opening a folded group plays no entry motion, measured in the browser.
  • Reviewer: repeat the desktop check on Windows
🔍 Technical details
  • SSEOutputHandler._emit turns text streamed since the last tool call into a commentary event just before the next tool_start. Both paths share that sink: the relay calls handler._emit, so commentary needs no contract change. The sidecar's translator drops its own copy. _stream_chat_impl saves it as a commentary step.
  • AgentActivity splits the rows into notes and step runs (toTimeline). A finished run folds behind stepsSummary, and the run in progress stays open. Status rows are gone: the live line (liveLine prop, rendered after the timeline) carries the phase instead.
  • The relay now forwards the tool_call narration and the status phase/words/chars/queue, and maps reasoning to thinking.
  • Streamed <think> pieces keep their spacing. The live join changed from \n to '' to match how the saved turn joins them, and _close_reasoning saves the reasoning time on the last piece.
  • No prompt, tool schema or tool-calling change, so no eval categories are affected.

The chat folded all of GAIA's work into one collapsed "N steps · M tools"
bar, so a long turn showed almost nothing until the answer. Each turn now
reads like Claude Code: notes GAIA writes before a tool call appear in
full, each step shows live with a timer, reasoning scrolls by and then
folds to "Thought for Ns", and finished steps fold into one line between
notes.

- Text streamed right before a tool call is sent as a `commentary` event,
  in the event sink both the in-process and relayed paths share, and is
  saved with the turn.
- Relayed turns keep each step's plain-language narration and drop the
  finished step from the live line.
- Streamed reasoning keeps its word spacing; the step count moves to the
  line under the answer.
…aits

An installed GAIA sent its reasoning folded into status lines the Agent UI
drops, so its chats never showed any thinking, and the live line read a bare
"Thinking…" through model queues and long prompt reads. The relay now asks
an agent at contract 2.22 or later for its reasoning and shows it like an
in-process turn, and passes each status's phase through so the live line
says "Reading your request" or "Waiting for the model".

- `/query` takes `reasoning: true` (contract 2.22) and streams `reasoning`
  events. Older agents are never sent the field and behave as before.
- Opening a folded run no longer replays the steps' entry motion.
- A finished step shows what it did (a globe for web searches, a link for
  page reads) instead of a green check.
@github-actions github-actions Bot added documentation Documentation changes tests Test changes electron Electron app changes labels Oct 28, 2026
@tylerbea
tylerbea marked this pull request as ready for review October 28, 2026 03:20
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

The Agent UI now shows each turn as it happens: the agent's own notes, each step with its timer, reasoning that folds to "Thought for Ns", and a live line saying what the model is doing. It works for both the in-process agent and the installed one. The new contract field (2.22) is only sent to agents that support it, and the agent package's docs were all updated together. I found no blocking issues. The behaviour that could have lost data, moving already-streamed text out of the answer when a tool call follows, is safe: the saved answer still comes from the final answer event, or from the agent's own result when that event is missing.

Two small follow-ups:

  • Two separate reasoning messages now run together with no space between them ("Executing plan stepStart with…"), because live reasoning pieces are joined directly.
  • Two icon imports are left over from the old summary bar.

Real-world evidence

N/A — no evidence-bundle.md was produced for this run. The PR description has its own evidence: before/after Playwright-style screenshots, embedded as raw images, of the same question on Gemma-4-E4B (in progress, answered, and the folded line opened). It also records live checks with the installed 0.3.1 agent (contract 2.21) and a 2.22 agent relayed through a daemon. I didn't re-run any of that here; pytest isn't installed on this runner. For anything the description doesn't show, this verdict rests on reading the code. The Windows desktop check is still an open item in the test plan.

🔍 Technical details

Issues

🟢 Separate thoughts fuse when they are adjacent (src/gaia/apps/webui/src/stores/chatStore.ts:420)
The '' join is correct for streamed <think> pieces, which keep their own spacing. But print_thought also emits whole thinking events, for example the plan-step path at src/gaia/agents/base/agent.py:9468. When one of those sits next to streamed reasoning, or next to another thought (consolidateSteps absorbs the status between them), the words run together. The saved path already joined with '', so this only matters cosmetically. One option is to have print_thought add a trailing \n to its content in sse_handler.py, which keeps the fix at the source:

        self._emit(
            {
                "type": "thinking",
                "content": thought if thought.endswith("\n") else f"{thought}\n",
            }
        )

(applies to src/gaia/ui/sse_handler.py print_thought; streamed pieces are unaffected)

🟢 Unused imports (src/gaia/apps/webui/src/components/AgentActivity.tsx:6,13)
ChevronDown and Zap were only used by the removed summary bar. noUnusedLocals is off, so neither tsc nor lint will flag them.

Notes checked and found fine

  • _stream_chat_impl resetting full_response on commentary doesn't lose the answer. A later answer event overwrites it, and an empty response falls back to result_holder["answer"]. toTimeline also hides a note that the final answer starts with, so the note isn't shown twice.
  • _close_reasoning and thoughtDurations agree: latencyMs is stored on the last piece and measured from the first piece's timestamp. Both use the backend's own monotonic clock for saved turns.
  • commentary is created once, inside the host's SSEOutputHandler._emit. The sidecar translator drops its own copy, so a relayed turn can't double it. Tests cover both paths.
  • reasoning_supported uses the same version check as the other relay fields, so the email agent and pre-2.22 agents are never sent reasoning.

Strengths

  • The contract change follows the usual additive-MINOR pattern. The server, openapi.gaia.json, lifecycle.ts, README, SPEC, SKILL, CHANGELOG and the shared SSE spec all move together, and spec Q1 is marked resolved.
  • The relay now passes on phase, narration and status counts, and falls back to derive_narration for older sidecars, so installed and in-process turns look the same.
  • The tests target behaviour, not internals: notes are taken out of the answer, reasoning spacing is preserved, older agents are never sent a field they would 422, and a CSS check stops entry animations from replaying when a folded group is opened.

tylerbea and others added 3 commits October 27, 2026 21:38
…ning

CI caught two gaps. A folded run holding a policy block read "Hit an error",
where the old bar said "Blocked by policy"; it now says so again. The Slack
adapter must handle every event the translator can emit, and the new
`reasoning` event is only sent to a client that asks for it, which Slack
never does, so the adapter skips it on purpose.
Live thinking pieces are now joined with no separator, so a whole thought
from print_thought ran straight into the next one ("plan stepStart with").
A whole thought now ends on a newline. Also drops two icon imports the
removed summary bar left behind, and adds tests that a turn with hundreds
of steps renders and ticks quickly and that streamed notes and reasoning
cannot inject markup.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Thanks @kurplunkin, this is a big improvement: seeing the agent's own notes and the "Thought for 8s" fold makes a long turn much easier to follow, and keeping the reasoning field behind the 2.22 version check means older installed agents can't get a 422. I merged main in (no conflicts) and pushed one small commit that covers both review-bot follow-ups.

  • Two whole thoughts next to each other no longer run together ("plan stepStart with…"), because a whole thought now ends on a newline.
  • The two icon imports left over from the old summary bar are gone.

The earlier red CI (the Slack contract test and the Electron "Blocked by policy" check) came from the commit before your last one, and your last commit already fixed it.

🔍 Technical details
  • SSEOutputHandler.print_thought appends \n unless the thought is empty or already ends with one. Streamed <think> pieces are untouched. Tests in test_sse_handler.py cover the newline case, an already-terminated thought, an empty thought, and two adjacent thoughts joined with ''.
  • AgentActivity.timelineStress.test.tsx checks that 600 live steps render and tick in well under the limit, that a finished 400-step run folds to a single line, and that a note or reasoning containing <img onerror>, <script>, <iframe> or a javascript: link renders as inert text.
  • Local results after the merge: vitest 1,949 passed, tsc --noEmit clean, hub/agents/gaia/python/tests 818 passed, and the UI, relay, messaging and API unit tests passed. ChatView.tsx is 100,401 bytes with LF endings, under the 102,400 cap.

…mapped

The host's output handler now emits a commentary event for text the model
writes just before a tool call. The email agent's translator didn't know
it, so the Agent UI showed '[unmapped agent event: commentary]' and saved
it with the turn. It now drops the event like the core translator does:
the words already went out as tokens. Slack reads the same translated
stream, so this covers it too.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

One more fix pushed, for the email agent. When the email model wrote a sentence before checking mail, the Agent UI showed [unmapped agent event: commentary] and saved that line with the turn. The email agent now drops that event, the same way the GAIA agent does, because the words already reached the chat as normal text. Slack reads the same stream, so this fixes it there too.

🔍 Technical details
  • Added "commentary": _on_commentary (returns []) to _DISPATCH in gaia_agent_email/sse_translation.py.
  • test_sse_translation.py now feeds the real SSEOutputHandler a note followed by tool_start, and checks three things: no unmapped status, the note's text is sent once as tokens, and every event type the real handler emits is in _DISPATCH. Without the fix, all 3 new tests fail.
  • Added the change to the CHANGELOG under Unreleased in both hub/agents/email/python and hub/agents/email/npm.

@github-actions github-actions Bot added the agent::email Email agent changes label Oct 28, 2026
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 28, 2026
Merged via the queue into amd:main with commit 61dd772 Oct 28, 2026
49 checks passed
kovtcharov-amd added a commit to tylerbea/gaia that referenced this pull request Oct 28, 2026
main's amd#5966 took contract 2.22 for /query's reasoning field, and that
contract shipped in v0.25.2-rc5. internet_off and /sessions/{id}/internet
move to 2.23, so a 2.22 agent from rc5 is not mistaken for one that takes
the switch and sent a field it would 422.

From amd#5961, a relayed GAIA chat can now be given a folder; only taking one
away is still refused, and that refusal no longer mentions the internet.

The live-sidecar switch tests released the parked agent before the relay
had re-read the switch, so they raced the push they were checking. They now
wait for the relay to go live, as a real first tool call waits on a model
reply.
kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Nov 11, 2026
Main has moved a long way since the last update; this keeps the branch's
opt-in eviction on top of it. Nothing main ships duplicates it: main still
carries only the defaults-on overflow retry from amd#5396.

- The chat package was folded into the flagship (amd#7035): the eviction
  settings move into gaia_agent/chat_agent.py, beside main's new
  resend_reasoning_across_requests, and the CHANGELOG entry moves to the
  gaia npm package's Unreleased section.
- Kept main's tool_scope argument and its unsaved-memory nudge next to the
  re-read reminder.
- Agent UI: main's timeline (amd#5966) hides finished status rows, so a
  context notice now draws its own row and stays after the turn ends.
  Status handling moved into applyStatusEvent, so the notice is added there.
- The closing-answer overflow tests from amd#6875 now patch the evictor's
  counter, which this branch sizes the trim with.
- Two second-turn tests now run at a 64K window: at 16K, main's history
  fitting drops the whole earlier turn, so there is nothing to replay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent::email Email agent changes documentation Documentation changes electron Electron app changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent UI hides what GAIA is doing while it works

2 participants