Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Agent Engine session does not keep track of the current converation

I created an AI agent using ADK, and then deployed it to Agent Engine with using following code:

import os
import vertexai
from vertexai import agent_engines
from dotenv import load_dotenv

from agent import root_agent

load_dotenv()

vertexai.init(
    project=os.getenv("GOOGLE_CLOUD_PROJECT"),
    location=os.getenv("GOOGLE_CLOUD_LOCATION"),
    staging_bucket="gs://" + os.getenv("GOOGLE_CLOUD_PROJECT")+"-bucket",
)

remote_app = agent_engines.create(
    display_name="make-goal-agent",
    agent_engine=root_agent,
    requirements=[
        "google-cloud-aiplatform[adk,agent_engines]"
    ],
    gcs_dir_name = "make-goal-agent"
)

and then I used the following code to query it:

from vertexai import agent_engines

# 1. Get your app
adk_app = agent_engines.get("1492406714798964736")

# 2. List (or create) a session for your user
se_list = adk_app.list_sessions(user_id="Nvc0fHCmtpgl4DfdTKfC7BewPGk1")
if not se_list.get("sessions"):
    # no sessions yet, so create one
    session = adk_app.create_session(user_id="Nvc0fHCmtpgl4DfdTKfC7BewPGk1")
    session_id = session["id"]
else:
    session_id = se_list["sessions"][0]["id"]

print(session_id)
# 3. Stream your query into *that* session
for event in adk_app.stream_query(
    user_id="Nvc0fHCmtpgl4DfdTKfC7BewPGk1",
    session_id=session_id,               # use the real variable here
    message="""
    {"text": "yh I would like to learn the bascis and then continue to the advance"}
    """
):
    print(event)

 

few days before this worked fine, but now everytime I change the message, and run it, it always starts from the beginning. like it does not have any idea about what we told before.

2 2 188
2 REPLIES 2

I'm having the same issue, it was working until tomorrow, and still working locally when using ADK web. But not, Agent don't seems to have  Session memory. 

Please help. 

I believe that this issue has been resolved on the agent engine side.