Skip to content

Conversation

@elCaptnCode
Copy link

What: Clean PR with only the AG2 sample folder (samples/python/agents/ag2) and separated demo UI

Details:

  • Adds samples/python/agents/ag2/demo/ containing ui.html, assets/, and demo/websocket.py (presentation UI only)
  • Keeps AG2 core logic (ReviewerAgent, clients) in samples/python/agents/ag2/
  • Windows-compatible mypy tool handling in a2a_python_reviewer.py (tempfile delete=False + manual cleanup)

How to test:

  1. Run reviewer: python samples/python/agents/ag2/a2a_python_reviewer.py
  2. Run demo UI: cd samples/python/agents/ag2 && ..venv\Scripts\python.exe demo\websocket.py
  3. Open http://127.0.0.1:9000 in a browser and run the sample prompt.

Notes: This PR contains only the AG2 sample folder; unrelated dotnet build artifacts and other sample changes were excluded.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @elCaptnCode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the AG2 agent sample by introducing a clean, modular structure and an interactive, browser-based demo UI. It separates the core agent logic from the presentation layer, making the sample easier to understand and extend. Additionally, it improves the robustness of the 'mypy' code review tool integration by addressing Windows-specific file handling, ensuring a smoother developer experience across different operating systems. The updated documentation guides users through the new server-client architecture and the visual demonstration capabilities.

Highlights

  • New AG2 Sample Structure: Introduced a dedicated 'ag2' sample folder with a clear separation of core logic and a new 'demo' subfolder for the UI, enhancing modularity and clarity.
  • Interactive Demo UI: Added a browser-based WebSocket demo UI ('ui.html', 'websocket.py') for visual demonstrations of the AG2 agent interaction, providing a more engaging user experience.
  • Windows Compatibility Fix: Implemented a fix in 'a2a_python_reviewer.py' for 'mypy' tool handling on Windows, ensuring temporary files are properly managed and improving cross-platform robustness.
  • Updated Documentation: The 'README.md' for the AG2 sample has been significantly updated to detail the new server-client architecture and guide users through running the new demo UI.
  • Dependency Updates: 'pyproject.toml' now includes 'fastapi', 'uvicorn', and 'websockets' to support the new demo UI components.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new AG2 reviewer sample with a demo UI. The changes are well-structured, separating the core agent logic from the new demo UI. The Windows compatibility fix for mypy is a good improvement. However, the pull request cannot be merged in its current state due to several unresolved merge conflicts in README.md, a2a_python_reviewer.py, and pyproject.toml. These must be resolved first. Additionally, I've provided some suggestions to improve the new demo UI's JavaScript for better performance and security, and pointed out some dead code in the WebSocket server.

@elCaptnCode
Copy link
Author

PR #422 — Smoke test and fixes applied

Smoke test (local, Windows venv):

  • Reviewer server: cd samples/python/agents/ag2; .\.venv\Scripts\python.exe a2a_python_reviewer.py — started on :8000 successfully.
  • Demo UI: cd samples/python/agents/ag2; .\.venv\Scripts\python.exe demo\websocket.py — started on :9000, served / and assets (HTTP 200), accepted WebSocket connections and ran the demo auto-reply loop.
  • Observed behavior: demo served the page and assets and completed a short auto-run (WebSocket connection accepted and closed). Everything required for the demo to run locally was exercised.

Fixes included in this branch:

  • Narrowed exception handling and removed leftover merge markers from a2a_python_reviewer.py.
  • Windows-safe mypy temp-file handling; review_code_with_mypy() returns the exact token: No issues found. on success.
  • Demo websocket.py now injects window.__REVIEWER_URL__ into the served HTML so the UI reliably discovers the Reviewer URL.

Reproduction steps (local):

  1. Create and activate the venv, install deps (see samples/python/agents/ag2/pyproject.toml).
  2. In Terminal A: cd samples/python/agents/ag2; .\.venv\Scripts\python.exe a2a_python_reviewer.py
  3. In Terminal B: cd samples/python/agents/ag2; .\.venv\Scripts\python.exe demo\websocket.py
  4. Open http://127.0.0.1:9000 and try a prompt.

If you want, I can (A) attach logs to the PR, (B) push a tiny README in samples/python/agents/ag2/demo with these steps, or (C) try posting this comment to the PR via gh from here.

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