Skip to content

Refactor Architecture to Split Agent, LLM, and UI Layers#10

Open
JackLeeHal wants to merge 1 commit into
mainfrom
refactor-architecture-three-layers-3849718813426237228
Open

Refactor Architecture to Split Agent, LLM, and UI Layers#10
JackLeeHal wants to merge 1 commit into
mainfrom
refactor-architecture-three-layers-3849718813426237228

Conversation

@JackLeeHal

Copy link
Copy Markdown
Owner

The user asked to refactor the application into three layers: Agent, LLM Provider (Backend), and UI. The Agent layer was modified to mirror the learn-claude-code core loop logic. The Backend was refactored to support multiple LLM providers (currently OpenAI with placeholder for Anthropic), configured via the settings UI.
The implementation successfully abstracts the LLM out of the agent loop, standardizes the response with OpenAILikeResponse, and provides a seamless UI dropdown to switch providers without altering the agent's core tool-use logic.


PR created automatically by Jules for task 3849718813426237228 started by @JackLeeHal

- Created `src/llm/` directory with `LLMProvider` abstract base class.
- Implemented `OpenAIProvider` to wrap OpenAI functionality and provide a standardized `OpenAILikeResponse` that supports streaming and tool calls.
- Created `factory.py` to instantiate the appropriate provider based on config.
- Refactored `src/agent/brain.py` to use the new LLM factory instead of tightly coupling to OpenAI.
- Implemented the tool-use ReAct loop (`while stop_reason == 'tool_use'`) based on the `learn-claude-code` tutorial for the core agent loop.
- Updated `SettingsDialog` in `src/main_window.py` to allow selecting the LLM Provider Type (`api_type` dropdown).
- Updated DB interactions inside `src/memory_service.py` to cleanly use the LLM layer for summaries.
- Fixed and updated unit tests (`test_agent.py`) to mock the new provider factory.

Co-authored-by: JackLeeHal <15664755+JackLeeHal@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant