Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 292 additions & 0 deletions pr351.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
diff --git a/python/agents/financial-advisor/README.md b/python/agents/financial-advisor/README.md
index 9a7b949ae..84f39a10b 100644
--- a/python/agents/financial-advisor/README.md
+++ b/python/agents/financial-advisor/README.md
@@ -48,14 +48,14 @@ to implement this workflow.

1. **Prerequisites**

- * Python 3.11+
- * Poetry
+ * Python 3.10+
+ * uv
* For dependency management and packaging. Please follow the
instructions on the official
- [Poetry website](https://python-poetry.org/docs/) for installation.
+ [uv website](https://docs.astral.sh/uv/) for installation.

```bash
- pip install poetry
+ curl -LsSf https://astral.sh/uv/install.sh | sh
```

* A project on Google Cloud Platform
@@ -70,10 +70,7 @@ to implement this workflow.
git clone https://github.com/google/adk-samples.git
cd adk-samples/python/agents/financial_advisor
# Install the package and dependencies.
- # Note for Linux users: If you get an error related to `keyring` during the installation, you can disable it by running the following command:
- # poetry config keyring.enabled false
- # This is a one-time setup.
- poetry install
+ uv sync
```

3. **Configuration**
@@ -703,15 +700,15 @@ Thank you!
For running tests and evaluation, install the extra dependencies:

```bash
-poetry install --with dev
+uv sync --dev
```

Then the tests and evaluation can be run from the `financial-advisor` directory using
the `pytest` module:

```bash
-python3 -m pytest tests
-python3 -m pytest eval
+uv run pytest tests
+uv run pytest eval
```

`tests` runs the agent on a sample request, and makes sure that every component
@@ -726,8 +723,8 @@ The Financial Advisor can be deployed to Vertex AI Agent Engine using the follow
commands:

```bash
-poetry install --with deployment
-python3 deployment/deploy.py --create
+uv sync --group deployment
+uv run deployment/deploy.py --create
```

When the deployment finishes, it will print a line like this:
@@ -739,7 +736,7 @@ Created remote agent: projects/<PROJECT_NUMBER>/locations/<PROJECT_LOCATION>/rea
If you forgot the AGENT_ENGINE_ID, you can list existing agents using:

```bash
-python3 deployment/deploy.py --list
+uv run deployment/deploy.py --list
```

The output will be like:
@@ -755,7 +752,7 @@ All remote agents:
You may interact with the deployed agent using the `test_deployment.py` script
```bash
$ export USER_ID=<any string>
-$ python3 deployment/test_deployment.py --resource_id=${AGENT_ENGINE_ID} --user_id=${USER_ID}
+$ uv run deployment/test_deployment.py --resource_id=${AGENT_ENGINE_ID} --user_id=${USER_ID}
Found agent with resource ID: ...
Created session for user ID: ...
Type 'quit' to exit.
@@ -773,9 +770,35 @@ Would you like to begin by providing a market ticker symbol for analysis?
To delete the deployed agent, you may run the following command:

```bash
-python3 deployment/deploy.py --delete --resource_id=${AGENT_ENGINE_ID}
+uv run deployment/deploy.py --delete --resource_id=${AGENT_ENGINE_ID}
```

+### Alternative: Using Agent Starter Pack
+
+You can also use the [Agent Starter Pack](https://goo.gle/agent-starter-pack) to create a production-ready version of this agent with additional deployment options:
+
+```bash
+# Create and activate a virtual environment
+python -m venv .venv && source .venv/bin/activate # On Windows: .venv\Scripts\activate
+
+# Install the starter pack and create your project
+pip install --upgrade agent-starter-pack
+agent-starter-pack create my-financial-advisor -a adk@financial-advisor
+```
+
+<details>
+<summary>⚡️ Alternative: Using uv</summary>
+
+If you have [`uv`](https://github.com/astral-sh/uv) installed, you can create and set up your project with a single command:
+```bash
+uvx agent-starter-pack create my-financial-advisor -a adk@financial-advisor
+```
+This command handles creating the project without needing to pre-install the package into a virtual environment.
+
+</details>
+
+The starter pack will prompt you to select deployment options and provides additional production-ready features including automated CI/CD deployment scripts.
+
## Customization

1. Enhance Data_Analyst Module Search Capabilities with Specialized Stock Repositories:
diff --git a/python/agents/financial-advisor/financial_advisor/__init__.py b/python/agents/financial-advisor/financial_advisor/__init__.py
index fbb2f3108..c20ba73eb 100644
--- a/python/agents/financial-advisor/financial_advisor/__init__.py
+++ b/python/agents/financial-advisor/financial_advisor/__init__.py
@@ -14,4 +14,13 @@

"""Financial coordinator: provide reasonable investment strategies"""

+import os
+
+import google.auth
+
+_, project_id = google.auth.default()
+os.environ.setdefault("GOOGLE_CLOUD_PROJECT", project_id)
+os.environ.setdefault("GOOGLE_CLOUD_LOCATION", "global")
+os.environ.setdefault("GOOGLE_GENAI_USE_VERTEXAI", "True")
+
from . import agent
diff --git a/python/agents/financial-advisor/financial_advisor/agent.py b/python/agents/financial-advisor/financial_advisor/agent.py
index 8580f4c62..781adf3cf 100644
--- a/python/agents/financial-advisor/financial_advisor/agent.py
+++ b/python/agents/financial-advisor/financial_advisor/agent.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

-"""Financial coordinator: provide reasonable investment strategies"""
+"""Financial coordinator: provide reasonable investment strategies."""

from google.adk.agents import LlmAgent
from google.adk.tools.agent_tool import AgentTool
@@ -23,6 +23,7 @@
from .sub_agents.risk_analyst import risk_analyst_agent
from .sub_agents.trading_analyst import trading_analyst_agent

+
MODEL = "gemini-2.5-pro"


diff --git a/python/agents/financial-advisor/pyproject.toml b/python/agents/financial-advisor/pyproject.toml
index b76be4a9d..387163938 100644
--- a/python/agents/financial-advisor/pyproject.toml
+++ b/python/agents/financial-advisor/pyproject.toml
@@ -1,36 +1,100 @@
[project]
name = "financial-advisor"
-version = "0.1"
+version = "0.1.0"
description = "AI-driven agent designed to facilitate the exploration of the financial advisor landscape"
authors = [{ name = "Antonio Gulli", email = "gulli@google.com" }]
-license = "Apache License 2.0"
+license = "Apache-2.0"
readme = "README.md"
+dependencies = [
+ "google-cloud-aiplatform[adk,agent-engines]>=1.93.0",
+ "google-genai>=1.9.0",
+ "pydantic>=2.10.6",
+ "python-dotenv>=1.0.1",
+ "google-adk>=1.0.0",
+]

-[tool.poetry.dependencies]
-google-cloud-aiplatform = { version = "^1.93.0", extras = [
- "adk",
- "agent-engines",
-] }
-python = "^3.9"
-google-genai = "^1.9.0"
-pydantic = "^2.10.6"
-python-dotenv = "^1.0.1"
-google-adk = "^1.0.0"
-[tool.poetry.group.dev]
-optional = true
-
-[tool.poetry.group.dev.dependencies]
-pytest = "^8.3.5"
-black = "^25.1.0"
-google-adk = { version = "^1.0.0", extras = ["eval"] }
-pytest-asyncio = "^0.26.0"
-
-[tool.poetry.group.deployment]
-optional = true
-
-[tool.poetry.group.deployment.dependencies]
-absl-py = "^2.2.1"
+requires-python = ">=3.10,<3.13"
+
+[dependency-groups]
+dev = [
+ "pytest>=8.3.2",
+ "pytest-asyncio>=0.23.7",
+ "google-adk[eval]>=1.0.0",
+ "nest-asyncio>=1.6.0",
+ "agent-starter-pack>=0.14.1",
+]
+
+deployment = [
+ "absl-py>=2.2.1",
+]
+
+[project.optional-dependencies]
+
+lint = [
+ "ruff>=0.4.6",
+ "mypy>=1.15.0",
+ "codespell>=2.2.0",
+ "types-pyyaml>=6.0.12.20240917",
+ "types-requests>=2.32.0.20240914",
+]
+
+[tool.ruff]
+line-length = 88
+target-version = "py310"
+
+[tool.ruff.lint]
+select = [
+ "E", # pycodestyle
+ "F", # pyflakes
+ "W", # pycodestyle warnings
+ "I", # isort
+ "C", # flake8-comprehensions
+ "B", # flake8-bugbear
+ "UP", # pyupgrade
+ "RUF", # ruff specific rules
+]
+ignore = ["E501", "C901"] # ignore line too long, too complex
+
+[tool.ruff.lint.isort]
+known-first-party = ["financial_advisor"]
+
+[tool.mypy]
+disallow_untyped_calls = true
+disallow_untyped_defs = true
+disallow_incomplete_defs = true
+no_implicit_optional = true
+check_untyped_defs = true
+disallow_subclassing_any = true
+warn_incomplete_stub = true
+warn_redundant_casts = true
+warn_unused_ignores = true
+warn_unreachable = true
+follow_imports = "silent"
+ignore_missing_imports = true
+explicit_package_bases = true
+disable_error_code = ["misc", "no-untyped-call", "no-any-return"]
+
+exclude = [".venv"]
+
+[tool.codespell]
+ignore-words-list = "rouge"
+skip = "./locust_env/*,uv.lock,.venv,./frontend,**/*.ipynb"
+
+[tool.pytest.ini_options]
+pythonpath = "."
+asyncio_default_fixture_loop_scope = "function"

[build-system]
-requires = ["poetry-core>=2.0.0,<3.0.0"]
-build-backend = "poetry.core.masonry.api"
+requires = ["uv_build>=0.8.14,<0.9.0"]
+build-backend = "uv_build"
+
+[tool.uv.build-backend]
+module-root = ""
+
+# This configuration file is used by goo.gle/agent-starter-pack to power remote templating.
+# It defines the template's properties and settings.
+[tool.agent-starter-pack]
+example_question = "Analyze AAPL"
+
+[tool.agent-starter-pack.settings]
+agent_directory = "financial_advisor"
Loading
Loading