agents with adk
create a virtual env no matter what to get clean stuff
``` shell!=
python -m venv .myvenv #even can be hidden or not
source .myvenv/bin/activate
pip install -r requirements.txt
```

```shell!=
#delete venv
rm -rf venv
```
```shell!=
just fo the research agent sample
pip install poetry
# Clone this repository.
git clone https://github.com/google/adk-samples.git
cd adk-samples/python/agents/academic-research
# Install the package and dependencies.
poetry install
cd till root then
adk web
test
who are you
uv run adk web --port 8501
```


---
---
## run java check gemini models
structure of project java:

**idx is not required **
``` java!=
enviroment vairables
export GOOGLE_API_KEY=API_KEY
export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_VERTEXAI=True
then in pom.xml
```
API KEY generation from console also is gcloud set of commands and also enbale [vertex ai api](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com) access.

**append** not add, not put at the end, dependency like this in pom.xml :
```xml !=
<dependencies>
<dependency>
<groupId>com.google.genai</groupId>
<artifactId>google-genai</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>
```

add code and decorator to main class:
***original code:***
``` java !=
import com.google.genai.Client;
import com.google.genai.types.Content;
import com.google.genai.types.GenerateContentResponse;
import com.google.genai.types.HttpOptions;
import com.google.genai.types.Part;
public class GenerateContentWithText {
public static void main(String[] args) {
// TODO(developer): Replace these variables before running the sample.
String modelId = "gemini-2.0-flash";
generateContent(modelId);
}
public static String generateContent(String modelId) {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests.
try (Client client = Client.builder()
.httpOptions(HttpOptions.builder().apiVersion("v1").build())
.build()) {
GenerateContentResponse response =
client.models.generateContent(modelId, Content.fromParts(
Part.fromText("How does AI work?")),
null);
System.out.print(response.text());
// Example response:
// Okay, let's break down how AI works. It's a broad field, so I'll focus on the ...
//
// Here's a simplified overview:
// ...
return response.text();
}
}
}
```
***modified code:***
```java!=
package com.example.demo;
import com.google.genai.Client;
import com.google.genai.types.Content;
import com.google.genai.types.GenerateContentResponse;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.google.genai.types.HttpOptions;
import com.google.genai.types.Part;
@SpringBootApplication
public class GenerateContentWithText {
public static void main(String[] args) {
// TODO(developer): Replace these variables before running the sample.
String modelId = "gemini-2.0-flash";
generateContent(modelId);
}
public static String generateContent(String modelId) {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests.
try (Client client = Client.builder()
.httpOptions(HttpOptions.builder().apiVersion("v1").build())
.build()) {
GenerateContentResponse response =
client.models.generateContent(modelId, Content.fromParts(
Part.fromText("How does AI work?")),
null);
System.out.print(response.text());
// Example response:
// Okay, let's break down how AI works. It's a broad field, so I'll focus on the ...
//
// Here's a simplified overview:
// ...
return response.text();
}
}
}
```

recall to add the springboot decarator to class and import
then try `mvn package, mvn clean install, mvn build` and execute with :
```shell!=
javageminiapp-97980373:~/javageminiapp$ mvn exec:java -Dexec.mainClass="com.GenerateContentWithText.App"
```
check class appart if necesary richt click over main class and select `run java` for debbuging
**you should** have a response from model like this one :

refence(s):
https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal#send-text-only-request