This project is a lightweight, production-style Python application designed to connect to and interact with Azure AI Foundry agents using the azure.ai.agents SDK.
It provides a clean baseline for:
- Validating connectivity to Foundry-deployed agents
- Sending and receiving messages
- Building reusable agent interaction patterns
- Serving as a foundation for more advanced AI-enabled applications
This repository focuses on two primary scripts:
A minimal validation script that:
- Authenticates using Azure credentials
- Connects to a Foundry project endpoint
- Retrieves an existing agent
- Sends a simple message
- Prints the agent’s response
👉 Purpose: Quickly confirm that your environment, authentication, and agent connectivity are working correctly.
An extended test script that:
- Accepts user input (text and/or image)
- Sends structured messages to the agent
- Demonstrates more advanced interaction patterns
👉 Purpose: Serve as a foundation for building user-driven or multimodal agent workflows.
Before getting started, ensure you have:
- ✅ Python 3.10+
- ✅ VS Code (recommended)
- ✅ Azure CLI installed
- ✅ Access to an Azure AI Foundry project
- ✅ A deployed agent (created via UI or API)
git clone https://github.com/<your-username>/<your-repo>.git
cd <your-repo>code .python -m venv .venvWindows (PowerShell):
.venv\Scripts\ActivateMac/Linux:
source .venv/bin/activateEven after activating the virtual environment, VS Code may still be using a different Python interpreter.
To ensure the correct one is selected:
Press Ctrl + Shift + P Search for: Python: Select Interpreter Choose the interpreter that points to: .venv\Scripts\python.exe (Windows)
or
.venv/bin/python (Mac/Linux)
✅ You should now see .venv in the bottom-right corner of VS Code.
pip install -r requirements.txtaz loginThis allows DefaultAzureCredential to work automatically.
Copy the example file:
copy .env.example .env(or on Mac/Linux)
cp .env.example .envThen update .env with your values:
AZURE_AI_PROJECT_ENDPOINT=https://<your-resource>.services.ai.azure.com/api/projects/<your-project>
AZURE_AGENT_ID=asst_xxxxxxxxxxxxxxxxxAZURE_AGENT_IDmust be the actual agent ID (not name).envis not committed to git (by design)
python src/basic_test.py- Successful authentication message
- Agent retrieval confirmation
- A response from your agent
Cause: Missing or incorrect environment variable
Fix: Verify .env contains:
AZURE_AGENT_ID=...If DefaultAzureCredential fails:
az loginOr ensure your account has access to the Foundry project.
Ensure:
.envis in the project root- Script uses:
load_dotenv(Path(__file__).resolve().parents[1] / ".env").
├── src/
│ ├── basic_test.py
│ ├── image_test.py
│
├── .env.example
├── requirements.txt
├── README.md
.envis excluded via.gitignore- Never commit credentials or secrets
- Use Azure RBAC for access control
- Reusable agent client wrapper
- CLI interface for agent interaction
- Structured logging and error handling
- Integration with APIs / front-end apps
- Multi-agent orchestration patterns
This project demonstrates:
- Real-world Azure AI Foundry integration
- Secure credential handling
- Clean Python environment setup
- Practical agent interaction patterns
It is intentionally designed to be:
✅ Simple to run ✅ Easy to extend ✅ Useful as a learning and portfolio artifact
Feel free to fork and expand:
- Add new agent workflows
- Integrate with cloud services (AWS/Azure hybrid)
- Build UI layers or APIs