Skip to content

Commit 988736f

Browse files
google adk sample
1 parent 6e41939 commit 988736f

File tree

24 files changed

+6401
-0
lines changed

24 files changed

+6401
-0
lines changed

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/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM python:3.11-slim
2+
3+
WORKDIR /app
4+
5+
# Install Poetry
6+
RUN pip install --no-cache-dir poetry
7+
8+
# Copy only poetry files first for caching
9+
COPY pyproject.toml poetry.lock* /app/
10+
11+
# Install dependencies
12+
RUN poetry install --no-root --no-interaction --no-ansi
13+
14+
# Copy the rest of the application
15+
COPY . /app
16+
17+
CMD ["poetry", "run", "python", "main.py"]

samples/google-adk/README.md

Lines changed: 424 additions & 0 deletions
Large diffs are not rendered by default.
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+
"""
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_websearch_agent for finding research papers using search tools."""
16+
17+
from .agent import academic_newresearch_agent
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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_newresearch_agent for finding new research lines"""
16+
17+
from google.adk import Agent
18+
19+
from . import prompt
20+
21+
MODEL = "gemini-2.5-pro"
22+
23+
academic_newresearch_agent = Agent(
24+
model=MODEL,
25+
name="academic_newresearch_agent",
26+
instruction=prompt.ACADEMIC_NEWRESEARCH_PROMPT,
27+
)

0 commit comments

Comments
 (0)