refactor: Unify and modernize agent logging system#30
Merged
Conversation
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Contributor
|
✅ DCO Check Passed Thanks @ceberam, all your commits are properly signed off. 🎉 |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR completely refactors the logging system across all agents and backends to provide unified, clear, and modern agentic logging output. The previous logging was inconsistent, verbose, and made it difficult to understand LLM interactions and multi-turn conversations.
Problem Statement
The original logging had several issues:
Solution
1. Enhanced Logging Module (
docling_agent/logging.py)Created a comprehensive logging API with:
[YYYY-MM-DD HH:MM:SS.mmm]agent_context(),operation_context(),timed_operation()log_agent_start()/log_agent_end()- Agent lifecyclelog_stage_start()/log_stage_end()- Processing stageslog_llm_request()/log_llm_response()- LLM interactionslog_info(),log_warning(),log_error(),log_success(),log_debug()2. Updated All Backends
3. Updated All Agents
Before & After Examples
Before (Old Logging)
After (New Logging)
Key Improvements in Output
Benefits
Testing
Tested with multiple examples:
example_01_write_report.py- Writer agentexample_02_edit_report.py- Editor agentexample_04_enrich_document.py- Enricher agent