Files
hunfabric/tests/modules/agent_engine/assets/src/agent.py
Luca Prete d0d7c64670 Refactor Agent Engine module to support new source based deployments (#3609)
* Refactor Agent Engine module to support new source based deployments

* Fix linting

* Fix tests

* Fix tests

* Remove generated_pickle line from examples

* Fix indentation

* Delete modules/agent-engine/terraform.atfvars

---------

Co-authored-by: Ludovico Magnocavallo <ludomagno@google.com>
2026-01-04 08:11:46 +00:00

46 lines
1.2 KiB
Python

#!/usr/bin/env python3
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from google.adk.agents import LlmAgent
from vertexai.agent_engines import AdkApp
def get_exchange_rate(
currency_from: str = "USD",
currency_to: str = "EUR",
currency_date: str = "latest",
):
import requests
response = requests.get(
f"https://api.frankfurter.app/{currency_date}",
params={
"from": currency_from,
"to": currency_to
},
)
return response.json()
# Create ADK agent with tools
root_agent = LlmAgent(
model="gemini-2.5-flash",
instruction="You are a helpful assistant",
name='currency_exchange_agent',
tools=[get_exchange_rate],
)
agent = AdkApp(agent=root_agent)