Client
cloud.google.com/go/aiplatform v1.125.0 — SessionClient and MemoryBankClient (google.cloud.aiplatform.v1beta1).
APIs involved:
SessionService: CreateSession, GetSession, AppendEvent
MemoryBankService: GenerateMemories (VertexSessionSource.session)
Environment
- Region:
europe-west1
- Endpoint:
europe-west1-aiplatform.googleapis.com:443
- Auth: Application Default Credentials /
gcloud auth application-default login
- Reasoning engine with Memory Bank enabled
$ go version
go version go1.26.1 darwin/arm64
Code and Dependencies
op, err := sessionsClient.CreateSession(ctx, &aiplatformpb.CreateSessionRequest{
Parent: engine,
Session: &aiplatformpb.Session{
DisplayName: "...",
UserId: "...",
},
// FAILS at GenerateMemories when SessionId contains "-":
SessionId: "1241-5274-1831-5378",
// SUCCEEDS with dash-free id, e.g. SessionId: "7255567233196042880",
// or omit SessionId to let Vertex assign an id.
})
session, _ := op.Wait(ctx)
_, err = sessionsClient.AppendEvent(ctx, &aiplatformpb.AppendEventRequest{
Name: session.GetName(),
Event: &aiplatformpb.SessionEvent{ /* user/model turn */ },
})
// AppendEvent succeeds.
memoryOp, err := memoriesClient.GenerateMemories(ctx, &aiplatformpb.GenerateMemoriesRequest{
Parent: engine,
Source: &aiplatformpb.GenerateMemoriesRequest_VertexSessionSource_{
VertexSessionSource: &aiplatformpb.GenerateMemoriesRequest_VertexSessionSource{
Session: session.GetName(), // exact name from CreateSession response
},
},
})
// GenerateMemories fails when SessionId contained hyphens (see Actual behavior).
go.mod
module my.module.name
go 1.26.1
require (
cloud.google.com/go/aiplatform v1.125.0
google.golang.org/api v0.274.0
google.golang.org/grpc v1.81.1
google.golang.org/protobuf v1.36.11
)
Expected behavior
CreateSessionRequest documents that a client-supplied session_id may include hyphens:
// Optional. The user defined ID to use for session, which will become the
// final component of the session resource name. If not provided, Vertex AI
// will generate a value for this ID.
//
// This value may be up to 63 characters, and valid characters are
// `[a-z0-9-]`. The first character must be a letter, and the last character
// must be a letter or number.
SessionId string
(Source: cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb/session_service.pb.go, CreateSessionRequest.)
Given a valid session_id, GetSession, AppendEvent, and GenerateMemories should all resolve the same session.name, including when the final path segment contains hyphens (e.g. a standard UUID from uuid.NewString()).
GenerateMemoriesRequest.VertexSessionSource documents the session field as:
// Format:
// `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
Session string
(Source: memory_bank_service.pb.go, GenerateMemoriesRequest_VertexSessionSource.)
Actual behavior
session_id on CreateSession |
GetSession / AppendEvent |
GenerateMemories |
| Omitted (Vertex auto-assign) |
OK |
OK |
Client id without hyphens (e.g. 7255567233196042880) |
OK |
OK |
Client id with hyphens (e.g. 1241-5274-1831-5378 or 10559c82-418d-43fc-8a89-1515fea4837a) |
OK |
NOT_FOUND |
When GenerateMemories fails, the error reports sessionId: 0 even though the request used the full session.name from the create response (non-zero, hyphenated final segment), for example:
rpc error: code = NotFound desc = Session (projectNumber: 111111111111, reasoningEngineId: 2222222222222222222, sessionId: 0) not found.
Example session.name after create with session_id = "1241-5274-1831-5378":
projects/111111111111/locations/europe-west1/reasoningEngines/2222222222222222222/sessions/1241-5274-1831-5378
Screenshots
Not applicable.
Additional context
Steps to reproduce
CreateSession with session_id containing - (see Code).
AppendEvent on returned session.name — succeeds.
GenerateMemories with vertex_session_source.session = session.name — fails as above.
Workarounds
- Omit
session_id on create; persist Vertex-assigned id (often numeric, no hyphens).
- Use dash-free client ids, e.g.
strings.ReplaceAll(uuid.NewString(), "-", "").
Impact
Apps using hyphenated session ids with AddSessionToMemory / GenerateMemories after agent turns see successful runs but memory generation fails.
Client
cloud.google.com/go/aiplatformv1.125.0 —SessionClientandMemoryBankClient(google.cloud.aiplatform.v1beta1).APIs involved:
SessionService:CreateSession,GetSession,AppendEventMemoryBankService:GenerateMemories(VertexSessionSource.session)Environment
europe-west1europe-west1-aiplatform.googleapis.com:443gcloud auth application-default loginCode and Dependencies
go.mod
Expected behavior
CreateSessionRequestdocuments that a client-suppliedsession_idmay include hyphens:(Source:
cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb/session_service.pb.go,CreateSessionRequest.)Given a valid
session_id,GetSession,AppendEvent, andGenerateMemoriesshould all resolve the samesession.name, including when the final path segment contains hyphens (e.g. a standard UUID fromuuid.NewString()).GenerateMemoriesRequest.VertexSessionSourcedocuments the session field as:(Source:
memory_bank_service.pb.go,GenerateMemoriesRequest_VertexSessionSource.)Actual behavior
session_idonCreateSessionGetSession/AppendEventGenerateMemories7255567233196042880)1241-5274-1831-5378or10559c82-418d-43fc-8a89-1515fea4837a)When
GenerateMemoriesfails, the error reportssessionId: 0even though the request used the fullsession.namefrom the create response (non-zero, hyphenated final segment), for example:Example
session.nameafter create withsession_id = "1241-5274-1831-5378":Screenshots
Not applicable.
Additional context
Steps to reproduce
CreateSessionwithsession_idcontaining-(see Code).AppendEventon returnedsession.name— succeeds.GenerateMemorieswithvertex_session_source.session = session.name— fails as above.Workarounds
session_idon create; persist Vertex-assigned id (often numeric, no hyphens).strings.ReplaceAll(uuid.NewString(), "-", "").Impact
Apps using hyphenated session ids with
AddSessionToMemory/GenerateMemoriesafter agent turns see successful runs but memory generation fails.