Skip to content

Built-in load-memory tool does not work in combination with VertexAiSessionService #792

@nicholasbreckwoldt

Description

@nicholasbreckwoldt

Describe the Bug:
Use of built-in load_memory tool results in error when an agent is configured to use the VertexAiSessionService for managing session events. In particular, the error is raised when appending the resulting function_response event to the session service.

Steps to Reproduce:

  1. Configure the VertexAI Sessions service and set agent launcher to use it
  2. Register the built-in ADK load_memory tool on the agent
  3. Launch adk agent via the ADK web UI
  4. Submit a query to the agent that produces a load_memory tool call

Reproducing code snippet provided below.

...
  // Initialise Vertex AI Engine Session Service
  sessionService, err := vertexai.NewSessionService(ctx, vertexai.VertexAIServiceConfig{
  	ProjectID: "PROJECT",
  	Location:  "LOCATION",
      ReasoningEngine: "REASONING_ENGINE",
  })
  if err != nil {
      log.Fatalf("failed to create session service")
  }

// Create new agent
  adkAgent, err := llmagent.New(llmagent.Config{
      Name:        "agent",
      Model:       model,
      Description: "Description",
      Instruction: "You are a helpful assistant..",
      Tools: []tool.Tool{
          loadmemorytool.New(),
      },
  })
  if err != nil {
      log.Fatalf("failed to create agent: %v", err)
  }  

  // Configure launcher
  config := &launcher.Config{
      AgentLoader: agent.NewSingleLoader(adkAgent),
      SessionService: sessionService,
      MemoryService: memory.InMemoryService(),
  }

...

Expected Behavior:

The agent should process the request, generate a load_memory function call event, execute the tool to retrieve results, generate a load_memory function response and successfully store the resulting function response event in the sessions service.

Observed Behavior:

The agent loop fails with the below error, indicating that the created function response event could not be successfully appended to the session service.

Image

Additional Context:
Further debugging revealed that the source of the error is linked to the attempted conversion of the returned function response result to structpb.Struct type within the underlying session service VertexAI client setup. [memory.Entry] is not a valid type that the NewStruct() function is able to successfully handle.

Image

Environment Details:

  • ADK Library Version: 1.2.0

Model Information:

  • N/A

Metadata

Metadata

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions