Copied to Clipboard
Then run the Azure setup scripts:
./setup-azure-phi.sh
./get-azure-phi-creds.sh
The Azure console should look something like this:
With the resource group looking like this:
Running the Python Code
First- switch the directory with the Python version of the MCP sample code. Run the release version on the local system:
cd adk-litellm$ make install
Processing ./.
Verify The ADK Installation
First- verify the ADK is installed:
william [~/gemini-cli-azure/adk-litellm-azure]$adk --version
adk, version 1.32.0
william [~/gemini-cli-azure/adk-litellm-azure]$
To check the ADK setup, run the ADK CLI locally with the hello Agent. This is a basic Hello World style agent. No external tools or MCP calls are used in the Agent code- which allows the ADK installation to be checked:
william [~/gemini-cli-azure/adk-litellm-azure]$adk run agents/azure
Log setup complete: /tmp/agents_log/agent.20260505_192533.log
To access latest log: tail -F /tmp/agents_log/agent.latest.log
/home/william/.local/lib/python3.12/site-packages/google/adk/cli/cli.py:204: UserWarning: [EXPERIMENTAL] InMemoryCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
credential_service = InMemoryCredentialService()
/home/william/.local/lib/python3.12/site-packages/google/adk/auth/credential_service/in_memory_credential_service.py:33: UserWarning: [EXPERIMENTAL] BaseCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
super(). __init__ ()
Running agent azure_agent, type exit to exit.
[user]: what model are you
19:25:39 - LiteLLM:INFO: utils.py:4011 -
LiteLLM completion() model= phi-4-mini;provider = azure_ai
[azure_agent]: I am Phi, an AI developed by Microsoft, created to help assist you with providing information, answering questions, and helping out with related tasks. How can I assist you today?
Phi Models on Azure
Microsoft Phi models are a family of highly capable, cost-effective Small Language Models (SLMs) designed for low-latency generative AI, available on Azure AI Foundry. They support text, image, and audio inputs (Phi-4-multimodal) and are ideal for memory-constrained environments. Key models include Phi-4, Phi-3.5-MoE, and Phi-3-mini/medium, optimized for high-performance reasoning tasks.
More details are here:
Deep Dive with a Phi Model
Once the connection has been tested. You can drill into the model:
xbill@penguin:~/gemini-cli-azure/adk-litellm-azure$adk run agents/azure
Log setup complete: /tmp/agents_log/agent.20260505_134754.log
To access latest log: tail -F /tmp/agents_log/agent.latest.log
/home/xbill/.local/lib/python3.13/site-packages/google/adk/cli/cli.py:204: UserWarning: [EXPERIMENTAL] InMemoryCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
credential_service = InMemoryCredentialService()
/home/xbill/.local/lib/python3.13/site-packages/google/adk/auth/credential_service/in_memory_credential_service.py:33: UserWarning: [EXPERIMENTAL] BaseCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
super(). __init__ ()
Running agent azure_agent, type exit to exit.
[user]: what model are you
13:48:00 - LiteLLM:INFO: utils.py:4011 -
LiteLLM completion() model= phi-4-mini;provider = azure_ai
[azure_agent]: I am Phi, an AI developed by Microsoft, designed to help you with a wide range of queries and tasks. How can I assist you today?
One Last Code Review with Gemini CLI
Gemini CLI was used to summarize the project:
> code review adk agent for phi model
✦ I've reviewed the Azure agent implementation in agents/azure/agent.py. Overall, the implementation correctly utilizes the ADK (Agent Development
Kit) and integrates with Azure AI Foundry via LiteLLM.
🔍 Code Review Findings
1. ADK Best Practices
* Missing description: While the name is correctly defined, the description parameter is missing. In ADK, the description is critical for
multi-agent systems, as it helps routers and other agents understand when to delegate tasks to this specific agent.
* Minimal instruction: The current instruction is very brief. ADK best practices suggest using Markdown for clarity and being more specific
about the agent's persona and constraints.
* Short request_timeout: The timeout is set to 10 seconds. For LLM inferences, especially via serverless endpoints which may have occasional
cold starts or latency, 30 seconds is generally more reliable.
2. Azure AI Foundry Integration
* Model String: The model string azure_ai/phi-4-mini is correctly formatted for LiteLLM to recognize the Azure AI Foundry provider.
* Environment Variables: The code correctly leverages AZURE_MODEL with a fallback. It assumes AZURE_AI_API_KEY and AZURE_AI_API_BASE are set in
the environment, which matches the setup-azure-phi.sh automation script.
3. Code Quality
* Imports: Clean and follows standard ADK patterns.
* Encapsulation: Using root_agent as the export in agent.py (and re-exporting in __init__.py) is the standard pattern for ADK's discovery
mechanism.
Summary
The strategy for using the ADK with Azure LLMs was validated with a incremental step by step approach.
First- the basic environment tools were configured. Then the required Python libraries were installed. LiteLLM was used to proxy the Google ADK to a Model hosted on Azure. Finally, some tests were run from the CLI and the Web interface. Gemini CLI was used to validate the approach.