How to update state once session is created in agent engine

I am using Vertex AI Agent Engine and creating a session via the synchronous query API.

I create the session using:

Endpoint

POST https://aiplatform.googleapis.com/v1/{name}:query

Payload

{
  "class_method": "create_session",
  "input": {
    "user_id": "<USER_ID>",
    "state": {
      "auth_token": "INITIAL_TOKEN"
    }
  }
}

This successfully creates the session, and the agent can access state.auth_token during execution.


Problem

The auth_token stored in state can expire. I want to update or refresh this token later during the same session lifecycle.

When I try to send an updated state while sending messages using the streaming API:

Endpoint

POST https://aiplatform.googleapis.com/v1/{name}:streamQuery

and include state again in the payload, I get the following error:

{
  "code": 498,
  "message": "Runner.run_async() got an unexpected keyword argument 'state'"
}

This suggests that state is not accepted during streamQuery.


Questions

  1. Is session state immutable after create_session?
  2. Is there any supported API or mechanism to update session state after creation?

Context

  • Agent Engine (Vertex AI)
  • Using both query and streamQuery
  • Auth token is required by downstream tools invoked by the agent

Any guidance or recommended best practices would be appreciated.