A powerful AI agent with multiple tools, deployed on Azure App Service with automated CI/CD and secure Key Vault integration.
- AI-Powered Tools - Calculator, time, file operations, text analysis, RAG search
- FastAPI REST API - Clean, documented endpoints with Swagger UI
- Azure Integration - Deployed on Azure App Service with Key Vault
- CI/CD Pipeline - Automated deployment via GitHub Actions
- Security First - All secrets stored in Azure Key Vault
- Production Ready - Comprehensive error handling and monitoring
- Calculator Tool - Mathematical calculations
- Time Tool - Current date and time
- File Operations - Read, write, list files
- Text Analysis - Sentiment analysis, word count
- RAG Search - Document search and retrieval
- Web Search - Mock web search functionality
GitHub Repo → GitHub Actions → Azure App Service → Azure OpenAI
fastapi-tool-agent/
├── .github/workflows/
│ └── azure-deploy.yml # CI/CD pipeline
├── fastapi_agent.py # Main FastAPI application
├── tool_agent.py # AI agent with tools
├── azure_config.py # Azure configuration
├── config.py # Local configuration
├── startup.py # Azure startup script
├── test_api.py # API test client
├── start_api.sh # Local startup script
├── deploy_to_azure.sh # Azure deployment script
├── setup_github_repo.sh # GitHub setup script
├── requirements.txt # Python dependencies
└── README.md # This file
# Install dependencies
pip install -r requirements.txt
# Run locally
python3 fastapi_agent.py
# or
./start_api.sh# Setup GitHub repository
./setup_github_repo.sh
# Deploy to Azure
./deploy_to_azure.sh
# Add GitHub secret: AZURE_WEBAPP_PUBLISH_PROFILE
# Push to main to trigger deploymentPOST /agent/query- Natural language queries
POST /tools/calculator- Math calculationsPOST /tools/time- Current date/timePOST /tools/file- File operationsPOST /tools/search- Web searchPOST /tools/analyze- Text analysisPOST /tools/rag- Document search
GET /- API informationGET /health- Health checkGET /tools- Available toolsGET /examples- Usage examples
# Test the agent
python3 -c "
import asyncio
from tool_agent import ToolBasedAgent
async def test():
agent = ToolBasedAgent()
result = await agent.run('What is 2 + 2?')
print(result)
asyncio.run(test())
"
# Test the API
python3 test_api.py# Test health check
curl https://your-app.azurewebsites.net/health
# Test agent query
curl -X POST "https://your-app.azurewebsites.net/agent/query" \
-H "Content-Type: application/json" \
-d '{"query": "What is 2 + 2?"}'AZURE_OPENAI_API_KEY- Azure OpenAI API keyAZURE_OPENAI_ENDPOINT- Azure OpenAI endpointAZURE_OPENAI_API_VERSION- API versionAZURE_OPENAI_DEPLOYMENT_NAME- Model deployment name
AZURE_WEBAPP_PUBLISH_PROFILE- Azure deployment credentials
The GitHub Actions workflow automatically:
- Tests the application
- Builds deployment package
- Deploys to Azure App Service
- Configures environment variables
- Verifies deployment health
- Azure Portal - App Service monitoring
- Application Logs - Real-time logging
- Health Endpoints - Service availability
- GitHub Actions - CI/CD status
- Web Applications - AI-powered web apps
- Mobile Apps - Backend API for mobile
- Automation - Workflow automation
- Development - AI-assisted development tools
-
Deployment fails:
- Check GitHub Actions logs
- Verify Azure credentials
- Check app settings
-
App won't start:
- Check startup command
- Verify Python version
- Check application logs
-
API errors:
- Verify Azure OpenAI configuration
- Check environment variables
- Test locally first
# Check app status
az webapp show --name your-app-name --resource-group your-resource-group
# Check logs
az webapp log tail --name your-app-name --resource-group your-resource-group
# Restart app
az webapp restart --name your-app-name --resource-group your-resource-group- API Documentation - Interactive Swagger UI at
/docs - Deployment Guide - See
AZURE_DEPLOYMENT_GUIDE.md - API Reference - See
API_DOCS.md
- Issues - Create GitHub issues
- Documentation - Check
/docsendpoint - Logs - Check Azure App Service logs
✅ All features implemented and tested ✅ Deployment pipeline configured ✅ Documentation complete ✅ Ready for production use
Your FastAPI Tool Agent is ready for deployment! 🚀