Supported methods¶
Summary¶
| Method | Description | Reference | Support | |||
|---|---|---|---|---|---|---|
| Python | Go | Java | ||||
| Session management | ||||||
| create_session | Deprecated, use async_create_session instead | ✅ | ❌ | ❌ | ||
| async_create_session | ✅ | ✅ | ❌ | |||
| async_get_session | ✅ | ✅ | ❌ | |||
| async_list_sessions | ✅ | ✅ | ❌ | |||
| async_delete_session | ✅ | ✅ | ❌ | |||
| get_session | ✅ | ✅ | ❌ | |||
| list_sessions | ✅ | ✅ | ❌ | |||
| delete_session | ✅ | ✅ | ❌ | |||
| async_get_session | ✅ | ✅ | ❌ | |||
| async_list_sessions | ✅ | ✅ | ❌ | |||
| async_create_session | ✅ | ✅ | ❌ | |||
| async_delete_session | ✅ | ✅ | ❌ | |||
| Memory | ||||||
| async_add_session_to_memory | ✅ | ✅ | ❌ | |||
| async_search_memory | ✅ | ✅ | ❌ | |||
| Query | ||||||
| stream_query | ✅ | ✅ | ❌ | |||
| async_stream_query | ✅ | ✅ | ❌ | |||
| streaming_agent_run_with_events | ✅ | ✅ | ❌ | |||
| Others | ||||||
| register_feedback | ✅ | ✅ | ❌ | |||
AIPlatform API for Agent Engine¶
Calling the Agent Engine methods¶
AIPlatform AgentEngine Input¶
Input is JSON formatted according to the following schema.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://google.com/agentengine/aiplatform.json",
"title": "AgentEngine wrapper for AIPlatform",
"description": "",
"type": "object",
"properties": {
"class_method": {
"description": "Name of the underlying method",
"type": "string"
},
"input": {
"description": "Method-specific input",
"type": "object"
},
},
"required": [
"class_method",
"input"
]
}
Response for streaming¶
For early failures, before the streaming starts, the response is just like the one for non-streaming version
After the streaming starts, it provides a stream of JSON-formatted data one per line. JSON object is specific for the called method. In case of an error, the HTTP status is already 200 and cannot be changed, so the error is formatted as an streaming data as well, according to the schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://google.com/agentengine/streaming_error.json",
"title": "Defines how streaming errors are formatted",
"description": "",
"type": "object",
"properties": {
"error": {
"description": "Object describing the error",
"type": "object"
},
},
"required": [
"error"
]
}
Response for non-streaming¶
On success, the response is JSON-formatted response specific for the called method (class_method).
On failure, the response is JSON-formatted error similar to the following one:
{
"error": {
"code": 400,
"message": "Reasoning Engine Execution failed.\nPlease refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/use) for checking logs and other troubleshooting tips.\nError Details: {\"detail\":\"Agent Engine Error: An error occurred during invocation. Exception: 404 NOT_FOUND. {'error': {'code': 404, 'message': 'Session projects/kdroste-adk-2025-12/locations/us-central1/reasoningEngines/3765669545214214144/sessions/7177615616973471745 not found.', 'status': 'NOT_FOUND'}}\\nRequest Data: {'session_id': '7177615616973471745', 'user_id': 'u_12345_non_existing'}\"}",
"status": "FAILED_PRECONDITION",
"details": [
{
"@type": "type.googleapis.com/google.rpc.DebugInfo",
"detail": "[ORIGINAL ERROR] generic::failed_precondition: Reasoning Engine Execution failed.\nPlease refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/use) for checking logs and other troubleshooting tips.\nError Details: {\"detail\":\"Agent Engine Error: An error occurred during invocation. Exception: 404 NOT_FOUND. {'error': {'code': 404, 'message': 'Session projects/kdroste-adk-2025-12/locations/us-central1/reasoningEngines/3765669545214214144/sessions/7177615616973471745 not found.', 'status': 'NOT_FOUND'}}\\nRequest Data: {'session_id': '7177615616973471745', 'user_id': 'u_12345_non_existing'}\"} [google.rpc.error_details_ext] { message: \"Reasoning Engine Execution failed.\\nPlease refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/use) for checking logs and other troubleshooting tips.\\nError Details: {\\\"detail\\\":\\\"Agent Engine Error: An error occurred during invocation. Exception: 404 NOT_FOUND. {\\'error\\': {\\'code\\': 404, \\'message\\': \\'Session projects/kdroste-adk-2025-12/locations/us-central1/reasoningEngines/3765669545214214144/sessions/7177615616973471745 not found.\\', \\'status\\': \\'NOT_FOUND\\'}}\\\\nRequest Data: {\\'session_id\\': \\'7177615616973471745\\', \\'user_id\\': \\'u_12345_non_existing\\'}\\\"}\" }"
}
]
}
}
Create session¶
You should use async_create_session. create_session is deprecated.
async_create_session¶
Input¶
Input adheres to the general schema :
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://google.com/agentengine/async_create_session.schema.json",
"title": "Request for async_create_session",
"description": "",
"type": "object",
"properties": {
"user_id": {
"description": "UserID",
"type": "string"
},
"state": {
"description": "Dictionary mapping string to objects",
"type": "object"
},
},
"required": [
"user_id"
]
}
Semantics¶
Creates a new session
Output¶
Session data is returned
TODO(kdroste): create a schema for that¶
type SessionData struct {
UserID string `json:"user_id"`
LastUpdateTime float64 `json:"last_update_time"`
AppName string `json:"app_name"`
ID string `json:"id"`
State map[string]any `json:"state"`
Events []session.Event `json:"events"`
}
Error handling¶
In case of a failure and error is returned using the non-streaming version of response
Invocation examples¶
curl -v \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://${LOCATION_ID}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION_ID}/reasoningEngines/${RESOURCE_ID}:query -d '{
"class_method": "async_create_session",
"input": {
"user_id": "u_12345",
}
}'