Skip to content

feat: add new backends to agent#27

Merged
PeterStaar-IBM merged 15 commits into
mainfrom
dev/add-new-backends-to-agent
May 20, 2026
Merged

feat: add new backends to agent#27
PeterStaar-IBM merged 15 commits into
mainfrom
dev/add-new-backends-to-agent

Conversation

@PeterStaar-IBM
Copy link
Copy Markdown
Member

@PeterStaar-IBM PeterStaar-IBM commented May 13, 2026

Overview

This PR introduces a flexible backend abstraction layer and significantly enhances the enricher agent capabilities, making the docling-agent more extensible and powerful.

Major Changes

🔧 Backend Abstraction Layer

  • New Backend System: Introduced a pluggable backend architecture supporting multiple LLM providers:
    • Ollama
    • LM Studio
    • LiteLLM
    • Mellea (default)
    • OpenAI-compatible endpoints
  • Backend Factory: Added factory pattern for backend instantiation with registry system
  • Configuration: Enhanced BackendConfig with support for base URLs, timeouts, API keys, and provider-specific options
  • Updated Examples: Refactored all example scripts to use the new backend configuration system

🤖 Enricher Agent Improvements

  • Flexible Entity Detection: Redesigned enricher to support more flexible entity finding and extraction
  • Metadata Propagation: Enhanced writer agent to propagate summaries and metadata into generated documents
  • Improved Orchestration: Better coordination between enricher and other agents

📝 Editor Agent Enhancements

  • Configuration Support: Added YAML-based task configurations for editor, enricher, and writer agents
  • Validation: Improved editor validation with comprehensive test coverage
  • Prompts: Enhanced prompt templates for better agent behavior

🧹 Code Quality & Maintenance

  • Type Hints: Added Self return type hints for better type safety
  • Refactoring: Cleaned up base functions and removed redundant code
  • Dependencies: Upgraded docling-core and other dependencies
  • Documentation: Updated README with backend usage examples

✅ Testing

  • Added comprehensive tests for:
    • Backend factory and instantiation
    • Direct backend usage
    • Task model backend configuration
    • Editor validation
    • Agent instantiation with new backend system

Breaking Changes

  • Agent initialization now requires backend configuration instead of direct model parameters
  • Examples updated to reflect new initialization pattern

Migration Guide

Old:

from docling_agent import WriterAgent
agent = WriterAgent(model="gpt-4")

New:

from docling_agent import WriterAgent, BackendConfig
config = BackendConfig(type="mellea")
agent = WriterAgent(backend_config=config)

@PeterStaar-IBM PeterStaar-IBM requested a review from ceberam May 13, 2026 08:43
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

DCO Check Passed

Thanks @PeterStaar-IBM, all your commits are properly signed off. 🎉

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 13, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

🟢 Require two reviewer for test updates

Wonderful, this rule succeeded.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 1

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

@PeterStaar-IBM PeterStaar-IBM changed the title Dev/add new backends to agent feat: add new backends to agent May 13, 2026
Copy link
Copy Markdown
Member

@ceberam ceberam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great refactoring to make it backend agnostic!
I just found very small details. In addition:

  • I would only merge once docling-core is released to avoid local copies of docling-core
  • I would remove docs/plans and docs/specs since the implementation plans and steps of this PR will become irrelevant in the long term. But we could put the summary in the PR description for our records.

Comment thread docling_agent/backends/base.py Outdated
Comment thread docling_agent/backends/litellm_backend.py Outdated
Comment thread docling_agent/task_model.py Outdated
Comment thread docling_agent/backends/factory.py Outdated
Comment thread docling_agent/task_model.py Outdated
Comment thread pyproject.toml Outdated
Comment thread docling_agent/task_model.py Outdated
PeterStaar-IBM and others added 14 commits May 19, 2026 15:55
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
…a descriptions into the written document

Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
@ceberam ceberam force-pushed the dev/add-new-backends-to-agent branch from 13a9d09 to 8cb99aa Compare May 19, 2026 14:36
Signed-off-by: Cesar Berrospi Ramis <ceb@zurich.ibm.com>
Copy link
Copy Markdown
Member

@ceberam ceberam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@PeterStaar-IBM PeterStaar-IBM merged commit 3ef9f7f into main May 20, 2026
11 checks passed
@PeterStaar-IBM PeterStaar-IBM deleted the dev/add-new-backends-to-agent branch May 20, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants