-
Notifications
You must be signed in to change notification settings - Fork 139
feat(examples): init #1865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(examples): init #1865
Conversation
Signed-off-by: Aleš Kalfas <kalfas.ales@gmail.com>
Summary of ChangesHello @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 Highlights
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this 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.
| "agentstack-sdk==0.4.1", | ||
| "pyyaml>=6.0.2", | ||
| ] | ||
|
|
||
| [tool.ruff] | ||
| line-length = 120 | ||
| target-version = "py311" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of inconsistencies in this configuration file:
- Outdated SDK version: The
agentstack-sdkdependency is pinned to0.4.1, but the version in this repository is0.5.3. This should be updated to ensure compatibility and use the latest features, especially if this example is used outside of the monorepo. - Ruff target version: The
target-versionfor ruff ispy311, while the project requires Python>=3.13. This should be aligned topy313to ensure ruff applies the correct linting rules for the target Python version.
| "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" |
| "agentstack-sdk==0.4.1", | ||
| "pyyaml>=6.0.2", | ||
| ] | ||
|
|
||
| [tool.ruff] | ||
| line-length = 120 | ||
| target-version = "py311" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of inconsistencies in this configuration file:
- Outdated SDK version: The
agentstack-sdkdependency is pinned to0.4.1, but the version in this repository is0.5.3. This should be updated to ensure compatibility and use the latest features, especially if this example is used outside of the monorepo. - Ruff target version: The
target-versionfor ruff ispy311, while the project requires Python>=3.13. This should be aligned topy313to ensure ruff applies the correct linting rules for the target Python version.
| "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" |
| for example_dir in /app/examples/*/; do \ | ||
| if [ -f "${example_dir}pyproject.toml" ]; then \ | ||
| cd "$example_dir" && uv sync; \ | ||
| fi; \ | ||
| done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| 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}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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}") |
| for dir in /app/examples/*/; do | ||
| if [ -f "${dir}pyproject.toml" ]; then | ||
| example_name=$(basename "$dir") | ||
| AVAILABLE_EXAMPLES+=("$example_name") | ||
| fi | ||
| done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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>
Summary
Linked Issues
Documentation
If this PR adds new feature or changes existing. Make sure documentation is adjusted accordingly. If the docs is not needed, please explain why.