I’m not able to specify an agent in my REST API call using
i’m making this POST REQUEST
Using this as a body
{
"query": {
"text": "Ciao, come ti chiami?"
},
"agentsSpec": {
"agentSpecs": [
{
"agentId": "3911582693517902693"
}
]
}
}
i’ve also tried the alpha version of the API:
{
"query": {
"text": "Ciao, come ti chiami?"
},
"answerGenerationMode": "AGENT",
"agentsConfig": {
"agent": "projects/myproject/locations/eu/collections/default_collection/engines/myengine/assistants/default_assistant/agents/3911582693517902693"
},
"agentsSpec": {
"agentSpecs": [
{
"agentId": "3911582693517902693"
}
]
}
}
But still the response doesn’t show the usage of the agent, as showed by the structure of the response that is missing the “agent” part, also the instruction given to the agent are completely missed.
The agent is shared, i’m the owner of the project, Discovery Engine Admin, also the creator of the agent. And the agent is working fine if used in the browser app of my gemini enterprise.
Am I missing something ?
EDIT:
Those are the logs got in cloud logging for a prompt to the agent made into the browser app:
{
"insertId": "1izag89dhznl",
"jsonPayload": {
"userIamPrincipal": "*****",
"response": {
"answer": {
"state": "SUCCEEDED",
"name": "projects/*******/locations/eu/collections/default_collection/engines/*****/sessions/*****/assistAnswers/****"
},
"assistToken": "*****"
},
"logMetadata": {
"methodName": "StreamAssist",
"name": "projects/*******/locations/eu/collections/default_collection/engines/*****/assistants/default_assistant",
"timestamp": "2026-03-04T09:41:50.364789641Z",
"serviceLabel": "GEMINI_ENTERPRISE",
"serviceName": "google.cloud.discoveryengine.v1main.AssistantService"
},
"request": {
"query": {
"parts": [
{
"text": "Ciao Come ti chiami, ti scrivo dal browser"
}
]
},
"name": "projects/******/locations/eu/collections/default_collection/engines/*******/assistants/default_assistant",
"agentsSpec": {
"agentSpecs": [
{
"agentId": "3911582693517902693",
"version": "deployed"
}
]
}
}
},
"resource": {
"type": "consumed_api",
"labels": {
"project_id": "******",
"method": "StreamAssist",
"version": "v1",
"credential_id": "",
"service": "google.cloud.discoveryengine.v1main.AssistantService",
"location": "eu"
}
},
"timestamp": "2026-03-04T09:41:50.364789641Z",
"severity": "INFO",
"logName": "projects/******/logs/discoveryengine.googleapis.com%2Fgemini_enterprise_user_activity",
"trace": "dd0728e5f9910238bafaae88fce6a299",
"receiveTimestamp": "2026-03-04T09:41:51.521855105Z",
"spanId": "3c5fcfd4ea7f989e"
}
you can see the Agents Specs is visible in the request body
Those are the logs got in cloud logging for a prompt to the agent made from a REST CALL (as shared before):
{
"insertId": "1ieihh8e2hjex",
"jsonPayload": {
"userIamPrincipal": "*****",
"response": {
"answer": {
"state": "SUCCEEDED",
"name": "projects/*****/locations/eu/collections/default_collection/engines/*****/sessions/1931001648787125613/assistAnswers/8281358568805777708"
},
"assistToken": "********"
},
"logMetadata": {
"methodName": "StreamAssist",
"name": "projects/*****/locations/eu/collections/default_collection/engines/*****/assistants/default_assistant",
"timestamp": "2026-03-04T09:45:43.669097611Z",
"serviceLabel": "GEMINI_ENTERPRISE",
"serviceName": "google.cloud.discoveryengine.v1main.AssistantService"
},
"request": {
"query": {
"text": "Ciao, come ti chiami?"
},
"name": "projects/*****/locations/eu/collections/default_collection/engines/*****/assistants/default_assistant"
}
},
"resource": {
"type": "consumed_api",
"labels": {
"project_id": "*****",
"method": "StreamAssist",
"version": "v1",
"credential_id": "",
"service": "google.cloud.discoveryengine.v1main.AssistantService",
"location": "eu"
}
},
"timestamp": "2026-03-04T09:45:43.669097611Z",
"severity": "INFO",
"logName": "projects/*****/logs/discoveryengine.googleapis.com%2Fgemini_enterprise_user_activity",
"trace": "73ad59d36b5b569fcae7c5fa21f265dc",
"receiveTimestamp": "2026-03-04T09:45:44.456472066Z",
"spanId": "92428422eaff7b2c"
}
You can see the AgentsSpecs part, included in the request body, are now missing from the logs.