BerriAI/litellm · error · VertexAgentEngineError
str(await response.aread())
Error message
str(await response.aread())
What it means
Response-body placeholder in the Vertex AI Agent Engine async streaming path: after client.post, a non-success response is converted to an error whose message is the raw body (via str(await response.aread())). Fires when the agent-engine endpoint rejects the streaming request (auth, quota, bad payload).
Solutions
- Inspect the raw async response content for the error detail.
- Verify Agent Engine endpoint configuration and credentials.
Example fix
# print the raw response body from the raised error.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Triggered when the Vertex Agent Engine async response indicates an error; the response body is surfaced.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/65d81e45de6b5c6a.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/vertex_ai/agent_engine/transformation.py:449
from litellm.utils import CustomStreamWrapper
if client is None or not isinstance(client, AsyncHTTPHandler):
client = get_async_httpx_client(llm_provider=cast(Any, "vertex_ai"), params={})
# Avoid logging sensitive api_base directly
verbose_logger.debug("Making async streaming request to Vertex AI endpoint.")
# Make async streaming request
response: Final = await client.post(
api_base,
headers=headers,
data=json.dumps(data),
stream=True,
logging_obj=logging_obj,
)
if response.status_code != 200:
raise VertexAgentEngineError(status_code=response.status_code, message=str(await response.aread()))
# Create iterator for SSE stream (async)
completion_stream: Final = VertexAgentEngineResponseIterator(
streaming_response=response.aiter_lines(),
sync_stream=False,
)
streaming_response: Final = CustomStreamWrapper(
completion_stream=completion_stream,
model=model,
custom_llm_provider=custom_llm_provider,
logging_obj=logging_obj,
)
# LOGGING
logging_obj.post_call(
input=messages,
api_key="",View on GitHub (pinned to 77b7c6c40c)