Skip to content

Commit a329a37

Browse files
Merge pull request #475 from DefangLabs/jordan/google-adk
google adk sample
2 parents d63f738 + a02f870 commit a329a37

File tree

26 files changed

+6031
-10
lines changed

26 files changed

+6031
-10
lines changed

samples/agentic-strands/app/Dockerfile

Lines changed: 0 additions & 9 deletions
This file was deleted.
File renamed without changes.

samples/agentic-strands/compose.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ services:
44
# domainname: example.com
55
build:
66
context: ./app
7-
dockerfile: Dockerfile
87
ports:
98
- target: 5001
109
published: 5001

samples/google-adk/.dockerignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Default .dockerignore file for Defang
2+
**/__pycache__
3+
**/.direnv
4+
**/.DS_Store
5+
**/.envrc
6+
**/.git
7+
**/.github
8+
**/.idea
9+
**/.next
10+
**/.vscode
11+
**/compose.*.yaml
12+
**/compose.*.yml
13+
**/compose.yaml
14+
**/compose.yml
15+
**/docker-compose.*.yaml
16+
**/docker-compose.*.yml
17+
**/docker-compose.yaml
18+
**/docker-compose.yml
19+
**/node_modules
20+
**/Thumbs.db
21+
Dockerfile
22+
*.Dockerfile
23+
# Ignore our own binary, but only in the root to avoid ignoring subfolders
24+
defang
25+
defang.exe
26+
# Ignore our project-level state
27+
.defang

samples/google-adk/.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Fill in your GCP project info and rename this file to ".env".
2+
3+
GOOGLE_GENAI_USE_VERTEXAI=1
4+
GOOGLE_CLOUD_PROJECT=<YOUR_PROJECT_ID>
5+
GOOGLE_CLOUD_LOCATION=<YOUR_PROJECT_LOCATION>
6+
GOOGLE_CLOUD_STORAGE_BUCKET=<YOUR_STORAGE_BUCKET> # Only required for deployment on Agent Engine

samples/google-adk/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Google ADK Sample
2+
3+
[![1-click-deploy](https://raw.githubusercontent.com/DefangLabs/defang-assets/main/Logos/Buttons/SVG/deploy-with-defang.svg)](https://portal.defang.dev/redirect?url=https%3A%2F%2Fgithub.com%2Fnew%3Ftemplate_name%3Dsample-google-adk-template%26template_owner%3DDefangSamples)
4+
5+
This is a simple sample demonstrating how to deploy agents build with Google ADK to Defang.
6+
7+
## Prerequisites
8+
9+
1. Download [Defang CLI](https://github.com/DefangLabs/defang)
10+
2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
11+
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)
12+
13+
14+
## Development
15+
16+
To run the application locally, you can use the following command:
17+
18+
```bash
19+
docker compose up --build
20+
```
21+
22+
## Deployment
23+
24+
> [!NOTE]
25+
> Download [Defang CLI](https://github.com/DefangLabs/defang)
26+
27+
### Defang Playground
28+
29+
Deploy your application to the Defang Playground by opening up your terminal and typing:
30+
```bash
31+
defang compose up
32+
```
33+
34+
### BYOC (GCP)
35+
36+
If you want to deploy to your own cloud account, you can use Defang BYOC:
37+
38+
1. [Authenticate your GCP account](https://cloud.google.com/sdk/docs/quickstart).
39+
2. Run in a terminal that has access to your GCP project id:
40+
```bash
41+
GCP_PROJECT_ID=my-project-12345 defang --provider=gcp compose up
42+
43+
### BYOC (AWS)
44+
45+
If you want to deploy to your own cloud account, you can use Defang BYOC:
46+
47+
1. [Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
48+
2. Run in a terminal that has access to your AWS environment variables:
49+
```bash
50+
defang --provider=aws compose up
51+
52+
---
53+
54+
Title: Google ADK
55+
56+
Short Description: A simple sample demonstrating how to deploy agents build with Google ADK to Defang.
57+
58+
Tags: Google ADK, Python, Agents
59+
60+
Languages: python
Lines changed: 33 additions & 0 deletions
Loading
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Academic_Research: Research advice, related literature finding, research area proposals, web knowledge access."""
16+
17+
from . import agent
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Academic_Research: Research advice, related literature finding, research area proposals, web knowledge access."""
16+
17+
from google.adk.agents import LlmAgent
18+
from google.adk.tools.agent_tool import AgentTool
19+
20+
from . import prompt
21+
from .sub_agents.academic_newresearch import academic_newresearch_agent
22+
from .sub_agents.academic_websearch import academic_websearch_agent
23+
24+
MODEL = "gemini-2.5-pro"
25+
26+
27+
academic_coordinator = LlmAgent(
28+
name="academic_coordinator",
29+
model=MODEL,
30+
description=(
31+
"analyzing seminal papers provided by the users, "
32+
"providing research advice, locating current papers "
33+
"relevant to the seminal paper, generating suggestions "
34+
"for new research directions, and accessing web resources "
35+
"to acquire knowledge"
36+
),
37+
instruction=prompt.ACADEMIC_COORDINATOR_PROMPT,
38+
output_key="seminal_paper",
39+
tools=[
40+
AgentTool(agent=academic_websearch_agent),
41+
AgentTool(agent=academic_newresearch_agent),
42+
],
43+
)
44+
45+
root_agent = academic_coordinator
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Prompt for the academic_coordinator_agent."""
16+
17+
18+
ACADEMIC_COORDINATOR_PROMPT = """
19+
System Role: You are an AI Research Assistant. Your primary function is to analyze a seminal paper provided by the user and
20+
then help the user explore the recent academic landscape evolving from it. You achieve this by analyzing the seminal paper,
21+
finding recent citing papers using a specialized tool, and suggesting future research directions using another specialized
22+
tool based on the findings.
23+
24+
Workflow:
25+
26+
Initiation:
27+
28+
Greet the user.
29+
Ask the user to provide the seminal paper they wish to analyze as PDF.
30+
Seminal Paper Analysis (Context Building):
31+
32+
Once the user provides the paper information, state that you will analyze the seminal paper for context.
33+
Process the identified seminal paper.
34+
Present the extracted information clearly under the following distinct headings:
35+
Seminal Paper: [Display Title, Primary Author(s), Publication Year]
36+
Authors: [List all authors, including affiliations if available, e.g., "Antonio Gulli (Google)"]
37+
Abstract: [Display the full abstract text]
38+
Summary: [Provide a concise narrative summary (approx. 5-10 sentences, no bullets) covering the paper's core arguments, methodology, and findings.]
39+
Key Topics/Keywords: [List the main topics or keywords derived from the paper.]
40+
Key Innovations: [Provide a bulleted list of up to 5 key innovations or novel contributions introduced by this paper.]
41+
References Cited Within Seminal Paper: [Extract the bibliography/references section from the seminal paper.
42+
List each reference on a new line using a standard citation format (e.g., Author(s). Title. Venue. Details. Date.).]
43+
Find Recent Citing Papers (Using academic_websearch):
44+
45+
Inform the user you will now search for recent papers citing the seminal work.
46+
Action: Invoke the academic_websearch agent/tool.
47+
Input to Tool: Provide necessary identifiers for the seminal paper.
48+
Parameter: Specify the desired recency. Ask the user or use a default timeframe, e.g., "papers published during last year"
49+
(e.g., since January 2025, based on the current date April 21, 2025).
50+
Expected Output from Tool: A list of recent academic papers citing the seminal work.
51+
Presentation: Present this list clearly under a heading like "Recent Papers Citing [Seminal Paper Title]".
52+
Include details for each paper found (e.g., Title, Authors, Year, Source, Link/DOI).
53+
If no papers are found in the specified timeframe, state that clearly.
54+
The agent will provide the answer and i want you to print it to the user
55+
56+
Suggest Future Research Directions (Using academic_newresearch):
57+
Inform the user that based on the seminal paper from the seminal paper and the recent citing papers provided by the academic_websearch agent/tool,
58+
you will now suggest potential future research directions.
59+
Action: Invoke the academic_newresearch agent/tool.
60+
Inputs to Tool:
61+
Information about the seminal paper (e.g., summary, keywords, innovations)
62+
The list of recent citing papers citing the seminal work provided by the academic_websearch agent/tool
63+
Expected Output from Tool: A synthesized list of potential future research questions, gaps, or promising avenues.
64+
Presentation: Present these suggestions clearly under a heading like "Potential Future Research Directions".
65+
Structure them logically (e.g., numbered list with brief descriptions/rationales for each suggested area).
66+
67+
Conclusion:
68+
Briefly conclude the interaction, perhaps asking if the user wants to explore any area further.
69+
70+
"""

0 commit comments

Comments
 (0)