Skip to content

Feature: Add reasoning event support to Gemini CLI bridge #1127

@onmete

Description

@onmete

🚀 Feature Description

Is your feature request related to a problem?
The ag_ui_gemini_cli adapter (ag_ui_gemini_cli/adapter.py) only emits TEXT_MESSAGE_*, TOOL_CALL_*, RUN_STARTED/FINISHED/ERROR, and MESSAGES_SNAPSHOT events. There are no REASONING_MESSAGE_START/CONTENT/END events anywhere in the Gemini bridge code. This means the Gemini models' reasoning/thinking output is silently discarded.

Describe the solution you'd like
Add support for emitting REASONING_MESSAGE_START, REASONING_MESSAGE_CONTENT, and REASONING_MESSAGE_END AG-UI events in the Gemini CLI adapter, similar to how other bridges handle reasoning output.

💡 Proposed Solution

Detailed Description: Parse the Gemini CLI's reasoning/thinking output from the NDJSON stream and emit the corresponding AG-UI reasoning events so that reasoning traces are surfaced to the frontend.

User Experience: Users will be able to see the model's reasoning/thinking process in the UI, providing better transparency into how the model arrives at its answers.

🎯 Use Cases

Primary Use Case: Developers and users interacting with Gemini models through the Ambient platform who want visibility into the model's reasoning process.

User Stories:

  • As a user, I want to see the Gemini model's reasoning process so that I can understand how it arrived at its answer
  • As a developer, I want reasoning events from Gemini so that the UI can display thinking traces consistently across all model providers

🔧 Technical Considerations

Component: Ambient Agentic Runner — Gemini CLI bridge

File: components/runners/ambient-runner/ag_ui_gemini_cli/adapter.py

Implementation Approach: Identify the Gemini CLI's reasoning/thinking output format in the NDJSON stream, then map those entries to REASONING_MESSAGE_START/CONTENT/END AG-UI events in the adapter's event processing loop.

Breaking Changes: No — this is additive. Existing events are unaffected.

✅ Acceptance Criteria

  • Gemini CLI reasoning/thinking output is parsed from the NDJSON stream
  • REASONING_MESSAGE_START, REASONING_MESSAGE_CONTENT, and REASONING_MESSAGE_END events are emitted
  • Reasoning traces appear in the frontend UI when using Gemini models
  • Existing event types remain unaffected
  • Tests added for reasoning event emission

🏷️ Labels

  • Priority: medium
  • Effort: M
  • Component: backend
  • Type: enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions