Issue: Inline data (base64) being stored in database and logged, causing performance and security issues.
Describe the bug
Whenever files/attachments are added in the prompt and sent in the LLM request. This is usually done in two ways, inline_data / file_data . In google_llm.py, inline_data is excluded from logging.
But it is not excluded when using a database session service. Which leads to the following problems.
- Database Performance & Storage Issues
Database bloat: Base64 encoding increases file size by ~33%, causing unnecessary database growth Query performance: Large blob data slows down database operations, queries, and backups Memory consumption: Loading sessions with large inline_data consumes excessive memory Storage costs: Database storage is significantly more expensive than object storage
- Security & Privacy Concerns
Sensitive data exposure: File contents (PDFs, documents, images) are stored as plain text in database Log pollution: The current logging logger.info(In Database Session Service) dumps base64 data into logs. Compliance risks: May violate data retention/privacy regulations (GDPR, HIPAA, etc.), as file storage has different rules compared to text logs. Log security: Logs are typically less secure than dedicated file storage systems
- Operational Issues
Unreadable logs: Base64 data makes logs impossible to read and debug Log storage costs: Logs become unnecessarily large Backup complexity: Database backups become massive due to embedded files
To Reproduce Steps to reproduce the behavior:
- Add a pdf/image through inline_data in the message parts.
- Use a database_session_service (can start with a simple sqllite db)
- run it as a fast api server
- See the log pollution
Expected behavior There is support for file_data in parts which we have to manage the files additionaly.
The inline_data should be excluded from logging anyway , similar to existing code in google_llm.py
Desktop (please complete the following information):
- OS: Linux
- Python version(python -V): 3.13.2
- ADK version(pip show google-adk): 1.7.0
Model Information: Gemini 2.5 pro
Additional context
Followed the way how adk web supports the attachments, maybe it's fine for local development, but in production, usually to support this with a persistent db storage, inline_data should not be logged in the database, so supporting attachments through file_data seems the way to go forward.
But it should also not pollute the logs.
Hi @me-her , is the main ask to remove logging statement that contains inline data from DatabaseSessionService? We could remove it entirely, it was added for debugging purpose.