Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add deep-research-pro-preview-12-2025 model to Google and Vertex providers
  • Implement executeDeepResearchRequest using the Interactions API with full streaming and polling support
  • Hide unsupported agent block fields (tools, skills, temperature, maxTokens, responseFormat) for deep research models
  • Add deepResearch model capability, MODELS_WITH_DEEP_RESEARCH constant, and isDeepResearchModel helper

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 11, 2026 9:01am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR adds support for Gemini Deep Research using the Interactions API, enabling background research tasks that can run up to 60 minutes. The implementation properly routes deep research models through a specialized execution path (executeDeepResearchRequest) separate from the standard generateContent API.

Key Changes

  • Added deep-research-pro-preview-12-2025 model to Google and Vertex providers with deepResearch capability flag
  • Implemented full streaming and non-streaming support via the Interactions API with proper polling (10s intervals, 60min max)
  • Added multi-turn support through previousInteractionId input and interactionId output for follow-up research queries
  • Conditionally hides unsupported UI fields (tools, skills, memory, temperature, maxTokens, responseFormat) when deep research models are selected
  • Includes comprehensive token logging with support for total_reasoning_tokens / total_thought_tokens

Architecture Notes

The implementation correctly recognizes that deep research is fundamentally different from standard chat completion - it's a long-running background task that conducts comprehensive research rather than a conversational exchange. The code appropriately warns users when they try to use unsupported features (custom tools, structured output) and gracefully ignores these parameters.

The streaming implementation properly handles all InteractionSSEEvent types including content.delta, interaction.start, interaction.complete, and error events, with appropriate error propagation through the ReadableStream controller.

Confidence Score: 4/5

  • This PR is safe to merge with minor considerations around edge cases
  • The implementation is well-structured with proper error handling, comprehensive documentation, and follows established patterns in the codebase. Token logging includes reasoning tokens, streaming/polling are both implemented correctly, and UI conditionals properly hide unsupported features. Score is 4 (not 5) because: (1) the non-streaming polling lacks explicit cancellation mechanism if workflow is cancelled mid-execution, (2) edge case where an interaction could theoretically be in a terminal state other than completed/failed/cancelled isn't explicitly handled.
  • apps/sim/providers/gemini/core.ts - Review the polling loop timeout and cancellation behavior

Important Files Changed

Filename Overview
apps/sim/providers/gemini/core.ts Implements deep research via Interactions API with comprehensive streaming/polling support, proper error handling, and token logging
apps/sim/blocks/blocks/agent.ts Conditionally hides unsupported fields (tools, skills, memory, temperature, maxTokens, responseFormat) for deep research models, adds previousInteractionId input and interactionId output
apps/sim/providers/models.ts Adds deep-research-pro-preview-12-2025 to both Google and Vertex providers with deepResearch capability, includes getModelsWithDeepResearch helper

Sequence Diagram

sequenceDiagram
    participant User
    participant AgentBlock
    participant AgentHandler
    participant GeminiCore
    participant InteractionsAPI
    
    User->>AgentBlock: Configure deep research model
    Note over AgentBlock: Hide tools, skills, memory,<br/>temperature, maxTokens, responseFormat
    User->>AgentBlock: Optionally provide previousInteractionId
    AgentBlock->>AgentHandler: Execute with inputs
    AgentHandler->>GeminiCore: executeDeepResearchRequest()
    
    alt Streaming Mode
        GeminiCore->>InteractionsAPI: create(stream: true)
        InteractionsAPI-->>GeminiCore: InteractionSSEEvent stream
        GeminiCore->>GeminiCore: createDeepResearchStream()
        loop Stream Events
            InteractionsAPI-->>GeminiCore: content.delta events
            GeminiCore-->>User: Stream text chunks
        end
        InteractionsAPI-->>GeminiCore: interaction.complete
        GeminiCore->>GeminiCore: Extract usage & interactionId
        GeminiCore-->>AgentHandler: StreamingExecution
    else Non-Streaming Mode
        GeminiCore->>InteractionsAPI: create(stream: false)
        InteractionsAPI-->>GeminiCore: Interaction (pending)
        loop Poll until complete
            GeminiCore->>InteractionsAPI: get(interactionId)
            InteractionsAPI-->>GeminiCore: Interaction status
            Note over GeminiCore: Wait 10s between polls<br/>Max 60min timeout
        end
        GeminiCore->>GeminiCore: Extract text from outputs
        GeminiCore-->>AgentHandler: ProviderResponse
    end
    
    AgentHandler->>AgentHandler: Include interactionId in response
    AgentHandler-->>User: Response with interactionId for multi-turn
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +422 to +425
input:
userParts.length > 0
? userParts[userParts.length - 1]
: 'Please conduct research on the provided topic.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only using the last message loses conversation history for multi-turn interactions. If a user has multiple messages or assistant responses in the conversation, all context except the final user message is discarded.

Consider either:

  1. Concatenating all messages with role labels: userParts.map((msg, i) => Message ${i+1}: ${msg}).join('\n\n')
  2. Or documenting that deep research only supports single-turn interactions

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1 waleedlatif1 merged commit 2f492ca into staging Feb 11, 2026
6 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/interactions branch February 11, 2026 09:02
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant