-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Describe the Bug:
I am currently having issues with an ADK agent that I am deploying to Vertex AI Agent Engine and exposing to users via Gemini Enterprise.
The agent takes a file (pdf) that the user uploads and has that file translated with Google Cloud’s Translation API into one of the supported languages. It then adds the new translated file as an Artifact in the chat session with the user.
When I test this agent locally with the adk web UI everything works. The agent successfully translates the document, and the Artifact is created and displayed in the UI.
When I deploy this agent to Agent Engine and then make it available via Gemini Enterprise the translated file is not displayed to the user in the chat session at all. The translation seems to still take place but there is no way for the user to access the file it creates.
The agent was created with the Agent Starter Pack.
Steps to Reproduce:
Please provide a numbered list of steps to reproduce the behavior:
- Create an ADK agent that saves an Artifact.
- Run 'adk web'
- Execute the agent and have it create the artifact
- Identify artifact successfully being created in the UI
- Deploy the agent to Agent Engine
- Add agent to Gemini Enterprise
- Execute agent and have it create the artifact
- See the UI not show the artifact that was created
Expected Behavior:
When an artifact is created in a chat session it should be displayed in the Gemini Enterprise UI.
Observed Behavior:
Gemini Enterprise UI does not display artifact created via ADK agent deployed on Agent Engine.
Environment Details:
- ADK Library Version (pip show google-adk): google-adk==1.23.0
- Desktop OS:** Linux
- Python Version (python -V): 3.12.3
Model Information:
- Are you using LiteLLM: No
- Which model is being used: gemini-2.5-pro, gemini-2.5-flash, gemini-3-flash-preview (model does not make a difference)
Regression:
N/A - I have tested this with version 1.16.0 as well as the latest version 1.23.0
Logs:
N/A - No error logs on Agent Engine and Gemini Enterprise. The artifact is successfully created.
Screenshots / Video:
UI in ADK Web:
UI in Gemini Enterprise:
Additional Context:
N/A
Minimal Reproduction Code:
async def _translate_doc(language_code: str, content: bytes, mime_type: str) -> bytes:
"""
Helper function to translate document content using Google Translate API.
Args:
language_code: The target language code to translate the document to.
content: The content of the document to translate.
mime_type: The MIME type of the document to translate.
Returns:
The translated content as bytes.
"""
parent = f"projects/{project_id}/locations/global"
doc_input = translate_v3.DocumentInputConfig(
content=content,
mime_type=mime_type,
)
doc_out = translate_v3.DocumentOutputConfig()
doc_req = translate_v3.TranslateDocumentRequest(
parent=parent,
target_language_code=language_code,
document_input_config=doc_input,
document_output_config=doc_out,
is_translate_native_pdf_only=True,
)
client = translate_v3.TranslationServiceClient()
r = client.translate_document(request=doc_req)
translated_content = b"".join(r.document_translation.byte_stream_outputs)
return translated_content
async def _save_file(
tool_context: ToolContext, file_name: str, content: bytes, mime_type: str
) -> int:
"""
Helper function to save a file as an artifact in the conversation.
"""
doc_artifact = types.Part(
inline_data=types.Blob(
data=content,
mime_type=mime_type,
display_name=file_name,
)
)
version = await tool_context.save_artifact(file_name, doc_artifact)
return version
async def translate_document(
tool_context: ToolContext, file_name: str, target_language_name: str
) -> str:
"""
Tool to translate documents to a target language. The language of the documents are
automatically detected and then translated to the target language.
Translated documents are saved as artifacts back into the conversation.
Args:
file_name: The file name to translate
target_language_name: The target language name to translate the document to
Returns:
A dictionary indicating if the translation was successful or not.
"""
# ... error checking and validation remove to shorten code ...
try:
# ... error checking and validation removed to shorten code...
translated_file_name = f"translated_{target_language_name}_{file_name}"
translated_content = await _translate_doc(
target_lang_code, doc_data, doc_mime_type
)
version = await _save_file(
tool_context,
translated_file_name,
translated_content,
doc_mime_type,
)
return f"File '{file_name}' translated to '{translated_file_name}' (Artifact Version {version})."
except Exception as e:
return f"Error translating file '{file_name}': {str(e)}"
root_agent = Agent(
name="translation_agent",
model=Gemini(
model="gemini-3-flash-preview",
retry_options=types.HttpRetryOptions(attempts=3),
),
description=("Agent that translates documents between different languages."),
instruction=AGENT_INSTRUCTION,
tools=[
list_files,
load_artifacts_tool,
get_supported_languages,
translate_document,
],
)
app = App(root_agent=root_agent, name="app", plugins=[SaveFilesAsArtifactsPlugin()])How often has this issue occurred?:
- Always (100%)