-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(providers): add Gemini Deep Research via Interactions API #3192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis 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 ( Key Changes
Architecture NotesThe 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 Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
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
|
There was a problem hiding this 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
| input: | ||
| userParts.length > 0 | ||
| ? userParts[userParts.length - 1] | ||
| : 'Please conduct research on the provided topic.', |
There was a problem hiding this comment.
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:
- Concatenating all messages with role labels:
userParts.map((msg, i) =>Message ${i+1}: ${msg}).join('\n\n') - Or documenting that deep research only supports single-turn interactions
|
@greptile |
|
@cursor review |
There was a problem hiding this 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
|
@cursor review |
|
@cursor review |
|
@cursor review |
There was a problem hiding this 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
Summary
deep-research-pro-preview-12-2025model to Google and Vertex providersexecuteDeepResearchRequestusing the Interactions API with full streaming and polling supportdeepResearchmodel capability,MODELS_WITH_DEEP_RESEARCHconstant, andisDeepResearchModelhelperType of Change
Testing
Tested manually
Checklist