Skip to content

[Feature Request] Support Google Gemini Interactions API (Stateful & Agentic Multi-turn) #915

Closed as duplicate

Description

@HiroKws

Summary

I would like to propose adding support for Google's Gemini Interactions API to the Gemini provider driver in the Laravel AI SDK.

While the SDK provides rich, first-class support for providers like OpenAI (e.g., stateful Responses API with previous_response_id, structured runs, and server-side state tracking) and Anthropic (e.g., Prompt Caching optimization and native tool workflows), the Gemini driver currently relies on standard, stateless generateContent requests. Supporting the Interactions API will bring feature parity to the Gemini driver by enabling server-side stateful multi-turn interactions, native managed agent execution, and structured step tracking.


Motivation & Problem

Currently, interacting with Gemini in multi-turn or agentic scenarios requires developers to manually maintain, serialize, and re-send the entire message history from the client side.

In contrast to the seamless developer experience available for OpenAI and Anthropic drivers, Gemini users miss out on:

  1. Server-side state management: Google's Interactions API handles session state via previous_interaction_id, eliminating the need to transmit large conversation payloads back and forth.
  2. First-class agent workflows: Intermediate reasoning thoughts, tool calls, and final outputs are structured sequentially into steps, avoiding the need for boilerplate manual function-calling loops.
  3. Background & asynchronous execution: The Interactions API supports asynchronous execution (background: true), which aligns perfectly with Laravel's queue and polling ecosystem for long-running tasks.

Proposed Solution / API Idea

We could introduce support for passing/retrieving interaction IDs and handling stateful conversations cleanly:

use Laravel\AI\Facades\AI;

// 1. Initial interaction
$interaction = AI::agent('gemini')
    ->prompt('Analyze the latest quarterly report.')
    ->execute();

$interactionId =$interaction->id(); // interaction_xxx

// 2. Continuing the conversation via previous_interaction_id
$followUp = AI::agent('gemini')
    ->withPreviousInteraction($interactionId)
    ->prompt('Summarize the risk factors mentioned above.')
    ->execute();

Activity

  1. pushpak1300 commented on Aug 21, 2026

    @pushpak1300
    Member

    I’ll defer this until another provider offers something similar at least 3.

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

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