From 83693fa7489589a5782f001eb63f5ec2f3bd3fcf Mon Sep 17 00:00:00 2001 From: Sai Saran Vaidyanathan Date: Tue, 2 Dec 2025 14:28:17 -0800 Subject: [PATCH 1/4] feat: add Java doc --- docs/agents/models.md | 65 +++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/docs/agents/models.md b/docs/agents/models.md index d509771f4b..80a57822d0 100644 --- a/docs/agents/models.md +++ b/docs/agents/models.md @@ -322,7 +322,7 @@ public class DirectAnthropicAgent { ## Using Apigee gateway for AI models
- Supported in ADKPython v1.18.0 + Supported in ADKPython v1.18.0Java v0.4.0
[Apigee](https://docs.cloud.google.com/apigee/docs/api-platform/get-started/what-apigee) acts as a powerful [AI Gateway](https://cloud.google.com/solutions/apigee-ai), transforming how you manage and govern your generative AI model traffic. By exposing your AI model endpoint (like Vertex AI or the Gemini API) through an Apigee proxy, you immediately gain enterprise-grade capabilities: @@ -341,29 +341,52 @@ public class DirectAnthropicAgent { **Example:** -```python +=== "Python" -from google.adk.agents import LlmAgent -from google.adk.models.apigee_llm import ApigeeLlm - -# Instantiate the ApigeeLlm wrapper -model = ApigeeLlm( - # Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation (https://github.com/google/adk-python/tree/main/contributing/samples/hello_world_apigeellm). - model="apigee/gemini-2.5-flash", - # The proxy URL of your deployed Apigee proxy including the base path - proxy_url=f"https://{APIGEE_PROXY_URL}", - # Pass necessary authentication/authorization headers (like an API key) - custom_headers={"foo": "bar"} -) + ```python -# Pass the configured model wrapper to your LlmAgent -agent = LlmAgent( - model=model, - name="my_governed_agent", - instruction="You are a helpful assistant powered by Gemini and governed by Apigee.", - # ... other agent parameters -) + from google.adk.agents import LlmAgent + from google.adk.models.apigee_llm import ApigeeLlm + + # Instantiate the ApigeeLlm wrapper + model = ApigeeLlm( + # Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation (https://github.com/google/adk-python/tree/main/contributing/samples/hello_world_apigeellm). + model="apigee/gemini-2.5-flash", + # The proxy URL of your deployed Apigee proxy including the base path + proxy_url=f"https://{APIGEE_PROXY_URL}", + # Pass necessary authentication/authorization headers (like an API key) + custom_headers={"foo": "bar"} + ) + # Pass the configured model wrapper to your LlmAgent + agent = LlmAgent( + model=model, + name="my_governed_agent", + instruction="You are a helpful assistant powered by Gemini and governed by Apigee.", + # ... other agent parameters + ) + + ``` + +=== "Java" + +```java +Map headers = new HashMap(); +headers.put("foo", "bar"); +ApigeeLlm apigeeLlm = + ApigeeLlm.builder() + .modelName("apigee/gemini-2.5-flash") // Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation + .proxyUrl(APIGEE_PROXY_URL) //The proxy URL of your deployed Apigee proxy including the base path + .customHeaders(headers) //Pass necessary authentication/authorization headers (like an API key) + .build(); +LlmAgent agent = + LlmAgent.builder() + .model(apigeeLlm) + .name("my_governed_agent") + .description("my_governed_agent") + .instruction("You are a helpful assistant powered by Gemini and governed by Apigee.") + // tools will be added next + .build(); ``` With this configuration, every API call from your agent will be routed through Apigee first, where all necessary policies (security, rate limiting, logging) are executed before the request is securely forwarded to the underlying AI model endpoint. From a25f8c077693b97997f37aa28bb09dab3e9a63ea Mon Sep 17 00:00:00 2001 From: Sai Saran Vaidyanathan Date: Tue, 2 Dec 2025 14:59:02 -0800 Subject: [PATCH 2/4] Update models.md --- docs/agents/models.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/agents/models.md b/docs/agents/models.md index 80a57822d0..67b6f01ee2 100644 --- a/docs/agents/models.md +++ b/docs/agents/models.md @@ -371,13 +371,11 @@ public class DirectAnthropicAgent { === "Java" ```java -Map headers = new HashMap(); -headers.put("foo", "bar"); ApigeeLlm apigeeLlm = ApigeeLlm.builder() .modelName("apigee/gemini-2.5-flash") // Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation .proxyUrl(APIGEE_PROXY_URL) //The proxy URL of your deployed Apigee proxy including the base path - .customHeaders(headers) //Pass necessary authentication/authorization headers (like an API key) + .customHeaders(ImmutableMap.of("foo", "bar")) //Pass necessary authentication/authorization headers (like an API key) .build(); LlmAgent agent = LlmAgent.builder() From 5e37172bbc2899a0ba49a2f95c77180a7bfac655 Mon Sep 17 00:00:00 2001 From: Sai Saran Vaidyanathan Date: Tue, 2 Dec 2025 15:00:58 -0800 Subject: [PATCH 3/4] Update models.md --- docs/agents/models.md | 80 +++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/docs/agents/models.md b/docs/agents/models.md index 67b6f01ee2..690765fc4a 100644 --- a/docs/agents/models.md +++ b/docs/agents/models.md @@ -343,49 +343,49 @@ public class DirectAnthropicAgent { === "Python" - ```python - - from google.adk.agents import LlmAgent - from google.adk.models.apigee_llm import ApigeeLlm - - # Instantiate the ApigeeLlm wrapper - model = ApigeeLlm( - # Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation (https://github.com/google/adk-python/tree/main/contributing/samples/hello_world_apigeellm). - model="apigee/gemini-2.5-flash", - # The proxy URL of your deployed Apigee proxy including the base path - proxy_url=f"https://{APIGEE_PROXY_URL}", - # Pass necessary authentication/authorization headers (like an API key) - custom_headers={"foo": "bar"} - ) - - # Pass the configured model wrapper to your LlmAgent - agent = LlmAgent( - model=model, - name="my_governed_agent", - instruction="You are a helpful assistant powered by Gemini and governed by Apigee.", - # ... other agent parameters - ) - - ``` + ```python + + from google.adk.agents import LlmAgent + from google.adk.models.apigee_llm import ApigeeLlm + + # Instantiate the ApigeeLlm wrapper + model = ApigeeLlm( + # Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation (https://github.com/google/adk-python/tree/main/contributing/samples/hello_world_apigeellm). + model="apigee/gemini-2.5-flash", + # The proxy URL of your deployed Apigee proxy including the base path + proxy_url=f"https://{APIGEE_PROXY_URL}", + # Pass necessary authentication/authorization headers (like an API key) + custom_headers={"foo": "bar"} + ) + + # Pass the configured model wrapper to your LlmAgent + agent = LlmAgent( + model=model, + name="my_governed_agent", + instruction="You are a helpful assistant powered by Gemini and governed by Apigee.", + # ... other agent parameters + ) + + ``` === "Java" -```java -ApigeeLlm apigeeLlm = - ApigeeLlm.builder() - .modelName("apigee/gemini-2.5-flash") // Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation - .proxyUrl(APIGEE_PROXY_URL) //The proxy URL of your deployed Apigee proxy including the base path - .customHeaders(ImmutableMap.of("foo", "bar")) //Pass necessary authentication/authorization headers (like an API key) - .build(); -LlmAgent agent = - LlmAgent.builder() - .model(apigeeLlm) - .name("my_governed_agent") - .description("my_governed_agent") - .instruction("You are a helpful assistant powered by Gemini and governed by Apigee.") - // tools will be added next - .build(); -``` + ```java + ApigeeLlm apigeeLlm = + ApigeeLlm.builder() + .modelName("apigee/gemini-2.5-flash") // Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation + .proxyUrl(APIGEE_PROXY_URL) //The proxy URL of your deployed Apigee proxy including the base path + .customHeaders(ImmutableMap.of("foo", "bar")) //Pass necessary authentication/authorization headers (like an API key) + .build(); + LlmAgent agent = + LlmAgent.builder() + .model(apigeeLlm) + .name("my_governed_agent") + .description("my_governed_agent") + .instruction("You are a helpful assistant powered by Gemini and governed by Apigee.") + // tools will be added next + .build(); + ``` With this configuration, every API call from your agent will be routed through Apigee first, where all necessary policies (security, rate limiting, logging) are executed before the request is securely forwarded to the underlying AI model endpoint. From e44983286fc7d11f43632ce39dcc91a09db9b950 Mon Sep 17 00:00:00 2001 From: Sai Saran Vaidyanathan Date: Tue, 2 Dec 2025 15:25:05 -0800 Subject: [PATCH 4/4] Update models.md --- docs/agents/models.md | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/docs/agents/models.md b/docs/agents/models.md index 690765fc4a..0cf7c09175 100644 --- a/docs/agents/models.md +++ b/docs/agents/models.md @@ -371,21 +371,25 @@ public class DirectAnthropicAgent { === "Java" ```java - ApigeeLlm apigeeLlm = - ApigeeLlm.builder() - .modelName("apigee/gemini-2.5-flash") // Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation - .proxyUrl(APIGEE_PROXY_URL) //The proxy URL of your deployed Apigee proxy including the base path - .customHeaders(ImmutableMap.of("foo", "bar")) //Pass necessary authentication/authorization headers (like an API key) - .build(); - LlmAgent agent = - LlmAgent.builder() - .model(apigeeLlm) - .name("my_governed_agent") - .description("my_governed_agent") - .instruction("You are a helpful assistant powered by Gemini and governed by Apigee.") - // tools will be added next - .build(); - ``` + import com.google.adk.agents.LlmAgent; + import com.google.adk.models.ApigeeLlm; + import com.google.common.collect.ImmutableMap; + + ApigeeLlm apigeeLlm = + ApigeeLlm.builder() + .modelName("apigee/gemini-2.5-flash") // Specify the Apigee route to your model. For more info, check out the ApigeeLlm documentation + .proxyUrl(APIGEE_PROXY_URL) //The proxy URL of your deployed Apigee proxy including the base path + .customHeaders(ImmutableMap.of("foo", "bar")) //Pass necessary authentication/authorization headers (like an API key) + .build(); + LlmAgent agent = + LlmAgent.builder() + .model(apigeeLlm) + .name("my_governed_agent") + .description("my_governed_agent") + .instruction("You are a helpful assistant powered by Gemini and governed by Apigee.") + // tools will be added next + .build(); +``` With this configuration, every API call from your agent will be routed through Apigee first, where all necessary policies (security, rate limiting, logging) are executed before the request is securely forwarded to the underlying AI model endpoint.