Skip to content

Extract LLMExecutionAgent from DocsSummarizer#2872

Open
blublinsky wants to merge 1 commit intoopenshift:mainfrom
blublinsky:doc-summarizer-split
Open

Extract LLMExecutionAgent from DocsSummarizer#2872
blublinsky wants to merge 1 commit intoopenshift:mainfrom
blublinsky:doc-summarizer-split

Conversation

@blublinsky
Copy link
Copy Markdown
Contributor

Description

Motivation

DocsSummarizer had grown to 1115 lines, mixing prompt preparation/skill resolution/history handling with the low-level LLM streaming and tool execution loop. Splitting these concerns:

  • Makes each class independently testable
  • Keeps DocsSummarizer focused on orchestration (prompt, context, skills)
  • Isolates the tool-calling loop for reuse by other consumers (e.g., A2A server)
  • Reduces per-file complexity — DocsSummarizer drops from 1115 to ~440 lines
  • Improves readability and maintainability by giving each concern a clear home

Summary

Extract the iterative LLM + tool-calling loop from DocsSummarizer into a standalone LLMExecutionAgent class using composition. Beyond the extraction, several methods were refactored to reduce complexity and improve readability — _process_tool_calls_for_round was split by extracting _execute_or_skip_tools, skill resolution logic was pulled into _resolve_skill, and the GeneratorExit traceback from LangChain's astream was eliminated by draining the generator instead of returning early. DocsSummarizer now focuses on orchestration (prompt, context, skills) and delegates the entire LLM execution loop to LLMExecutionAgent. Unit and integration tests were migrated to target LLMExecutionAgent directly, making them more focused and precise at the new class boundary.

Type of change

  • [ x] Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

@openshift-ci openshift-ci bot requested a review from onmete April 1, 2026 12:30
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 1, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign xrajesh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot requested a review from raptorsun April 1, 2026 12:30
@blublinsky blublinsky force-pushed the doc-summarizer-split branch from 3b223e0 to 554e498 Compare April 2, 2026 08:33
@blublinsky
Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@blublinsky
Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 7, 2026

@blublinsky: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@blublinsky
Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 9, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 9, 2026

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant