Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Error HttpResponse for each new AI Agent deployed to AI Engine

I have deployed an Agent to Vertex AI following the documentation:

```
# DEPLOYMENT: Deploy the app to Vertex AI
from vertexai import agent_engines
from orchestrator_agent import root_agent

remote_app = agent_engines.create(
agent_engine=root_agent,

requirements=[
"google-cloud-aiplatform[adk,agent_engines]", # pulls Vertex AI + ADK tooling
'google-adk',
"google-genai", # required for Content/Part
"python-dotenv", # for `load_dotenv`
],

# Upload each local folder that contains importable code
extra_packages=[
"./orchestrator_agent",
],
display_name = "Orchestrator Vol 1",
description = "An AI Agent orchestrator",
gcs_dir_name = "orchestrator_vol_1", # carpeta nueva

# Optional – user-level env vars (DO NOT include creds or project/location)
)
```

And it works well, I can create sessions and interact with this deployed agent.

But then uploaded the same agent with small changes in the prompt (i also changed the name of display name and gcd_dir_name, but now i can't even create a new session. I get this error:


```
Traceback (most recent call last):
File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/site-packages/vertexai/preview/reasoning_engines/templates/adk.py", line 826, in _asyncio_thread_main
result = asyncio.run(_invoke_async_create_session())
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/site-packages/vertexai/preview/reasoning_engines/templates/adk.py", line 817, in _invoke_async_create_session
return await self.async_create_session(
File "/usr/local/lib/python3.10/site-packages/vertexai/preview/reasoning_engines/templates/adk.py", line 796, in async_create_session
session = await self._tmpl_attrs.get("session_service").create_session(
File "/usr/local/lib/python3.10/site-packages/google/adk/sessions/vertex_ai_session_service.py", line 92, in create_session
session_id = api_response['name'].split('/')[-3]
TypeError: 'HttpResponse' object is not subscriptable
```


Any idea what could be happening?

1 REPLY 1

Hi Alekzan,

Welcome to the Google Cloud Community!

It seems that the same post was shared on GitHub, and it looks like the problem has already been resolved.

In addition, here are several troubleshooting suggestions for future reference that could help resolve the issue on TypeError: 'HttpResponse' object is not subscriptable:

  • Check the Vertex AI Agent Logs: Access the Vertex AI console, locate your deployed 'Orchestrator Vol 1' agent, and review its logs. Look for any errors or warnings during the agent's startup or when attempting to create a session.
  • Verify Agent Deployment Health: Confirm that the newly deployed agent is in a READY state within the Vertex AI console. An agent that has failed to provision or is unhealthy will not be able to create sessions.   
  • Ensure Package Version Consistency: Verify and maintain consistent versions of essential Python packages across both your local development environment and the remote Vertex AI Agent Engine runtime.
  • Review IAM Permissions: Confirm that the service account used by your Vertex AI Agent Engine deployment has the necessary IAM roles, specifically the Vertex AI User role (roles/aiplatform.user). Insufficient permissions can lead to API failures that may not always present as explicit permission errors.   

You can also refer to the following documentation for guidance on managing and troubleshooting AI Agents:

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.