Skip to content

Bug: Vertex AI drops executed code from history #1728

Closed

Description

@karthik-0306

Describe the Bug:
When storing and retrieving session history using the Vertex AI backend (session/vertexai), the aiplatformToGenaiContent and createAiplatformpbContent mappers silently drop ExecutableCode, CodeExecutionResult, and FileData parts. There's a TODO in both functions about exactly this:
// TODO add logic for other types of parts

What that looks like in practice:
If an agent utilizes Gemini's Code Execution tool to run Python code, the session history successfully saves the model's text thought but completely loses the code block it executed and the execution result it received. On the next conversation turn, when the context is retrieved from Vertex AI and fed back to the model, the model hallucinates or repeats itself endlessly because it lacks the execution context it expects.

Steps to Reproduce:

  1. Create a VertexAiClient session service.
  2. Run an agent with the Code Execution tool enabled that outputs ExecutableCode.
  3. Check the saved Vertex AI session event or read it back; the part will be missing.

Expected Behavior:
ExecutableCode, CodeExecutionResult, and FileData parts are preserved in Vertex AI session history (mirroring standard adk-go behavior).

Observed Behavior:
The parts are dropped, causing context corruption on subsequent turns.

Environment Details:
ADK Library Version: main
OS: (Your OS)
Go Version: 1.27.1
Model Information: Gemini (Code Execution)

How often has this issue occurred?: Always

Activity

  1. added a commit that references this issue on Oct 7, 2026
    44d41c9
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions