-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Is your feature request related to a problem? Please describe.
When using types.Part.from_text() to create text-based artifacts (like source code files), the ADK Web UI fails to display them with error "Failed to fetch artifact data".
The backend API returns the data correctly, but the frontend only handles inlineData format, not text format.
Describe the solution you'd like
The Web UI should support previewing text-based artifacts created with Part.from_text(). The frontend renderArtifact function should handle both:
{"inlineData": {"mimeType": "...", "data": "..."}}(current){"text": "..."}(not supported)
For text artifacts, display them as plain text or with syntax highlighting for code files.
Describe alternatives you've considered
- Convert text to base64 and use
Part.from_bytes()withinlineData- but this adds unnecessary complexity for text content - Ignore the UI error and only use API directly - works but poor UX
Additional context
Reproduction steps:
artifact = types.Part.from_text(text="print('hello')")
await tool_context.save_artifact(filename="main.py", artifact=artifact)API response works fine:
curl "http://localhost:8000/.../artifacts/main.py"
# Returns: {"text": "print('hello')"}Environment:
google-adk version: 1.22.1
Python: 3.13
OS: macOS