Skip to content

Conversation

@aleskalfas
Copy link
Contributor

Summary

Linked Issues

Documentation

  • No Docs Needed:

If this PR adds new feature or changes existing. Make sure documentation is adjusted accordingly. If the docs is not needed, please explain why.

Signed-off-by: Aleš Kalfas <kalfas.ales@gmail.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aleskalfas, 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 initializes an examples directory, introducing two new Python-based conversational agents that showcase basic and advanced conversation history management. It also sets up the necessary infrastructure for these examples, including Docker build configurations and a dynamic entrypoint script, while updating core project dependencies to support the new functionalities.

Highlights

  • New Examples Directory: Introduction of a dedicated examples directory to house various agent implementations.
  • History Management Agents: Addition of two new Python agents, basic-history and advanced-history, demonstrating different approaches to conversation history management.
  • Docker Integration for Examples: A new Dockerfile and entrypoint.sh script are added to facilitate building and running these examples within a Docker container.
  • Dependency Updates: The cachetools library has been added as a new dependency across several uv.lock and pyproject.toml files within the apps directory.
  • Workspace Configuration Update: The agentstack.code-workspace file has been modified to include the new example projects, improving developer experience in VS Code.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 new examples for the agent stack, including a Docker setup to run them. The changes are a good starting point. My review includes suggestions to improve the robustness of shell scripts in the Dockerfile and entrypoint, align dependency versions and tool configurations in the pyproject.toml files, and simplify some of the agent implementation code for better maintainability.

Comment on lines +13 to +19
"agentstack-sdk==0.4.1",
"pyyaml>=6.0.2",
]

[tool.ruff]
line-length = 120
target-version = "py311"
Copy link
Contributor

Choose a reason for hiding this comment

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

high

There are a couple of inconsistencies in this configuration file:

  1. Outdated SDK version: The agentstack-sdk dependency is pinned to 0.4.1, but the version in this repository is 0.5.3. This should be updated to ensure compatibility and use the latest features, especially if this example is used outside of the monorepo.
  2. Ruff target version: The target-version for ruff is py311, while the project requires Python >=3.13. This should be aligned to py313 to ensure ruff applies the correct linting rules for the target Python version.
Suggested change
"agentstack-sdk==0.4.1",
"pyyaml>=6.0.2",
]
[tool.ruff]
line-length = 120
target-version = "py311"
"agentstack-sdk==0.5.3",
"pyyaml>=6.0.2",
]
[tool.ruff]
line-length = 120
target-version = "py313"

Comment on lines +10 to +16
"agentstack-sdk==0.4.1",
"pyyaml>=6.0.2",
]

[tool.ruff]
line-length = 120
target-version = "py311"
Copy link
Contributor

Choose a reason for hiding this comment

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

high

There are a couple of inconsistencies in this configuration file:

  1. Outdated SDK version: The agentstack-sdk dependency is pinned to 0.4.1, but the version in this repository is 0.5.3. This should be updated to ensure compatibility and use the latest features, especially if this example is used outside of the monorepo.
  2. Ruff target version: The target-version for ruff is py311, while the project requires Python >=3.13. This should be aligned to py313 to ensure ruff applies the correct linting rules for the target Python version.
Suggested change
"agentstack-sdk==0.4.1",
"pyyaml>=6.0.2",
]
[tool.ruff]
line-length = 120
target-version = "py311"
"agentstack-sdk==0.5.3",
"pyyaml>=6.0.2",
]
[tool.ruff]
line-length = 120
target-version = "py313"

Comment on lines +14 to +18
for example_dir in /app/examples/*/; do \
if [ -f "${example_dir}pyproject.toml" ]; then \
cd "$example_dir" && uv sync; \
fi; \
done
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The for loop over */ can be brittle if no directories match. A more robust approach is to iterate over * and check if each item is a directory. Also, running cd in a subshell () is safer as it won't affect the working directory of the main script.

    for example_dir in /app/examples/*; do \
        if [ -d "${example_dir}" ] && [ -f "${example_dir}pyproject.toml" ]; then \
            (cd "$example_dir" && uv sync); \
        fi; \
    done

Comment on lines +28 to +37
def to_framework_message(message: Message) -> FrameworkMessage:
"""Convert A2A Message to BeeAI Framework Message format"""
message_text = "".join(part.root.text for part in message.parts if part.root.kind == "text")

if message.role == Role.agent:
return AssistantMessage(message_text)
elif message.role == Role.user:
return UserMessage(message_text)
else:
raise ValueError(f"Invalid message role: {message.role}")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The to_framework_message function can be simplified. The get_message_text utility function is already imported and can be used to extract the text content from a message, which makes the manual iteration and join unnecessary. This improves readability and reduces code duplication.

Suggested change
def to_framework_message(message: Message) -> FrameworkMessage:
"""Convert A2A Message to BeeAI Framework Message format"""
message_text = "".join(part.root.text for part in message.parts if part.root.kind == "text")
if message.role == Role.agent:
return AssistantMessage(message_text)
elif message.role == Role.user:
return UserMessage(message_text)
else:
raise ValueError(f"Invalid message role: {message.role}")
def to_framework_message(message: Message) -> FrameworkMessage:
"""Convert A2A Message to BeeAI Framework Message format"""
message_text = get_message_text(message)
if message.role == Role.agent:
return AssistantMessage(message_text)
elif message.role == Role.user:
return UserMessage(message_text)
else:
raise ValueError(f"Invalid message role: {message.role}")

Comment on lines +9 to +14
for dir in /app/examples/*/; do
if [ -f "${dir}pyproject.toml" ]; then
example_name=$(basename "$dir")
AVAILABLE_EXAMPLES+=("$example_name")
fi
done
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current globbing pattern */ can lead to errors if no matching directories exist. Using find is a more robust way to iterate over directories and will prevent the script from failing in such edge cases.

Suggested change
for dir in /app/examples/*/; do
if [ -f "${dir}pyproject.toml" ]; then
example_name=$(basename "$dir")
AVAILABLE_EXAMPLES+=("$example_name")
fi
done
find /app/examples -mindepth 1 -maxdepth 1 -type d -print0 | while IFS= read -r -d '' dir; do
if [ -f "$dir/pyproject.toml" ]; then
example_name=$(basename "$dir")
AVAILABLE_EXAMPLES+=("$example_name")
fi
done

Signed-off-by: Aleš Kalfas <kalfas.ales@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants