diff --git a/docs/agents/models.md b/docs/agents/models.md
index d509771f4b..0cf7c09175 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,54 @@ 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
+ 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.